* [PATCH 0/5] Patches to clean up SCSI code
@ 2013-08-26 15:03 Ewan D. Milne
2013-08-26 15:03 ` [PATCH 1/5] scsi: Fix incorrect function name in comment Ewan D. Milne
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Ewan D. Milne @ 2013-08-26 15:03 UTC (permalink / raw)
To: linux-scsi
From: "Ewan D. Milne" <emilne@redhat.com>
This is a set of 5 patches to clean up the SCSI code.
They consist of various things found during development
and review of some changes for Unit Attention handling
(which was submitted as a separate patch).
Ewan D. Milne (5):
scsi: Fix incorrect function name in comment
scsi: Correct size of envp[]
scsi: Add missing newline to scsi_sysfs.c
scsi: Change to use list_for_each_entry_safe
scsi: Rename scsi_evt_thread() to scsi_evt_work()
drivers/scsi/scsi_lib.c | 8 ++++----
drivers/scsi/scsi_priv.h | 1 +
drivers/scsi/scsi_scan.c | 3 +--
drivers/scsi/scsi_sysfs.c | 10 ++++------
4 files changed, 10 insertions(+), 12 deletions(-)
--
1.7.11.7
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/5] scsi: Fix incorrect function name in comment
2013-08-26 15:03 [PATCH 0/5] Patches to clean up SCSI code Ewan D. Milne
@ 2013-08-26 15:03 ` Ewan D. Milne
2013-08-26 15:03 ` [PATCH 2/5] scsi: Correct size of envp[] Ewan D. Milne
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Ewan D. Milne @ 2013-08-26 15:03 UTC (permalink / raw)
To: linux-scsi
From: "Ewan D. Milne" <emilne@redhat.com>
The function name is "scsi_evt_emit", not "sdev_evt_emit".
Signed-off-by: Ewan D. Milne <emilne@redhat.com>
---
drivers/scsi/scsi_lib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 6dfb978..f6499db 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2171,7 +2171,7 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state)
EXPORT_SYMBOL(scsi_device_set_state);
/**
- * sdev_evt_emit - emit a single SCSI device uevent
+ * scsi_evt_emit - emit a single SCSI device uevent
* @sdev: associated SCSI device
* @evt: event to emit
*
--
1.7.11.7
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/5] scsi: Correct size of envp[]
2013-08-26 15:03 [PATCH 0/5] Patches to clean up SCSI code Ewan D. Milne
2013-08-26 15:03 ` [PATCH 1/5] scsi: Fix incorrect function name in comment Ewan D. Milne
@ 2013-08-26 15:03 ` Ewan D. Milne
2013-08-26 15:03 ` [PATCH 3/5] scsi: Add missing newline to scsi_sysfs.c Ewan D. Milne
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Ewan D. Milne @ 2013-08-26 15:03 UTC (permalink / raw)
To: linux-scsi
From: "Ewan D. Milne" <emilne@redhat.com>
The envp[] array in scsi_evt_emit() only needs to have 2 entries.
Signed-off-by: Ewan D. Milne <emilne@redhat.com>
---
drivers/scsi/scsi_lib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index f6499db..6585049 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2180,7 +2180,7 @@ EXPORT_SYMBOL(scsi_device_set_state);
static void scsi_evt_emit(struct scsi_device *sdev, struct scsi_event *evt)
{
int idx = 0;
- char *envp[3];
+ char *envp[2];
switch (evt->evt_type) {
case SDEV_EVT_MEDIA_CHANGE:
--
1.7.11.7
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/5] scsi: Add missing newline to scsi_sysfs.c
2013-08-26 15:03 [PATCH 0/5] Patches to clean up SCSI code Ewan D. Milne
2013-08-26 15:03 ` [PATCH 1/5] scsi: Fix incorrect function name in comment Ewan D. Milne
2013-08-26 15:03 ` [PATCH 2/5] scsi: Correct size of envp[] Ewan D. Milne
@ 2013-08-26 15:03 ` Ewan D. Milne
2013-08-26 15:03 ` [PATCH 4/5] scsi: Change to use list_for_each_entry_safe Ewan D. Milne
2013-08-26 15:03 ` [PATCH 5/5] scsi: Rename scsi_evt_thread() to scsi_evt_work() Ewan D. Milne
4 siblings, 0 replies; 6+ messages in thread
From: Ewan D. Milne @ 2013-08-26 15:03 UTC (permalink / raw)
To: linux-scsi
From: "Ewan D. Milne" <emilne@redhat.com>
show_iostat_counterbits() is obviously missing a newline in
the function declaration.
Signed-off-by: Ewan D. Milne <emilne@redhat.com>
---
drivers/scsi/scsi_sysfs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 04c2a27..7394a77 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -647,7 +647,8 @@ show_queue_type_field(struct device *dev, struct device_attribute *attr,
static DEVICE_ATTR(queue_type, S_IRUGO, show_queue_type_field, NULL);
static ssize_t
-show_iostat_counterbits(struct device *dev, struct device_attribute *attr, char *buf)
+show_iostat_counterbits(struct device *dev, struct device_attribute *attr,
+ char *buf)
{
return snprintf(buf, 20, "%d\n", (int)sizeof(atomic_t) * 8);
}
--
1.7.11.7
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/5] scsi: Change to use list_for_each_entry_safe
2013-08-26 15:03 [PATCH 0/5] Patches to clean up SCSI code Ewan D. Milne
` (2 preceding siblings ...)
2013-08-26 15:03 ` [PATCH 3/5] scsi: Add missing newline to scsi_sysfs.c Ewan D. Milne
@ 2013-08-26 15:03 ` Ewan D. Milne
2013-08-26 15:03 ` [PATCH 5/5] scsi: Rename scsi_evt_thread() to scsi_evt_work() Ewan D. Milne
4 siblings, 0 replies; 6+ messages in thread
From: Ewan D. Milne @ 2013-08-26 15:03 UTC (permalink / raw)
To: linux-scsi
From: "Ewan D. Milne" <emilne@redhat.com>
scsi_device_dev_release_usercontext() should be using
"list_for_each_entry_safe" instead of "list_for_each_safe".
Signed-off-by: Ewan D. Milne <emilne@redhat.com>
---
drivers/scsi/scsi_sysfs.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 7394a77..34f7580 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -335,7 +335,7 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work)
struct scsi_device *sdev;
struct device *parent;
struct scsi_target *starget;
- struct list_head *this, *tmp;
+ struct scsi_event *evt, *next;
unsigned long flags;
sdev = container_of(work, struct scsi_device, ew.work);
@@ -352,10 +352,7 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work)
cancel_work_sync(&sdev->event_work);
- list_for_each_safe(this, tmp, &sdev->event_list) {
- struct scsi_event *evt;
-
- evt = list_entry(this, struct scsi_event, node);
+ list_for_each_entry_safe(evt, next, &sdev->event_list, node) {
list_del(&evt->node);
kfree(evt);
}
--
1.7.11.7
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 5/5] scsi: Rename scsi_evt_thread() to scsi_evt_work()
2013-08-26 15:03 [PATCH 0/5] Patches to clean up SCSI code Ewan D. Milne
` (3 preceding siblings ...)
2013-08-26 15:03 ` [PATCH 4/5] scsi: Change to use list_for_each_entry_safe Ewan D. Milne
@ 2013-08-26 15:03 ` Ewan D. Milne
4 siblings, 0 replies; 6+ messages in thread
From: Ewan D. Milne @ 2013-08-26 15:03 UTC (permalink / raw)
To: linux-scsi
From: "Ewan D. Milne" <emilne@redhat.com>
The scsi_evt_thread() function is not actually a thread, it is
a work function. So it should be named scsi_evt_work() instead.
Signed-off-by: Ewan D. Milne <emilne@redhat.com>
---
drivers/scsi/scsi_lib.c | 4 ++--
drivers/scsi/scsi_priv.h | 1 +
drivers/scsi/scsi_scan.c | 3 +--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 6585049..97699a5 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2198,13 +2198,13 @@ static void scsi_evt_emit(struct scsi_device *sdev, struct scsi_event *evt)
}
/**
- * sdev_evt_thread - send a uevent for each scsi event
+ * scsi_evt_work - send a uevent for each scsi event
* @work: work struct for scsi_device
*
* Dispatch queued events to their associated scsi_device kobjects
* as uevents.
*/
-void scsi_evt_thread(struct work_struct *work)
+void scsi_evt_work(struct work_struct *work)
{
struct scsi_device *sdev;
LIST_HEAD(event_list);
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
index 07ce3f5..ed80f21 100644
--- a/drivers/scsi/scsi_priv.h
+++ b/drivers/scsi/scsi_priv.h
@@ -90,6 +90,7 @@ extern void scsi_exit_queue(void);
struct request_queue;
struct request;
extern struct kmem_cache *scsi_sdb_cache;
+extern void scsi_evt_work(struct work_struct *work);
/* scsi_proc.c */
#ifdef CONFIG_SCSI_PROC_FS
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 2e5fe58..0adfecb 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -244,7 +244,6 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
struct scsi_device *sdev;
int display_failure_msg = 1, ret;
struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
- extern void scsi_evt_thread(struct work_struct *work);
extern void scsi_requeue_run_queue(struct work_struct *work);
sdev = kzalloc(sizeof(*sdev) + shost->transportt->device_size,
@@ -267,7 +266,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
INIT_LIST_HEAD(&sdev->starved_entry);
INIT_LIST_HEAD(&sdev->event_list);
spin_lock_init(&sdev->list_lock);
- INIT_WORK(&sdev->event_work, scsi_evt_thread);
+ INIT_WORK(&sdev->event_work, scsi_evt_work);
INIT_WORK(&sdev->requeue_work, scsi_requeue_run_queue);
sdev->sdev_gendev.parent = get_device(&starget->dev);
--
1.7.11.7
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-08-26 15:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-26 15:03 [PATCH 0/5] Patches to clean up SCSI code Ewan D. Milne
2013-08-26 15:03 ` [PATCH 1/5] scsi: Fix incorrect function name in comment Ewan D. Milne
2013-08-26 15:03 ` [PATCH 2/5] scsi: Correct size of envp[] Ewan D. Milne
2013-08-26 15:03 ` [PATCH 3/5] scsi: Add missing newline to scsi_sysfs.c Ewan D. Milne
2013-08-26 15:03 ` [PATCH 4/5] scsi: Change to use list_for_each_entry_safe Ewan D. Milne
2013-08-26 15:03 ` [PATCH 5/5] scsi: Rename scsi_evt_thread() to scsi_evt_work() Ewan D. Milne
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox