aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_sysfs.c
diff options
context:
space:
mode:
authorTony Jones <tonyj@suse.de>2008-02-21 18:13:36 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-19 22:10:33 -0400
commitee959b00c335d7780136c5abda37809191fe52c3 (patch)
tree7775f3b274fd8caf5e7e5154fea89e96f2babd94 /drivers/scsi/scsi_sysfs.c
parent56d110e852b0b1c85ad6c9bfe1cb4473ceb16402 (diff)
SCSI: convert struct class_device to struct device
It's big, but there doesn't seem to be a way to split it up smaller... Signed-off-by: Tony Jones <tonyj@suse.de> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Cc: Roland Dreier <rolandd@cisco.com> Cc: Sean Hefty <sean.hefty@intel.com> Cc: Hal Rosenstock <hal.rosenstock@gmail.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/scsi/scsi_sysfs.c')
-rw-r--r--drivers/scsi/scsi_sysfs.c150
1 files changed, 85 insertions, 65 deletions
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index ed83cdb6e67d..67bb20ed45d2 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -119,9 +119,10 @@ static int scsi_scan(struct Scsi_Host *shost, const char *str)
119 */ 119 */
120#define shost_show_function(name, field, format_string) \ 120#define shost_show_function(name, field, format_string) \
121static ssize_t \ 121static ssize_t \
122show_##name (struct class_device *class_dev, char *buf) \ 122show_##name (struct device *dev, struct device_attribute *attr, \
123 char *buf) \
123{ \ 124{ \
124 struct Scsi_Host *shost = class_to_shost(class_dev); \ 125 struct Scsi_Host *shost = class_to_shost(dev); \
125 return snprintf (buf, 20, format_string, shost->field); \ 126 return snprintf (buf, 20, format_string, shost->field); \
126} 127}
127 128
@@ -131,7 +132,7 @@ show_##name (struct class_device *class_dev, char *buf) \
131 */ 132 */
132#define shost_rd_attr2(name, field, format_string) \ 133#define shost_rd_attr2(name, field, format_string) \
133 shost_show_function(name, field, format_string) \ 134 shost_show_function(name, field, format_string) \
134static CLASS_DEVICE_ATTR(name, S_IRUGO, show_##name, NULL); 135static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL);
135 136
136#define shost_rd_attr(field, format_string) \ 137#define shost_rd_attr(field, format_string) \
137shost_rd_attr2(field, field, format_string) 138shost_rd_attr2(field, field, format_string)
@@ -140,10 +141,11 @@ shost_rd_attr2(field, field, format_string)
140 * Create the actual show/store functions and data structures. 141 * Create the actual show/store functions and data structures.
141 */ 142 */
142 143
143static ssize_t store_scan(struct class_device *class_dev, const char *buf, 144static ssize_t
144 size_t count) 145store_scan(struct device *dev, struct device_attribute *attr,
146 const char *buf, size_t count)
145{ 147{
146 struct Scsi_Host *shost = class_to_shost(class_dev); 148 struct Scsi_Host *shost = class_to_shost(dev);
147 int res; 149 int res;
148 150
149 res = scsi_scan(shost, buf); 151 res = scsi_scan(shost, buf);
@@ -151,13 +153,14 @@ static ssize_t store_scan(struct class_device *class_dev, const char *buf,
151 res = count; 153 res = count;
152 return res; 154 return res;
153}; 155};
154static CLASS_DEVICE_ATTR(scan, S_IWUSR, NULL, store_scan); 156static DEVICE_ATTR(scan, S_IWUSR, NULL, store_scan);
155 157
156static ssize_t 158static ssize_t
157store_shost_state(struct class_device *class_dev, const char *buf, size_t count) 159store_shost_state(struct device *dev, struct device_attribute *attr,
160 const char *buf, size_t count)
158{ 161{
159 int i; 162 int i;
160 struct Scsi_Host *shost = class_to_shost(class_dev); 163 struct Scsi_Host *shost = class_to_shost(dev);
161 enum scsi_host_state state = 0; 164 enum scsi_host_state state = 0;
162 165
163 for (i = 0; i < ARRAY_SIZE(shost_states); i++) { 166 for (i = 0; i < ARRAY_SIZE(shost_states); i++) {
@@ -177,9 +180,9 @@ store_shost_state(struct class_device *class_dev, const char *buf, size_t count)
177} 180}
178 181
179static ssize_t 182static ssize_t
180show_shost_state(struct class_device *class_dev, char *buf) 183show_shost_state(struct device *dev, struct device_attribute *attr, char *buf)
181{ 184{
182 struct Scsi_Host *shost = class_to_shost(class_dev); 185 struct Scsi_Host *shost = class_to_shost(dev);
183 const char *name = scsi_host_state_name(shost->shost_state); 186 const char *name = scsi_host_state_name(shost->shost_state);
184 187
185 if (!name) 188 if (!name)
@@ -188,7 +191,9 @@ show_shost_state(struct class_device *class_dev, char *buf)
188 return snprintf(buf, 20, "%s\n", name); 191 return snprintf(buf, 20, "%s\n", name);
189} 192}
190 193
191static CLASS_DEVICE_ATTR(state, S_IRUGO | S_IWUSR, show_shost_state, store_shost_state); 194/* DEVICE_ATTR(state) clashes with dev_attr_state for sdev */
195struct device_attribute dev_attr_hstate =
196 __ATTR(state, S_IRUGO | S_IWUSR, show_shost_state, store_shost_state);
192 197
193static ssize_t 198static ssize_t
194show_shost_mode(unsigned int mode, char *buf) 199show_shost_mode(unsigned int mode, char *buf)
@@ -206,9 +211,11 @@ show_shost_mode(unsigned int mode, char *buf)
206 return len; 211 return len;
207} 212}
208 213
209static ssize_t show_shost_supported_mode(struct class_device *class_dev, char *buf) 214static ssize_t
215show_shost_supported_mode(struct device *dev, struct device_attribute *attr,
216 char *buf)
210{ 217{
211 struct Scsi_Host *shost = class_to_shost(class_dev); 218 struct Scsi_Host *shost = class_to_shost(dev);
212 unsigned int supported_mode = shost->hostt->supported_mode; 219 unsigned int supported_mode = shost->hostt->supported_mode;
213 220
214 if (supported_mode == MODE_UNKNOWN) 221 if (supported_mode == MODE_UNKNOWN)
@@ -218,11 +225,13 @@ static ssize_t show_shost_supported_mode(struct class_device *class_dev, char *b
218 return show_shost_mode(supported_mode, buf); 225 return show_shost_mode(supported_mode, buf);
219} 226}
220 227
221static CLASS_DEVICE_ATTR(supported_mode, S_IRUGO | S_IWUSR, show_shost_supported_mode, NULL); 228static DEVICE_ATTR(supported_mode, S_IRUGO | S_IWUSR, show_shost_supported_mode, NULL);
222 229
223static ssize_t show_shost_active_mode(struct class_device *class_dev, char *buf) 230static ssize_t
231show_shost_active_mode(struct device *dev,
232 struct device_attribute *attr, char *buf)
224{ 233{
225 struct Scsi_Host *shost = class_to_shost(class_dev); 234 struct Scsi_Host *shost = class_to_shost(dev);
226 235
227 if (shost->active_mode == MODE_UNKNOWN) 236 if (shost->active_mode == MODE_UNKNOWN)
228 return snprintf(buf, 20, "unknown\n"); 237 return snprintf(buf, 20, "unknown\n");
@@ -230,7 +239,7 @@ static ssize_t show_shost_active_mode(struct class_device *class_dev, char *buf)
230 return show_shost_mode(shost->active_mode, buf); 239 return show_shost_mode(shost->active_mode, buf);
231} 240}
232 241
233static CLASS_DEVICE_ATTR(active_mode, S_IRUGO | S_IWUSR, show_shost_active_mode, NULL); 242static DEVICE_ATTR(active_mode, S_IRUGO | S_IWUSR, show_shost_active_mode, NULL);
234 243
235shost_rd_attr(unique_id, "%u\n"); 244shost_rd_attr(unique_id, "%u\n");
236shost_rd_attr(host_busy, "%hu\n"); 245shost_rd_attr(host_busy, "%hu\n");
@@ -240,22 +249,22 @@ shost_rd_attr(sg_tablesize, "%hu\n");
240shost_rd_attr(unchecked_isa_dma, "%d\n"); 249shost_rd_attr(unchecked_isa_dma, "%d\n");
241shost_rd_attr2(proc_name, hostt->proc_name, "%s\n"); 250shost_rd_attr2(proc_name, hostt->proc_name, "%s\n");
242 251
243static struct class_device_attribute *scsi_sysfs_shost_attrs[] = { 252static struct device_attribute *scsi_sysfs_shost_attrs[] = {
244 &class_device_attr_unique_id, 253 &dev_attr_unique_id,
245 &class_device_attr_host_busy, 254 &dev_attr_host_busy,
246 &class_device_attr_cmd_per_lun, 255 &dev_attr_cmd_per_lun,
247 &class_device_attr_can_queue, 256 &dev_attr_can_queue,
248 &class_device_attr_sg_tablesize, 257 &dev_attr_sg_tablesize,
249 &class_device_attr_unchecked_isa_dma, 258 &dev_attr_unchecked_isa_dma,
250 &class_device_attr_proc_name, 259 &dev_attr_proc_name,
251 &class_device_attr_scan, 260 &dev_attr_scan,
252 &class_device_attr_state, 261 &dev_attr_hstate,
253 &class_device_attr_supported_mode, 262 &dev_attr_supported_mode,
254 &class_device_attr_active_mode, 263 &dev_attr_active_mode,
255 NULL 264 NULL
256}; 265};
257 266
258static void scsi_device_cls_release(struct class_device *class_dev) 267static void scsi_device_cls_release(struct device *class_dev)
259{ 268{
260 struct scsi_device *sdev; 269 struct scsi_device *sdev;
261 270
@@ -320,7 +329,7 @@ static void scsi_device_dev_release(struct device *dev)
320 329
321static struct class sdev_class = { 330static struct class sdev_class = {
322 .name = "scsi_device", 331 .name = "scsi_device",
323 .release = scsi_device_cls_release, 332 .dev_release = scsi_device_cls_release,
324}; 333};
325 334
326/* all probing is done in the individual ->probe routines */ 335/* all probing is done in the individual ->probe routines */
@@ -424,7 +433,8 @@ void scsi_sysfs_unregister(void)
424 */ 433 */
425#define sdev_show_function(field, format_string) \ 434#define sdev_show_function(field, format_string) \
426static ssize_t \ 435static ssize_t \
427sdev_show_##field (struct device *dev, struct device_attribute *attr, char *buf) \ 436sdev_show_##field (struct device *dev, struct device_attribute *attr, \
437 char *buf) \
428{ \ 438{ \
429 struct scsi_device *sdev; \ 439 struct scsi_device *sdev; \
430 sdev = to_scsi_device(dev); \ 440 sdev = to_scsi_device(dev); \
@@ -448,7 +458,8 @@ static DEVICE_ATTR(field, S_IRUGO, sdev_show_##field, NULL);
448 sdev_show_function(field, format_string) \ 458 sdev_show_function(field, format_string) \
449 \ 459 \
450static ssize_t \ 460static ssize_t \
451sdev_store_##field (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ 461sdev_store_##field (struct device *dev, struct device_attribute *attr, \
462 const char *buf, size_t count) \
452{ \ 463{ \
453 struct scsi_device *sdev; \ 464 struct scsi_device *sdev; \
454 sdev = to_scsi_device(dev); \ 465 sdev = to_scsi_device(dev); \
@@ -468,7 +479,8 @@ static DEVICE_ATTR(field, S_IRUGO | S_IWUSR, sdev_show_##field, sdev_store_##fie
468 sdev_show_function(field, "%d\n") \ 479 sdev_show_function(field, "%d\n") \
469 \ 480 \
470static ssize_t \ 481static ssize_t \
471sdev_store_##field (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ 482sdev_store_##field (struct device *dev, struct device_attribute *attr, \
483 const char *buf, size_t count) \
472{ \ 484{ \
473 int ret; \ 485 int ret; \
474 struct scsi_device *sdev; \ 486 struct scsi_device *sdev; \
@@ -519,7 +531,8 @@ sdev_show_timeout (struct device *dev, struct device_attribute *attr, char *buf)
519} 531}
520 532
521static ssize_t 533static ssize_t
522sdev_store_timeout (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 534sdev_store_timeout (struct device *dev, struct device_attribute *attr,
535 const char *buf, size_t count)
523{ 536{
524 struct scsi_device *sdev; 537 struct scsi_device *sdev;
525 int timeout; 538 int timeout;
@@ -531,7 +544,8 @@ sdev_store_timeout (struct device *dev, struct device_attribute *attr, const cha
531static DEVICE_ATTR(timeout, S_IRUGO | S_IWUSR, sdev_show_timeout, sdev_store_timeout); 544static DEVICE_ATTR(timeout, S_IRUGO | S_IWUSR, sdev_show_timeout, sdev_store_timeout);
532 545
533static ssize_t 546static ssize_t
534store_rescan_field (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 547store_rescan_field (struct device *dev, struct device_attribute *attr,
548 const char *buf, size_t count)
535{ 549{
536 scsi_rescan_device(dev); 550 scsi_rescan_device(dev);
537 return count; 551 return count;
@@ -543,8 +557,9 @@ static void sdev_store_delete_callback(struct device *dev)
543 scsi_remove_device(to_scsi_device(dev)); 557 scsi_remove_device(to_scsi_device(dev));
544} 558}
545 559
546static ssize_t sdev_store_delete(struct device *dev, struct device_attribute *attr, const char *buf, 560static ssize_t
547 size_t count) 561sdev_store_delete(struct device *dev, struct device_attribute *attr,
562 const char *buf, size_t count)
548{ 563{
549 int rc; 564 int rc;
550 565
@@ -559,7 +574,8 @@ static ssize_t sdev_store_delete(struct device *dev, struct device_attribute *at
559static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete); 574static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete);
560 575
561static ssize_t 576static ssize_t
562store_state_field(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 577store_state_field(struct device *dev, struct device_attribute *attr,
578 const char *buf, size_t count)
563{ 579{
564 int i; 580 int i;
565 struct scsi_device *sdev = to_scsi_device(dev); 581 struct scsi_device *sdev = to_scsi_device(dev);
@@ -596,7 +612,8 @@ show_state_field(struct device *dev, struct device_attribute *attr, char *buf)
596static DEVICE_ATTR(state, S_IRUGO | S_IWUSR, show_state_field, store_state_field); 612static DEVICE_ATTR(state, S_IRUGO | S_IWUSR, show_state_field, store_state_field);
597 613
598static ssize_t 614static ssize_t
599show_queue_type_field(struct device *dev, struct device_attribute *attr, char *buf) 615show_queue_type_field(struct device *dev, struct device_attribute *attr,
616 char *buf)
600{ 617{
601 struct scsi_device *sdev = to_scsi_device(dev); 618 struct scsi_device *sdev = to_scsi_device(dev);
602 const char *name = "none"; 619 const char *name = "none";
@@ -612,7 +629,7 @@ show_queue_type_field(struct device *dev, struct device_attribute *attr, char *b
612static DEVICE_ATTR(queue_type, S_IRUGO, show_queue_type_field, NULL); 629static DEVICE_ATTR(queue_type, S_IRUGO, show_queue_type_field, NULL);
613 630
614static ssize_t 631static ssize_t
615show_iostat_counterbits(struct device *dev, struct device_attribute *attr, char *buf) 632show_iostat_counterbits(struct device *dev, struct device_attribute *attr, char *buf)
616{ 633{
617 return snprintf(buf, 20, "%d\n", (int)sizeof(atomic_t) * 8); 634 return snprintf(buf, 20, "%d\n", (int)sizeof(atomic_t) * 8);
618} 635}
@@ -621,7 +638,8 @@ static DEVICE_ATTR(iocounterbits, S_IRUGO, show_iostat_counterbits, NULL);
621 638
622#define show_sdev_iostat(field) \ 639#define show_sdev_iostat(field) \
623static ssize_t \ 640static ssize_t \
624show_iostat_##field(struct device *dev, struct device_attribute *attr, char *buf) \ 641show_iostat_##field(struct device *dev, struct device_attribute *attr, \
642 char *buf) \
625{ \ 643{ \
626 struct scsi_device *sdev = to_scsi_device(dev); \ 644 struct scsi_device *sdev = to_scsi_device(dev); \
627 unsigned long long count = atomic_read(&sdev->field); \ 645 unsigned long long count = atomic_read(&sdev->field); \
@@ -645,7 +663,7 @@ static DEVICE_ATTR(modalias, S_IRUGO, sdev_show_modalias, NULL);
645#define DECLARE_EVT_SHOW(name, Cap_name) \ 663#define DECLARE_EVT_SHOW(name, Cap_name) \
646static ssize_t \ 664static ssize_t \
647sdev_show_evt_##name(struct device *dev, struct device_attribute *attr, \ 665sdev_show_evt_##name(struct device *dev, struct device_attribute *attr, \
648 char *buf) \ 666 char *buf) \
649{ \ 667{ \
650 struct scsi_device *sdev = to_scsi_device(dev); \ 668 struct scsi_device *sdev = to_scsi_device(dev); \
651 int val = test_bit(SDEV_EVT_##Cap_name, sdev->supported_events);\ 669 int val = test_bit(SDEV_EVT_##Cap_name, sdev->supported_events);\
@@ -654,7 +672,7 @@ sdev_show_evt_##name(struct device *dev, struct device_attribute *attr, \
654 672
655#define DECLARE_EVT_STORE(name, Cap_name) \ 673#define DECLARE_EVT_STORE(name, Cap_name) \
656static ssize_t \ 674static ssize_t \
657sdev_store_evt_##name(struct device *dev, struct device_attribute *attr, \ 675sdev_store_evt_##name(struct device *dev, struct device_attribute *attr,\
658 const char *buf, size_t count) \ 676 const char *buf, size_t count) \
659{ \ 677{ \
660 struct scsi_device *sdev = to_scsi_device(dev); \ 678 struct scsi_device *sdev = to_scsi_device(dev); \
@@ -707,8 +725,9 @@ static struct attribute_group *scsi_sdev_attr_groups[] = {
707 NULL 725 NULL
708}; 726};
709 727
710static ssize_t sdev_store_queue_depth_rw(struct device *dev, struct device_attribute *attr, const char *buf, 728static ssize_t
711 size_t count) 729sdev_store_queue_depth_rw(struct device *dev, struct device_attribute *attr,
730 const char *buf, size_t count)
712{ 731{
713 int depth, retval; 732 int depth, retval;
714 struct scsi_device *sdev = to_scsi_device(dev); 733 struct scsi_device *sdev = to_scsi_device(dev);
@@ -733,8 +752,9 @@ static struct device_attribute sdev_attr_queue_depth_rw =
733 __ATTR(queue_depth, S_IRUGO | S_IWUSR, sdev_show_queue_depth, 752 __ATTR(queue_depth, S_IRUGO | S_IWUSR, sdev_show_queue_depth,
734 sdev_store_queue_depth_rw); 753 sdev_store_queue_depth_rw);
735 754
736static ssize_t sdev_store_queue_type_rw(struct device *dev, struct device_attribute *attr, const char *buf, 755static ssize_t
737 size_t count) 756sdev_store_queue_type_rw(struct device *dev, struct device_attribute *attr,
757 const char *buf, size_t count)
738{ 758{
739 struct scsi_device *sdev = to_scsi_device(dev); 759 struct scsi_device *sdev = to_scsi_device(dev);
740 struct scsi_host_template *sht = sdev->host->hostt; 760 struct scsi_host_template *sht = sdev->host->hostt;
@@ -786,13 +806,13 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
786 printk(KERN_INFO "error 1\n"); 806 printk(KERN_INFO "error 1\n");
787 return error; 807 return error;
788 } 808 }
789 error = class_device_add(&sdev->sdev_classdev); 809 error = device_add(&sdev->sdev_dev);
790 if (error) { 810 if (error) {
791 printk(KERN_INFO "error 2\n"); 811 printk(KERN_INFO "error 2\n");
792 goto clean_device; 812 goto clean_device;
793 } 813 }
794 814
795 /* take a reference for the sdev_classdev; this is 815 /* take a reference for the sdev_dev; this is
796 * released by the sdev_class .release */ 816 * released by the sdev_class .release */
797 get_device(&sdev->sdev_gendev); 817 get_device(&sdev->sdev_gendev);
798 818
@@ -858,7 +878,7 @@ void __scsi_remove_device(struct scsi_device *sdev)
858 return; 878 return;
859 879
860 bsg_unregister_queue(sdev->request_queue); 880 bsg_unregister_queue(sdev->request_queue);
861 class_device_unregister(&sdev->sdev_classdev); 881 device_unregister(&sdev->sdev_dev);
862 transport_remove_device(dev); 882 transport_remove_device(dev);
863 device_del(dev); 883 device_del(dev);
864 scsi_device_set_state(sdev, SDEV_DEL); 884 scsi_device_set_state(sdev, SDEV_DEL);
@@ -952,9 +972,9 @@ int scsi_register_interface(struct class_interface *intf)
952EXPORT_SYMBOL(scsi_register_interface); 972EXPORT_SYMBOL(scsi_register_interface);
953 973
954 974
955static struct class_device_attribute *class_attr_overridden( 975static struct device_attribute *class_attr_overridden(
956 struct class_device_attribute **attrs, 976 struct device_attribute **attrs,
957 struct class_device_attribute *attr) 977 struct device_attribute *attr)
958{ 978{
959 int i; 979 int i;
960 980
@@ -966,10 +986,10 @@ static struct class_device_attribute *class_attr_overridden(
966 return NULL; 986 return NULL;
967} 987}
968 988
969static int class_attr_add(struct class_device *classdev, 989static int class_attr_add(struct device *classdev,
970 struct class_device_attribute *attr) 990 struct device_attribute *attr)
971{ 991{
972 struct class_device_attribute *base_attr; 992 struct device_attribute *base_attr;
973 993
974 /* 994 /*
975 * Spare the caller from having to copy things it's not interested in. 995 * Spare the caller from having to copy things it's not interested in.
@@ -986,7 +1006,7 @@ static int class_attr_add(struct class_device *classdev,
986 attr->store = base_attr->store; 1006 attr->store = base_attr->store;
987 } 1007 }
988 1008
989 return class_device_create_file(classdev, attr); 1009 return device_create_file(classdev, attr);
990} 1010}
991 1011
992/** 1012/**
@@ -1000,7 +1020,7 @@ int scsi_sysfs_add_host(struct Scsi_Host *shost)
1000 1020
1001 if (shost->hostt->shost_attrs) { 1021 if (shost->hostt->shost_attrs) {
1002 for (i = 0; shost->hostt->shost_attrs[i]; i++) { 1022 for (i = 0; shost->hostt->shost_attrs[i]; i++) {
1003 error = class_attr_add(&shost->shost_classdev, 1023 error = class_attr_add(&shost->shost_dev,
1004 shost->hostt->shost_attrs[i]); 1024 shost->hostt->shost_attrs[i]);
1005 if (error) 1025 if (error)
1006 return error; 1026 return error;
@@ -1010,7 +1030,7 @@ int scsi_sysfs_add_host(struct Scsi_Host *shost)
1010 for (i = 0; scsi_sysfs_shost_attrs[i]; i++) { 1030 for (i = 0; scsi_sysfs_shost_attrs[i]; i++) {
1011 if (!class_attr_overridden(shost->hostt->shost_attrs, 1031 if (!class_attr_overridden(shost->hostt->shost_attrs,
1012 scsi_sysfs_shost_attrs[i])) { 1032 scsi_sysfs_shost_attrs[i])) {
1013 error = class_device_create_file(&shost->shost_classdev, 1033 error = device_create_file(&shost->shost_dev,
1014 scsi_sysfs_shost_attrs[i]); 1034 scsi_sysfs_shost_attrs[i]);
1015 if (error) 1035 if (error)
1016 return error; 1036 return error;
@@ -1041,10 +1061,10 @@ void scsi_sysfs_device_initialize(struct scsi_device *sdev)
1041 sdev->host->host_no, sdev->channel, sdev->id, 1061 sdev->host->host_no, sdev->channel, sdev->id,
1042 sdev->lun); 1062 sdev->lun);
1043 1063
1044 class_device_initialize(&sdev->sdev_classdev); 1064 device_initialize(&sdev->sdev_dev);
1045 sdev->sdev_classdev.dev = &sdev->sdev_gendev; 1065 sdev->sdev_dev.parent = &sdev->sdev_gendev;
1046 sdev->sdev_classdev.class = &sdev_class; 1066 sdev->sdev_dev.class = &sdev_class;
1047 snprintf(sdev->sdev_classdev.class_id, BUS_ID_SIZE, 1067 snprintf(sdev->sdev_dev.bus_id, BUS_ID_SIZE,
1048 "%d:%d:%d:%d", sdev->host->host_no, 1068 "%d:%d:%d:%d", sdev->host->host_no,
1049 sdev->channel, sdev->id, sdev->lun); 1069 sdev->channel, sdev->id, sdev->lun);
1050 sdev->scsi_level = starget->scsi_level; 1070 sdev->scsi_level = starget->scsi_level;