From c7915b5bd657e7e86caed1fe34e4fa2278769285 Mon Sep 17 00:00:00 2001 From: Miloslav Trmač Date: Sat, 7 Aug 2010 03:16:36 +0200 Subject: Use a struct mutex for session_item_st.mem_mutex Suggested by scripts/checkpatch.pl --- ncr-int.h | 3 ++- ncr-sessions.c | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ncr-int.h b/ncr-int.h index e79747c..06c5e62 100644 --- a/ncr-int.h +++ b/ncr-int.h @@ -1,6 +1,7 @@ #ifndef NCR_INT_H # define NCR_INT_H +#include #include "ncr.h" #include #include "cryptodev_int.h" @@ -48,7 +49,7 @@ struct session_item_st { struct page **pages; unsigned array_size; unsigned available_pages; - struct semaphore mem_mutex; /* down when the + struct mutex mem_mutex; /* down when the * values above are changed. */ diff --git a/ncr-sessions.c b/ncr-sessions.c index 365935f..0901618 100644 --- a/ncr-sessions.c +++ b/ncr-sessions.c @@ -24,6 +24,7 @@ */ #include +#include #include "cryptodev.h" #include "ncr.h" #include "ncr-int.h" @@ -119,7 +120,7 @@ struct session_item_st* ncr_session_new(struct list_sem_st* lst) kfree(sess); return NULL; } - init_MUTEX(&sess->mem_mutex); + mutex_init(&sess->mem_mutex); atomic_set(&sess->refcnt, 2); /* One for lst->list, one for "sess" */ @@ -636,7 +637,7 @@ static int _ncr_session_update(struct ncr_lists* lists, struct ncr_session_op_st return -EINVAL; } - if (down_interruptible(&sess->mem_mutex)) { + if (mutex_lock_interruptible(&sess->mem_mutex)) { err(); _ncr_sessions_item_put(sess); return -ERESTARTSYS; @@ -717,7 +718,7 @@ fail: release_user_pages(sess->pages, sess->available_pages); sess->available_pages = 0; } - up(&sess->mem_mutex); + mutex_unlock(&sess->mem_mutex); _ncr_sessions_item_put(sess); return ret; @@ -763,7 +764,7 @@ static int _ncr_session_final(struct ncr_lists* lists, struct ncr_session_op_st* return ret; } - if (down_interruptible(&sess->mem_mutex)) { + if (mutex_lock_interruptible(&sess->mem_mutex)) { err(); _ncr_sessions_item_put(sess); return -ERESTARTSYS; @@ -890,7 +891,7 @@ fail: release_user_pages(sess->pages, sess->available_pages); sess->available_pages = 0; } - up(&sess->mem_mutex); + mutex_unlock(&sess->mem_mutex); cryptodev_hash_deinit(&sess->hash); if (sess->algorithm->is_symmetric) { -- cgit From 861078d0afcb65d7a03780d9a5603dae5fec82b9 Mon Sep 17 00:00:00 2001 From: Miloslav Trmač Date: Sat, 7 Aug 2010 03:18:37 +0200 Subject: Make cryptodev_fops const. Suggested by scripts/checkpatch.pl. --- cryptodev_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cryptodev_main.c b/cryptodev_main.c index 3223acd..a303bbb 100644 --- a/cryptodev_main.c +++ b/cryptodev_main.c @@ -951,7 +951,7 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_) #endif /* CONFIG_COMPAT */ -static struct file_operations cryptodev_fops = { +static const struct file_operations cryptodev_fops = { .owner = THIS_MODULE, .open = cryptodev_open, .release = cryptodev_release, -- cgit From 09966a1c51fe61490c7b5932db1e7ad5c299ca2f Mon Sep 17 00:00:00 2001 From: Miloslav Trmač Date: Sat, 7 Aug 2010 03:22:13 +0200 Subject: Use instead of Suggested by scripts/checkpatch.pl. --- cryptodev_cipher.c | 2 +- cryptodev_main.c | 2 +- ncr-dh.c | 2 +- ncr-key-storage.c | 2 +- ncr-key-wrap.c | 2 +- ncr-key.c | 2 +- ncr-pk.c | 2 +- ncr.c | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cryptodev_cipher.c b/cryptodev_cipher.c index 01dc29d..2df7259 100644 --- a/cryptodev_cipher.c +++ b/cryptodev_cipher.c @@ -25,9 +25,9 @@ #include #include #include +#include #include #include -#include #include #include #include diff --git a/cryptodev_main.c b/cryptodev_main.c index a303bbb..62a3f1b 100644 --- a/cryptodev_main.c +++ b/cryptodev_main.c @@ -34,12 +34,12 @@ #include #include #include +#include #include #include #include #include "cryptodev.h" #include -#include #include #include "cryptodev_int.h" #include "ncr-int.h" diff --git a/ncr-dh.c b/ncr-dh.c index cad4d4c..5275e34 100644 --- a/ncr-dh.c +++ b/ncr-dh.c @@ -22,12 +22,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include #include #include #include #include "cryptodev.h" #include -#include #include #include #include diff --git a/ncr-key-storage.c b/ncr-key-storage.c index 41e52b7..c78dcee 100644 --- a/ncr-key-storage.c +++ b/ncr-key-storage.c @@ -22,11 +22,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include #include #include #include "cryptodev.h" #include -#include #include #include "ncr.h" #include "ncr-int.h" diff --git a/ncr-key-wrap.c b/ncr-key-wrap.c index fda8de2..776fe66 100644 --- a/ncr-key-wrap.c +++ b/ncr-key-wrap.c @@ -22,13 +22,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include #include #include #include #include #include "cryptodev.h" #include -#include #include #include "ncr.h" #include "ncr-int.h" diff --git a/ncr-key.c b/ncr-key.c index 40767c4..835dfcd 100644 --- a/ncr-key.c +++ b/ncr-key.c @@ -22,12 +22,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include #include #include #include #include "cryptodev.h" #include -#include #include #include "ncr.h" #include "ncr-int.h" diff --git a/ncr-pk.c b/ncr-pk.c index fece4ec..0ecbe33 100644 --- a/ncr-pk.c +++ b/ncr-pk.c @@ -22,12 +22,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include #include #include #include #include "cryptodev.h" #include -#include #include #include "ncr.h" #include "ncr-int.h" diff --git a/ncr.c b/ncr.c index 7608312..cc9696b 100644 --- a/ncr.c +++ b/ncr.c @@ -23,12 +23,12 @@ */ #include +#include #include #include #include #include "cryptodev.h" #include -#include #include #include #include -- cgit From cb519ef9fc39d3ccb1272ec7685524443490ca54 Mon Sep 17 00:00:00 2001 From: Miloslav Trmač Date: Sat, 7 Aug 2010 03:25:00 +0200 Subject: Use instead of Suggested by scripts/checkpatch.pl. --- cryptodev_cipher.c | 2 +- cryptodev_main.c | 2 +- ncr-dh.c | 2 +- ncr-key-storage.c | 2 +- ncr-key-wrap.c | 2 +- ncr-key.c | 2 +- ncr-pk.c | 2 +- ncr.c | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cryptodev_cipher.c b/cryptodev_cipher.c index 2df7259..8322027 100644 --- a/cryptodev_cipher.c +++ b/cryptodev_cipher.c @@ -27,8 +27,8 @@ #include #include #include -#include #include +#include #include #include #include "cryptodev.h" diff --git a/cryptodev_main.c b/cryptodev_main.c index 62a3f1b..a056b44 100644 --- a/cryptodev_main.c +++ b/cryptodev_main.c @@ -38,8 +38,8 @@ #include #include #include +#include #include "cryptodev.h" -#include #include #include "cryptodev_int.h" #include "ncr-int.h" diff --git a/ncr-dh.c b/ncr-dh.c index 5275e34..235d021 100644 --- a/ncr-dh.c +++ b/ncr-dh.c @@ -26,8 +26,8 @@ #include #include #include +#include #include "cryptodev.h" -#include #include #include #include diff --git a/ncr-key-storage.c b/ncr-key-storage.c index c78dcee..fc6948f 100644 --- a/ncr-key-storage.c +++ b/ncr-key-storage.c @@ -25,8 +25,8 @@ #include #include #include +#include #include "cryptodev.h" -#include #include #include "ncr.h" #include "ncr-int.h" diff --git a/ncr-key-wrap.c b/ncr-key-wrap.c index 776fe66..e3b1de5 100644 --- a/ncr-key-wrap.c +++ b/ncr-key-wrap.c @@ -27,8 +27,8 @@ #include #include #include +#include #include "cryptodev.h" -#include #include #include "ncr.h" #include "ncr-int.h" diff --git a/ncr-key.c b/ncr-key.c index 835dfcd..20a998f 100644 --- a/ncr-key.c +++ b/ncr-key.c @@ -26,8 +26,8 @@ #include #include #include +#include #include "cryptodev.h" -#include #include #include "ncr.h" #include "ncr-int.h" diff --git a/ncr-pk.c b/ncr-pk.c index 0ecbe33..392ff07 100644 --- a/ncr-pk.c +++ b/ncr-pk.c @@ -26,8 +26,8 @@ #include #include #include +#include #include "cryptodev.h" -#include #include #include "ncr.h" #include "ncr-int.h" diff --git a/ncr.c b/ncr.c index cc9696b..1cbe215 100644 --- a/ncr.c +++ b/ncr.c @@ -27,8 +27,8 @@ #include #include #include +#include #include "cryptodev.h" -#include #include #include #include -- cgit