All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] sdev_printk - scsi_device helper macro
@ 2003-10-07 20:18 Daniel Stekloff
  2003-10-09  2:03 ` Hironobu Ishii
  2004-03-31 18:35 ` James Bottomley
  0 siblings, 2 replies; 8+ messages in thread
From: Daniel Stekloff @ 2003-10-07 20:18 UTC (permalink / raw)
  To: linux-scsi


I originally posted this patch for comments:

http://marc.theaimsgroup.com/?l=linux-scsi&m=106487047707538&w=2

The sdev_printk macro is meant to provide two things for the mid-layer and 
LLDs:

1) Add consistency to printing out scsi_device information.

2) Identifying printk with a specific scsi_device.

I've updated it to the latest scsi tree and I've split it into two parts. The 
first patch adds the macro to scsi_device.h and moves setting scsi_device's 
sdev_gendev's bus_id from scsi_sysfs.c to scsi_scan.c. The second patch, 
which I'll send after this message, adds using the macro to scsi mid-layer. 

I split them up in case there might be some discussion on how I applied the 
macro, whether I've missed places or put it in places where it shouldn't be.

Please apply, or let me know if you have any objections.

Thanks,

Dan

Patch #1 Follows:
-------------------


diff -urN --exclude=SCCS scsi-misc-2.5/include/scsi/scsi_device.h 
scsi-misc-2.5-sdev/include/scsi/scsi_device.h
--- scsi-misc-2.5/include/scsi/scsi_device.h	2003-10-06 16:13:57.000000000 
-0700
+++ scsi-misc-2.5-sdev/include/scsi/scsi_device.h	2003-10-06 
20:04:19.671217176 -0700
@@ -105,6 +105,9 @@
 #define	class_to_sdev(d)	\
 	container_of(d, struct scsi_device, sdev_classdev)
 
+#define sdev_printk(level, sdev, format, arg...) \
+	printk(level "scsi <%s>: " format , (sdev)->sdev_gendev.bus_id , ## arg)
+
 extern struct scsi_device *scsi_add_device(struct Scsi_Host *,
 		uint, uint, uint);
 extern void scsi_remove_device(struct scsi_device *);
diff -urN --exclude=SCCS scsi-misc-2.5/drivers/scsi/scsi_scan.c 
scsi-misc-2.5-sdev/drivers/scsi/scsi_scan.c
--- scsi-misc-2.5/drivers/scsi/scsi_scan.c	2003-10-06 16:13:29.000000000 -0700
+++ scsi-misc-2.5-sdev/drivers/scsi/scsi_scan.c	2003-10-06 20:08:42.428272032 
-0700
@@ -258,6 +258,9 @@
 	if (!sdev->scsi_level)
 		sdev->scsi_level = SCSI_2;
 
+	sprintf(sdev->sdev_gendev.bus_id,"%d:%d:%d:%d",
+		sdev->host->host_no, sdev->channel, sdev->id, sdev->lun);
+
 	/*
 	 * Add it to the end of the shost->my_devices list.
 	 */
diff -urN --exclude=SCCS scsi-misc-2.5/drivers/scsi/scsi_sysfs.c 
scsi-misc-2.5-sdev/drivers/scsi/scsi_sysfs.c
--- scsi-misc-2.5/drivers/scsi/scsi_sysfs.c	2003-10-06 16:13:29.000000000 
-0700
+++ scsi-misc-2.5-sdev/drivers/scsi/scsi_sysfs.c	2003-10-06 20:09:14.553388272 
-0700
@@ -340,8 +340,6 @@
 
 	set_bit(SDEV_ADD, &sdev->sdev_state);
 	device_initialize(&sdev->sdev_gendev);
-	sprintf(sdev->sdev_gendev.bus_id,"%d:%d:%d:%d",
-		sdev->host->host_no, sdev->channel, sdev->id, sdev->lun);
 	sdev->sdev_gendev.parent = &sdev->host->shost_gendev;
 	sdev->sdev_gendev.bus = &scsi_bus_type;
 	sdev->sdev_gendev.release = scsi_device_dev_release;



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-04-19 18:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-07 20:18 [PATCH 1/2] sdev_printk - scsi_device helper macro Daniel Stekloff
2003-10-09  2:03 ` Hironobu Ishii
2003-10-09 17:24   ` Daniel Stekloff
2003-10-09 21:42     ` Patrick Mansfield
2004-03-31 18:35 ` James Bottomley
2004-03-31 19:23   ` Daniel Stekloff
2004-03-31 19:29     ` James Bottomley
2004-04-19 18:46   ` Daniel Stekloff

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.