summaryrefslogtreecommitdiffstats
path: root/include/scsi
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2015-08-27 08:16:59 -0400
committerJames Bottomley <JBottomley@Odin.com>2015-08-28 16:14:57 -0400
commitee14c674e8fc57251223054fb52dc0ecfe711028 (patch)
tree6f65bb8fd2380c4abed006139c8d6c820ae3d08f /include/scsi
parentd95dbff2a41e934cd8789734b34dc591e78ba11c (diff)
scsi_dh: kill struct scsi_dh_data
Add a ->handler and a ->handler_data field to struct scsi_device and kill this indirection. Also move struct scsi_device_handler to scsi_dh.h so that changes to it don't require rebuilding every SCSI LLDD. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/scsi_device.h25
-rw-r--r--include/scsi/scsi_dh.h17
2 files changed, 20 insertions, 22 deletions
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 4d501b7baa9b..fe89d7cd67b9 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -196,32 +196,13 @@ struct scsi_device {
196 struct execute_work ew; /* used to get process context on put */ 196 struct execute_work ew; /* used to get process context on put */
197 struct work_struct requeue_work; 197 struct work_struct requeue_work;
198 198
199 struct scsi_dh_data *scsi_dh_data; 199 struct scsi_device_handler *handler;
200 void *handler_data;
201
200 enum scsi_device_state sdev_state; 202 enum scsi_device_state sdev_state;
201 unsigned long sdev_data[0]; 203 unsigned long sdev_data[0];
202} __attribute__((aligned(sizeof(unsigned long)))); 204} __attribute__((aligned(sizeof(unsigned long))));
203 205
204typedef void (*activate_complete)(void *, int);
205struct scsi_device_handler {
206 /* Used by the infrastructure */
207 struct list_head list; /* list of scsi_device_handlers */
208
209 /* Filled by the hardware handler */
210 struct module *module;
211 const char *name;
212 int (*check_sense)(struct scsi_device *, struct scsi_sense_hdr *);
213 struct scsi_dh_data *(*attach)(struct scsi_device *);
214 void (*detach)(struct scsi_device *);
215 int (*activate)(struct scsi_device *, activate_complete, void *);
216 int (*prep_fn)(struct scsi_device *, struct request *);
217 int (*set_params)(struct scsi_device *, const char *);
218};
219
220struct scsi_dh_data {
221 struct scsi_device_handler *scsi_dh;
222 struct scsi_device *sdev;
223};
224
225#define to_scsi_device(d) \ 206#define to_scsi_device(d) \
226 container_of(d, struct scsi_device, sdev_gendev) 207 container_of(d, struct scsi_device, sdev_gendev)
227#define class_to_sdev(d) \ 208#define class_to_sdev(d) \
diff --git a/include/scsi/scsi_dh.h b/include/scsi/scsi_dh.h
index 3a37b4c45997..85d731746834 100644
--- a/include/scsi/scsi_dh.h
+++ b/include/scsi/scsi_dh.h
@@ -55,6 +55,23 @@ enum {
55 SCSI_DH_NOSYS, 55 SCSI_DH_NOSYS,
56 SCSI_DH_DRIVER_MAX, 56 SCSI_DH_DRIVER_MAX,
57}; 57};
58
59typedef void (*activate_complete)(void *, int);
60struct scsi_device_handler {
61 /* Used by the infrastructure */
62 struct list_head list; /* list of scsi_device_handlers */
63
64 /* Filled by the hardware handler */
65 struct module *module;
66 const char *name;
67 int (*check_sense)(struct scsi_device *, struct scsi_sense_hdr *);
68 int (*attach)(struct scsi_device *);
69 void (*detach)(struct scsi_device *);
70 int (*activate)(struct scsi_device *, activate_complete, void *);
71 int (*prep_fn)(struct scsi_device *, struct request *);
72 int (*set_params)(struct scsi_device *, const char *);
73};
74
58#ifdef CONFIG_SCSI_DH 75#ifdef CONFIG_SCSI_DH
59extern int scsi_dh_activate(struct request_queue *, activate_complete, void *); 76extern int scsi_dh_activate(struct request_queue *, activate_complete, void *);
60extern int scsi_dh_attach(struct request_queue *, const char *); 77extern int scsi_dh_attach(struct request_queue *, const char *);