@@ -1454,10 +1454,10 @@ out_unlock:
static int
sg_add_device(struct device *cl_dev, struct class_interface *cl_intf)
{
- struct scsi_device *scsidp = to_scsi_device(cl_dev->parent);
- struct gendisk *disk;
+ struct scsi_device *scsidp = transport_class_to_scsi_device(cl_dev);
+ struct gendisk *disk = NULL;
Sg_device *sdp = NULL;
- struct cdev * cdev = NULL;
+ struct cdev *cdev = NULL;
int error;
unsigned long iflags;
@@ -227,7 +227,7 @@ struct scsi_dh_data {
container_of(d, struct scsi_device, sdev_gendev)
#define class_to_sdev(d) \
container_of(d, struct scsi_device, sdev_dev)
-#define transport_class_to_sdev(class_dev) \
+#define transport_class_to_scsi_device(class_dev) \
to_scsi_device(class_dev->parent)
#define sdev_dbg(sdev, fmt, a...) \
This patch fix the macro transport_class_to_sdev to the resonable name and use the macro. Signed-off-by: vonnyfly <lifeng1519@gmail.com> --- drivers/scsi/sg.c | 6 +++--- include/scsi/scsi_device.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) -- 1.7.10.4