Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Tony Jones and committed by
Greg Kroah-Hartman
ee959b00 56d110e8

+1756 -1505
+5 -6
block/bsg.c
··· 758 758 mutex_lock(&bsg_mutex); 759 759 hlist_add_head(&bd->dev_list, bsg_dev_idx_hash(iminor(inode))); 760 760 761 - strncpy(bd->name, rq->bsg_dev.class_dev->class_id, sizeof(bd->name) - 1); 761 + strncpy(bd->name, rq->bsg_dev.class_dev->bus_id, sizeof(bd->name) - 1); 762 762 dprintk("bound to <%s>, max queue %d\n", 763 763 format_dev_t(buf, inode->i_rdev), bd->max_queue); 764 764 ··· 946 946 mutex_lock(&bsg_mutex); 947 947 idr_remove(&bsg_minor_idr, bcd->minor); 948 948 sysfs_remove_link(&q->kobj, "bsg"); 949 - class_device_unregister(bcd->class_dev); 949 + device_unregister(bcd->class_dev); 950 950 put_device(bcd->dev); 951 951 bcd->class_dev = NULL; 952 952 mutex_unlock(&bsg_mutex); ··· 959 959 struct bsg_class_device *bcd; 960 960 dev_t dev; 961 961 int ret, minor; 962 - struct class_device *class_dev = NULL; 962 + struct device *class_dev = NULL; 963 963 const char *devname; 964 964 965 965 if (name) ··· 998 998 bcd->queue = q; 999 999 bcd->dev = get_device(gdev); 1000 1000 dev = MKDEV(bsg_major, bcd->minor); 1001 - class_dev = class_device_create(bsg_class, NULL, dev, gdev, "%s", 1002 - devname); 1001 + class_dev = device_create(bsg_class, gdev, dev, "%s", devname); 1003 1002 if (IS_ERR(class_dev)) { 1004 1003 ret = PTR_ERR(class_dev); 1005 1004 goto put_dev; ··· 1015 1016 return 0; 1016 1017 1017 1018 unregister_class_dev: 1018 - class_device_unregister(class_dev); 1019 + device_unregister(class_dev); 1019 1020 put_dev: 1020 1021 put_device(gdev); 1021 1022 remove_idr:
+2 -2
drivers/ata/ahci.c
··· 273 273 static int ahci_pci_device_resume(struct pci_dev *pdev); 274 274 #endif 275 275 276 - static struct class_device_attribute *ahci_shost_attrs[] = { 277 - &class_device_attr_link_power_management_policy, 276 + static struct device_attribute *ahci_shost_attrs[] = { 277 + &dev_attr_link_power_management_policy, 278 278 NULL 279 279 }; 280 280
+8 -7
drivers/ata/libata-scsi.c
··· 131 131 return NULL; 132 132 } 133 133 134 - static ssize_t ata_scsi_lpm_put(struct class_device *class_dev, 135 - const char *buf, size_t count) 134 + static ssize_t ata_scsi_lpm_put(struct device *dev, 135 + struct device_attribute *attr, 136 + const char *buf, size_t count) 136 137 { 137 - struct Scsi_Host *shost = class_to_shost(class_dev); 138 + struct Scsi_Host *shost = class_to_shost(dev); 138 139 struct ata_port *ap = ata_shost_to_port(shost); 139 140 enum link_pm policy = 0; 140 141 int i; ··· 163 162 } 164 163 165 164 static ssize_t 166 - ata_scsi_lpm_show(struct class_device *class_dev, char *buf) 165 + ata_scsi_lpm_show(struct device *dev, struct device_attribute *attr, char *buf) 167 166 { 168 - struct Scsi_Host *shost = class_to_shost(class_dev); 167 + struct Scsi_Host *shost = class_to_shost(dev); 169 168 struct ata_port *ap = ata_shost_to_port(shost); 170 169 const char *policy = 171 170 ata_scsi_lpm_get(ap->pm_policy); ··· 175 174 176 175 return snprintf(buf, 23, "%s\n", policy); 177 176 } 178 - CLASS_DEVICE_ATTR(link_power_management_policy, S_IRUGO | S_IWUSR, 177 + DEVICE_ATTR(link_power_management_policy, S_IRUGO | S_IWUSR, 179 178 ata_scsi_lpm_show, ata_scsi_lpm_put); 180 - EXPORT_SYMBOL_GPL(class_device_attr_link_power_management_policy); 179 + EXPORT_SYMBOL_GPL(dev_attr_link_power_management_policy); 181 180 182 181 static void ata_scsi_invalid_field(struct scsi_cmnd *cmd, 183 182 void (*done)(struct scsi_cmnd *))
+38 -39
drivers/base/attribute_container.c
··· 27 27 struct internal_container { 28 28 struct klist_node node; 29 29 struct attribute_container *cont; 30 - struct class_device classdev; 30 + struct device classdev; 31 31 }; 32 32 33 33 static void internal_container_klist_get(struct klist_node *n) 34 34 { 35 35 struct internal_container *ic = 36 36 container_of(n, struct internal_container, node); 37 - class_device_get(&ic->classdev); 37 + get_device(&ic->classdev); 38 38 } 39 39 40 40 static void internal_container_klist_put(struct klist_node *n) 41 41 { 42 42 struct internal_container *ic = 43 43 container_of(n, struct internal_container, node); 44 - class_device_put(&ic->classdev); 44 + put_device(&ic->classdev); 45 45 } 46 46 47 47 ··· 53 53 * Returns the container associated with this classdev. 54 54 */ 55 55 struct attribute_container * 56 - attribute_container_classdev_to_container(struct class_device *classdev) 56 + attribute_container_classdev_to_container(struct device *classdev) 57 57 { 58 58 struct internal_container *ic = 59 59 container_of(classdev, struct internal_container, classdev); ··· 110 110 EXPORT_SYMBOL_GPL(attribute_container_unregister); 111 111 112 112 /* private function used as class release */ 113 - static void attribute_container_release(struct class_device *classdev) 113 + static void attribute_container_release(struct device *classdev) 114 114 { 115 115 struct internal_container *ic 116 116 = container_of(classdev, struct internal_container, classdev); 117 - struct device *dev = classdev->dev; 117 + struct device *dev = classdev->parent; 118 118 119 119 kfree(ic); 120 120 put_device(dev); ··· 129 129 * This function allocates storage for the class device(s) to be 130 130 * attached to dev (one for each matching attribute_container). If no 131 131 * fn is provided, the code will simply register the class device via 132 - * class_device_add. If a function is provided, it is expected to add 132 + * device_add. If a function is provided, it is expected to add 133 133 * the class device at the appropriate time. One of the things that 134 134 * might be necessary is to allocate and initialise the classdev and 135 135 * then add it a later time. To do this, call this routine for 136 136 * allocation and initialisation and then use 137 - * attribute_container_device_trigger() to call class_device_add() on 137 + * attribute_container_device_trigger() to call device_add() on 138 138 * it. Note: after this, the class device contains a reference to dev 139 139 * which is not relinquished until the release of the classdev. 140 140 */ ··· 142 142 attribute_container_add_device(struct device *dev, 143 143 int (*fn)(struct attribute_container *, 144 144 struct device *, 145 - struct class_device *)) 145 + struct device *)) 146 146 { 147 147 struct attribute_container *cont; 148 148 ··· 163 163 } 164 164 165 165 ic->cont = cont; 166 - class_device_initialize(&ic->classdev); 167 - ic->classdev.dev = get_device(dev); 166 + device_initialize(&ic->classdev); 167 + ic->classdev.parent = get_device(dev); 168 168 ic->classdev.class = cont->class; 169 - cont->class->release = attribute_container_release; 170 - strcpy(ic->classdev.class_id, dev->bus_id); 169 + cont->class->dev_release = attribute_container_release; 170 + strcpy(ic->classdev.bus_id, dev->bus_id); 171 171 if (fn) 172 172 fn(cont, dev, &ic->classdev); 173 173 else ··· 195 195 * @fn: A function to call to remove the device 196 196 * 197 197 * This routine triggers device removal. If fn is NULL, then it is 198 - * simply done via class_device_unregister (note that if something 198 + * simply done via device_unregister (note that if something 199 199 * still has a reference to the classdev, then the memory occupied 200 200 * will not be freed until the classdev is released). If you want a 201 201 * two phase release: remove from visibility and then delete the 202 202 * device, then you should use this routine with a fn that calls 203 - * class_device_del() and then use 204 - * attribute_container_device_trigger() to do the final put on the 205 - * classdev. 203 + * device_del() and then use attribute_container_device_trigger() 204 + * to do the final put on the classdev. 206 205 */ 207 206 void 208 207 attribute_container_remove_device(struct device *dev, 209 208 void (*fn)(struct attribute_container *, 210 209 struct device *, 211 - struct class_device *)) 210 + struct device *)) 212 211 { 213 212 struct attribute_container *cont; 214 213 ··· 223 224 continue; 224 225 225 226 klist_for_each_entry(ic, &cont->containers, node, &iter) { 226 - if (dev != ic->classdev.dev) 227 + if (dev != ic->classdev.parent) 227 228 continue; 228 229 klist_del(&ic->node); 229 230 if (fn) 230 231 fn(cont, dev, &ic->classdev); 231 232 else { 232 233 attribute_container_remove_attrs(&ic->classdev); 233 - class_device_unregister(&ic->classdev); 234 + device_unregister(&ic->classdev); 234 235 } 235 236 } 236 237 } ··· 251 252 attribute_container_device_trigger(struct device *dev, 252 253 int (*fn)(struct attribute_container *, 253 254 struct device *, 254 - struct class_device *)) 255 + struct device *)) 255 256 { 256 257 struct attribute_container *cont; 257 258 ··· 269 270 } 270 271 271 272 klist_for_each_entry(ic, &cont->containers, node, &iter) { 272 - if (dev == ic->classdev.dev) 273 + if (dev == ic->classdev.parent) 273 274 fn(cont, dev, &ic->classdev); 274 275 } 275 276 } ··· 312 313 * attributes listed in the container 313 314 */ 314 315 int 315 - attribute_container_add_attrs(struct class_device *classdev) 316 + attribute_container_add_attrs(struct device *classdev) 316 317 { 317 318 struct attribute_container *cont = 318 319 attribute_container_classdev_to_container(classdev); 319 - struct class_device_attribute **attrs = cont->attrs; 320 + struct device_attribute **attrs = cont->attrs; 320 321 int i, error; 321 322 322 323 BUG_ON(attrs && cont->grp); ··· 328 329 return sysfs_create_group(&classdev->kobj, cont->grp); 329 330 330 331 for (i = 0; attrs[i]; i++) { 331 - error = class_device_create_file(classdev, attrs[i]); 332 + error = device_create_file(classdev, attrs[i]); 332 333 if (error) 333 334 return error; 334 335 } ··· 337 338 } 338 339 339 340 /** 340 - * attribute_container_add_class_device - same function as class_device_add 341 + * attribute_container_add_class_device - same function as device_add 341 342 * 342 343 * @classdev: the class device to add 343 344 * 344 - * This performs essentially the same function as class_device_add except for 345 + * This performs essentially the same function as device_add except for 345 346 * attribute containers, namely add the classdev to the system and then 346 347 * create the attribute files 347 348 */ 348 349 int 349 - attribute_container_add_class_device(struct class_device *classdev) 350 + attribute_container_add_class_device(struct device *classdev) 350 351 { 351 - int error = class_device_add(classdev); 352 + int error = device_add(classdev); 352 353 if (error) 353 354 return error; 354 355 return attribute_container_add_attrs(classdev); ··· 363 364 int 364 365 attribute_container_add_class_device_adapter(struct attribute_container *cont, 365 366 struct device *dev, 366 - struct class_device *classdev) 367 + struct device *classdev) 367 368 { 368 369 return attribute_container_add_class_device(classdev); 369 370 } ··· 375 376 * 376 377 */ 377 378 void 378 - attribute_container_remove_attrs(struct class_device *classdev) 379 + attribute_container_remove_attrs(struct device *classdev) 379 380 { 380 381 struct attribute_container *cont = 381 382 attribute_container_classdev_to_container(classdev); 382 - struct class_device_attribute **attrs = cont->attrs; 383 + struct device_attribute **attrs = cont->attrs; 383 384 int i; 384 385 385 386 if (!attrs && !cont->grp) ··· 391 392 } 392 393 393 394 for (i = 0; attrs[i]; i++) 394 - class_device_remove_file(classdev, attrs[i]); 395 + device_remove_file(classdev, attrs[i]); 395 396 } 396 397 397 398 /** ··· 400 401 * @classdev: the class device 401 402 * 402 403 * This function simply removes all the attribute files and then calls 403 - * class_device_del. 404 + * device_del. 404 405 */ 405 406 void 406 - attribute_container_class_device_del(struct class_device *classdev) 407 + attribute_container_class_device_del(struct device *classdev) 407 408 { 408 409 attribute_container_remove_attrs(classdev); 409 - class_device_del(classdev); 410 + device_del(classdev); 410 411 } 411 412 412 413 /** ··· 418 419 * Looks up the device in the container's list of class devices and returns 419 420 * the corresponding class_device. 420 421 */ 421 - struct class_device * 422 + struct device * 422 423 attribute_container_find_class_device(struct attribute_container *cont, 423 424 struct device *dev) 424 425 { 425 - struct class_device *cdev = NULL; 426 + struct device *cdev = NULL; 426 427 struct internal_container *ic; 427 428 struct klist_iter iter; 428 429 429 430 klist_for_each_entry(ic, &cont->containers, node, &iter) { 430 - if (ic->classdev.dev == dev) { 431 + if (ic->classdev.parent == dev) { 431 432 cdev = &ic->classdev; 432 433 /* FIXME: must exit iterator then break */ 433 434 klist_iter_exit(&iter);
+7 -7
drivers/base/transport_class.c
··· 66 66 67 67 static int anon_transport_dummy_function(struct transport_container *tc, 68 68 struct device *dev, 69 - struct class_device *cdev) 69 + struct device *cdev) 70 70 { 71 71 /* do nothing */ 72 72 return 0; ··· 115 115 116 116 static int transport_setup_classdev(struct attribute_container *cont, 117 117 struct device *dev, 118 - struct class_device *classdev) 118 + struct device *classdev) 119 119 { 120 120 struct transport_class *tclass = class_to_transport_class(cont->class); 121 121 struct transport_container *tcont = attribute_container_to_transport_container(cont); ··· 149 149 150 150 static int transport_add_class_device(struct attribute_container *cont, 151 151 struct device *dev, 152 - struct class_device *classdev) 152 + struct device *classdev) 153 153 { 154 154 int error = attribute_container_add_class_device(classdev); 155 155 struct transport_container *tcont = ··· 181 181 182 182 static int transport_configure(struct attribute_container *cont, 183 183 struct device *dev, 184 - struct class_device *cdev) 184 + struct device *cdev) 185 185 { 186 186 struct transport_class *tclass = class_to_transport_class(cont->class); 187 187 struct transport_container *tcont = attribute_container_to_transport_container(cont); ··· 212 212 213 213 static int transport_remove_classdev(struct attribute_container *cont, 214 214 struct device *dev, 215 - struct class_device *classdev) 215 + struct device *classdev) 216 216 { 217 217 struct transport_container *tcont = 218 218 attribute_container_to_transport_container(cont); ··· 251 251 252 252 static void transport_destroy_classdev(struct attribute_container *cont, 253 253 struct device *dev, 254 - struct class_device *classdev) 254 + struct device *classdev) 255 255 { 256 256 struct transport_class *tclass = class_to_transport_class(cont->class); 257 257 258 258 if (tclass->remove != anon_transport_dummy_function) 259 - class_device_put(classdev); 259 + put_device(classdev); 260 260 } 261 261 262 262
+70 -60
drivers/infiniband/ulp/srp/ib_srp.c
··· 1458 1458 return ret; 1459 1459 } 1460 1460 1461 - static ssize_t show_id_ext(struct class_device *cdev, char *buf) 1461 + static ssize_t show_id_ext(struct device *dev, struct device_attribute *attr, 1462 + char *buf) 1462 1463 { 1463 - struct srp_target_port *target = host_to_target(class_to_shost(cdev)); 1464 + struct srp_target_port *target = host_to_target(class_to_shost(dev)); 1464 1465 1465 1466 if (target->state == SRP_TARGET_DEAD || 1466 1467 target->state == SRP_TARGET_REMOVED) ··· 1471 1470 (unsigned long long) be64_to_cpu(target->id_ext)); 1472 1471 } 1473 1472 1474 - static ssize_t show_ioc_guid(struct class_device *cdev, char *buf) 1473 + static ssize_t show_ioc_guid(struct device *dev, struct device_attribute *attr, 1474 + char *buf) 1475 1475 { 1476 - struct srp_target_port *target = host_to_target(class_to_shost(cdev)); 1476 + struct srp_target_port *target = host_to_target(class_to_shost(dev)); 1477 1477 1478 1478 if (target->state == SRP_TARGET_DEAD || 1479 1479 target->state == SRP_TARGET_REMOVED) ··· 1484 1482 (unsigned long long) be64_to_cpu(target->ioc_guid)); 1485 1483 } 1486 1484 1487 - static ssize_t show_service_id(struct class_device *cdev, char *buf) 1485 + static ssize_t show_service_id(struct device *dev, 1486 + struct device_attribute *attr, char *buf) 1488 1487 { 1489 - struct srp_target_port *target = host_to_target(class_to_shost(cdev)); 1488 + struct srp_target_port *target = host_to_target(class_to_shost(dev)); 1490 1489 1491 1490 if (target->state == SRP_TARGET_DEAD || 1492 1491 target->state == SRP_TARGET_REMOVED) ··· 1497 1494 (unsigned long long) be64_to_cpu(target->service_id)); 1498 1495 } 1499 1496 1500 - static ssize_t show_pkey(struct class_device *cdev, char *buf) 1497 + static ssize_t show_pkey(struct device *dev, struct device_attribute *attr, 1498 + char *buf) 1501 1499 { 1502 - struct srp_target_port *target = host_to_target(class_to_shost(cdev)); 1500 + struct srp_target_port *target = host_to_target(class_to_shost(dev)); 1503 1501 1504 1502 if (target->state == SRP_TARGET_DEAD || 1505 1503 target->state == SRP_TARGET_REMOVED) ··· 1509 1505 return sprintf(buf, "0x%04x\n", be16_to_cpu(target->path.pkey)); 1510 1506 } 1511 1507 1512 - static ssize_t show_dgid(struct class_device *cdev, char *buf) 1508 + static ssize_t show_dgid(struct device *dev, struct device_attribute *attr, 1509 + char *buf) 1513 1510 { 1514 - struct srp_target_port *target = host_to_target(class_to_shost(cdev)); 1511 + struct srp_target_port *target = host_to_target(class_to_shost(dev)); 1515 1512 1516 1513 if (target->state == SRP_TARGET_DEAD || 1517 1514 target->state == SRP_TARGET_REMOVED) ··· 1529 1524 be16_to_cpu(((__be16 *) target->path.dgid.raw)[7])); 1530 1525 } 1531 1526 1532 - static ssize_t show_orig_dgid(struct class_device *cdev, char *buf) 1527 + static ssize_t show_orig_dgid(struct device *dev, 1528 + struct device_attribute *attr, char *buf) 1533 1529 { 1534 - struct srp_target_port *target = host_to_target(class_to_shost(cdev)); 1530 + struct srp_target_port *target = host_to_target(class_to_shost(dev)); 1535 1531 1536 1532 if (target->state == SRP_TARGET_DEAD || 1537 1533 target->state == SRP_TARGET_REMOVED) ··· 1549 1543 be16_to_cpu(target->orig_dgid[7])); 1550 1544 } 1551 1545 1552 - static ssize_t show_zero_req_lim(struct class_device *cdev, char *buf) 1546 + static ssize_t show_zero_req_lim(struct device *dev, 1547 + struct device_attribute *attr, char *buf) 1553 1548 { 1554 - struct srp_target_port *target = host_to_target(class_to_shost(cdev)); 1549 + struct srp_target_port *target = host_to_target(class_to_shost(dev)); 1555 1550 1556 1551 if (target->state == SRP_TARGET_DEAD || 1557 1552 target->state == SRP_TARGET_REMOVED) ··· 1561 1554 return sprintf(buf, "%d\n", target->zero_req_lim); 1562 1555 } 1563 1556 1564 - static ssize_t show_local_ib_port(struct class_device *cdev, char *buf) 1557 + static ssize_t show_local_ib_port(struct device *dev, 1558 + struct device_attribute *attr, char *buf) 1565 1559 { 1566 - struct srp_target_port *target = host_to_target(class_to_shost(cdev)); 1560 + struct srp_target_port *target = host_to_target(class_to_shost(dev)); 1567 1561 1568 1562 return sprintf(buf, "%d\n", target->srp_host->port); 1569 1563 } 1570 1564 1571 - static ssize_t show_local_ib_device(struct class_device *cdev, char *buf) 1565 + static ssize_t show_local_ib_device(struct device *dev, 1566 + struct device_attribute *attr, char *buf) 1572 1567 { 1573 - struct srp_target_port *target = host_to_target(class_to_shost(cdev)); 1568 + struct srp_target_port *target = host_to_target(class_to_shost(dev)); 1574 1569 1575 1570 return sprintf(buf, "%s\n", target->srp_host->srp_dev->dev->name); 1576 1571 } 1577 1572 1578 - static CLASS_DEVICE_ATTR(id_ext, S_IRUGO, show_id_ext, NULL); 1579 - static CLASS_DEVICE_ATTR(ioc_guid, S_IRUGO, show_ioc_guid, NULL); 1580 - static CLASS_DEVICE_ATTR(service_id, S_IRUGO, show_service_id, NULL); 1581 - static CLASS_DEVICE_ATTR(pkey, S_IRUGO, show_pkey, NULL); 1582 - static CLASS_DEVICE_ATTR(dgid, S_IRUGO, show_dgid, NULL); 1583 - static CLASS_DEVICE_ATTR(orig_dgid, S_IRUGO, show_orig_dgid, NULL); 1584 - static CLASS_DEVICE_ATTR(zero_req_lim, S_IRUGO, show_zero_req_lim, NULL); 1585 - static CLASS_DEVICE_ATTR(local_ib_port, S_IRUGO, show_local_ib_port, NULL); 1586 - static CLASS_DEVICE_ATTR(local_ib_device, S_IRUGO, show_local_ib_device, NULL); 1573 + static DEVICE_ATTR(id_ext, S_IRUGO, show_id_ext, NULL); 1574 + static DEVICE_ATTR(ioc_guid, S_IRUGO, show_ioc_guid, NULL); 1575 + static DEVICE_ATTR(service_id, S_IRUGO, show_service_id, NULL); 1576 + static DEVICE_ATTR(pkey, S_IRUGO, show_pkey, NULL); 1577 + static DEVICE_ATTR(dgid, S_IRUGO, show_dgid, NULL); 1578 + static DEVICE_ATTR(orig_dgid, S_IRUGO, show_orig_dgid, NULL); 1579 + static DEVICE_ATTR(zero_req_lim, S_IRUGO, show_zero_req_lim, NULL); 1580 + static DEVICE_ATTR(local_ib_port, S_IRUGO, show_local_ib_port, NULL); 1581 + static DEVICE_ATTR(local_ib_device, S_IRUGO, show_local_ib_device, NULL); 1587 1582 1588 - static struct class_device_attribute *srp_host_attrs[] = { 1589 - &class_device_attr_id_ext, 1590 - &class_device_attr_ioc_guid, 1591 - &class_device_attr_service_id, 1592 - &class_device_attr_pkey, 1593 - &class_device_attr_dgid, 1594 - &class_device_attr_orig_dgid, 1595 - &class_device_attr_zero_req_lim, 1596 - &class_device_attr_local_ib_port, 1597 - &class_device_attr_local_ib_device, 1583 + static struct device_attribute *srp_host_attrs[] = { 1584 + &dev_attr_id_ext, 1585 + &dev_attr_ioc_guid, 1586 + &dev_attr_service_id, 1587 + &dev_attr_pkey, 1588 + &dev_attr_dgid, 1589 + &dev_attr_orig_dgid, 1590 + &dev_attr_zero_req_lim, 1591 + &dev_attr_local_ib_port, 1592 + &dev_attr_local_ib_device, 1598 1593 NULL 1599 1594 }; 1600 1595 ··· 1648 1639 return 0; 1649 1640 } 1650 1641 1651 - static void srp_release_class_dev(struct class_device *class_dev) 1642 + static void srp_release_dev(struct device *dev) 1652 1643 { 1653 1644 struct srp_host *host = 1654 - container_of(class_dev, struct srp_host, class_dev); 1645 + container_of(dev, struct srp_host, dev); 1655 1646 1656 1647 complete(&host->released); 1657 1648 } 1658 1649 1659 1650 static struct class srp_class = { 1660 1651 .name = "infiniband_srp", 1661 - .release = srp_release_class_dev 1652 + .dev_release = srp_release_dev 1662 1653 }; 1663 1654 1664 1655 /* ··· 1846 1837 return ret; 1847 1838 } 1848 1839 1849 - static ssize_t srp_create_target(struct class_device *class_dev, 1840 + static ssize_t srp_create_target(struct device *dev, 1841 + struct device_attribute *attr, 1850 1842 const char *buf, size_t count) 1851 1843 { 1852 1844 struct srp_host *host = 1853 - container_of(class_dev, struct srp_host, class_dev); 1845 + container_of(dev, struct srp_host, dev); 1854 1846 struct Scsi_Host *target_host; 1855 1847 struct srp_target_port *target; 1856 1848 int ret; ··· 1939 1929 return ret; 1940 1930 } 1941 1931 1942 - static CLASS_DEVICE_ATTR(add_target, S_IWUSR, NULL, srp_create_target); 1932 + static DEVICE_ATTR(add_target, S_IWUSR, NULL, srp_create_target); 1943 1933 1944 - static ssize_t show_ibdev(struct class_device *class_dev, char *buf) 1934 + static ssize_t show_ibdev(struct device *dev, struct device_attribute *attr, 1935 + char *buf) 1945 1936 { 1946 - struct srp_host *host = 1947 - container_of(class_dev, struct srp_host, class_dev); 1937 + struct srp_host *host = container_of(dev, struct srp_host, dev); 1948 1938 1949 1939 return sprintf(buf, "%s\n", host->srp_dev->dev->name); 1950 1940 } 1951 1941 1952 - static CLASS_DEVICE_ATTR(ibdev, S_IRUGO, show_ibdev, NULL); 1942 + static DEVICE_ATTR(ibdev, S_IRUGO, show_ibdev, NULL); 1953 1943 1954 - static ssize_t show_port(struct class_device *class_dev, char *buf) 1944 + static ssize_t show_port(struct device *dev, struct device_attribute *attr, 1945 + char *buf) 1955 1946 { 1956 - struct srp_host *host = 1957 - container_of(class_dev, struct srp_host, class_dev); 1947 + struct srp_host *host = container_of(dev, struct srp_host, dev); 1958 1948 1959 1949 return sprintf(buf, "%d\n", host->port); 1960 1950 } 1961 1951 1962 - static CLASS_DEVICE_ATTR(port, S_IRUGO, show_port, NULL); 1952 + static DEVICE_ATTR(port, S_IRUGO, show_port, NULL); 1963 1953 1964 1954 static struct srp_host *srp_add_port(struct srp_device *device, u8 port) 1965 1955 { ··· 1975 1965 host->srp_dev = device; 1976 1966 host->port = port; 1977 1967 1978 - host->class_dev.class = &srp_class; 1979 - host->class_dev.dev = device->dev->dma_device; 1980 - snprintf(host->class_dev.class_id, BUS_ID_SIZE, "srp-%s-%d", 1968 + host->dev.class = &srp_class; 1969 + host->dev.parent = device->dev->dma_device; 1970 + snprintf(host->dev.bus_id, BUS_ID_SIZE, "srp-%s-%d", 1981 1971 device->dev->name, port); 1982 1972 1983 - if (class_device_register(&host->class_dev)) 1973 + if (device_register(&host->dev)) 1984 1974 goto free_host; 1985 - if (class_device_create_file(&host->class_dev, &class_device_attr_add_target)) 1975 + if (device_create_file(&host->dev, &dev_attr_add_target)) 1986 1976 goto err_class; 1987 - if (class_device_create_file(&host->class_dev, &class_device_attr_ibdev)) 1977 + if (device_create_file(&host->dev, &dev_attr_ibdev)) 1988 1978 goto err_class; 1989 - if (class_device_create_file(&host->class_dev, &class_device_attr_port)) 1979 + if (device_create_file(&host->dev, &dev_attr_port)) 1990 1980 goto err_class; 1991 1981 1992 1982 return host; 1993 1983 1994 1984 err_class: 1995 - class_device_unregister(&host->class_dev); 1985 + device_unregister(&host->dev); 1996 1986 1997 1987 free_host: 1998 1988 kfree(host); ··· 2097 2087 srp_dev = ib_get_client_data(device, &srp_client); 2098 2088 2099 2089 list_for_each_entry_safe(host, tmp_host, &srp_dev->dev_list, list) { 2100 - class_device_unregister(&host->class_dev); 2090 + device_unregister(&host->dev); 2101 2091 /* 2102 2092 * Wait for the sysfs entry to go away, so that no new 2103 2093 * target ports can be created.
+1 -1
drivers/infiniband/ulp/srp/ib_srp.h
··· 99 99 struct srp_host { 100 100 struct srp_device *srp_dev; 101 101 u8 port; 102 - struct class_device class_dev; 102 + struct device dev; 103 103 struct list_head target_list; 104 104 spinlock_t target_lock; 105 105 struct completion released;
+67 -53
drivers/message/fusion/mptscsih.c
··· 3300 3300 } 3301 3301 3302 3302 static ssize_t 3303 - mptscsih_version_fw_show(struct class_device *cdev, char *buf) 3303 + mptscsih_version_fw_show(struct device *dev, struct device_attribute *attr, 3304 + char *buf) 3304 3305 { 3305 - struct Scsi_Host *host = class_to_shost(cdev); 3306 + struct Scsi_Host *host = class_to_shost(dev); 3306 3307 MPT_SCSI_HOST *hd = shost_priv(host); 3307 3308 MPT_ADAPTER *ioc = hd->ioc; 3308 3309 ··· 3313 3312 (ioc->facts.FWVersion.Word & 0x0000FF00) >> 8, 3314 3313 ioc->facts.FWVersion.Word & 0x000000FF); 3315 3314 } 3316 - static CLASS_DEVICE_ATTR(version_fw, S_IRUGO, mptscsih_version_fw_show, NULL); 3315 + static DEVICE_ATTR(version_fw, S_IRUGO, mptscsih_version_fw_show, NULL); 3317 3316 3318 3317 static ssize_t 3319 - mptscsih_version_bios_show(struct class_device *cdev, char *buf) 3318 + mptscsih_version_bios_show(struct device *dev, struct device_attribute *attr, 3319 + char *buf) 3320 3320 { 3321 - struct Scsi_Host *host = class_to_shost(cdev); 3321 + struct Scsi_Host *host = class_to_shost(dev); 3322 3322 MPT_SCSI_HOST *hd = shost_priv(host); 3323 3323 MPT_ADAPTER *ioc = hd->ioc; 3324 3324 ··· 3329 3327 (ioc->biosVersion & 0x0000FF00) >> 8, 3330 3328 ioc->biosVersion & 0x000000FF); 3331 3329 } 3332 - static CLASS_DEVICE_ATTR(version_bios, S_IRUGO, mptscsih_version_bios_show, NULL); 3330 + static DEVICE_ATTR(version_bios, S_IRUGO, mptscsih_version_bios_show, NULL); 3333 3331 3334 3332 static ssize_t 3335 - mptscsih_version_mpi_show(struct class_device *cdev, char *buf) 3333 + mptscsih_version_mpi_show(struct device *dev, struct device_attribute *attr, 3334 + char *buf) 3336 3335 { 3337 - struct Scsi_Host *host = class_to_shost(cdev); 3336 + struct Scsi_Host *host = class_to_shost(dev); 3338 3337 MPT_SCSI_HOST *hd = shost_priv(host); 3339 3338 MPT_ADAPTER *ioc = hd->ioc; 3340 3339 3341 3340 return snprintf(buf, PAGE_SIZE, "%03x\n", ioc->facts.MsgVersion); 3342 3341 } 3343 - static CLASS_DEVICE_ATTR(version_mpi, S_IRUGO, mptscsih_version_mpi_show, NULL); 3342 + static DEVICE_ATTR(version_mpi, S_IRUGO, mptscsih_version_mpi_show, NULL); 3344 3343 3345 3344 static ssize_t 3346 - mptscsih_version_product_show(struct class_device *cdev, char *buf) 3345 + mptscsih_version_product_show(struct device *dev, 3346 + struct device_attribute *attr, 3347 + char *buf) 3347 3348 { 3348 - struct Scsi_Host *host = class_to_shost(cdev); 3349 + struct Scsi_Host *host = class_to_shost(dev); 3349 3350 MPT_SCSI_HOST *hd = shost_priv(host); 3350 3351 MPT_ADAPTER *ioc = hd->ioc; 3351 3352 3352 3353 return snprintf(buf, PAGE_SIZE, "%s\n", ioc->prod_name); 3353 3354 } 3354 - static CLASS_DEVICE_ATTR(version_product, S_IRUGO, 3355 + static DEVICE_ATTR(version_product, S_IRUGO, 3355 3356 mptscsih_version_product_show, NULL); 3356 3357 3357 3358 static ssize_t 3358 - mptscsih_version_nvdata_persistent_show(struct class_device *cdev, char *buf) 3359 + mptscsih_version_nvdata_persistent_show(struct device *dev, 3360 + struct device_attribute *attr, 3361 + char *buf) 3359 3362 { 3360 - struct Scsi_Host *host = class_to_shost(cdev); 3363 + struct Scsi_Host *host = class_to_shost(dev); 3361 3364 MPT_SCSI_HOST *hd = shost_priv(host); 3362 3365 MPT_ADAPTER *ioc = hd->ioc; 3363 3366 3364 3367 return snprintf(buf, PAGE_SIZE, "%02xh\n", 3365 3368 ioc->nvdata_version_persistent); 3366 3369 } 3367 - static CLASS_DEVICE_ATTR(version_nvdata_persistent, S_IRUGO, 3370 + static DEVICE_ATTR(version_nvdata_persistent, S_IRUGO, 3368 3371 mptscsih_version_nvdata_persistent_show, NULL); 3369 3372 3370 3373 static ssize_t 3371 - mptscsih_version_nvdata_default_show(struct class_device *cdev, char *buf) 3374 + mptscsih_version_nvdata_default_show(struct device *dev, 3375 + struct device_attribute *attr, char *buf) 3372 3376 { 3373 - struct Scsi_Host *host = class_to_shost(cdev); 3377 + struct Scsi_Host *host = class_to_shost(dev); 3374 3378 MPT_SCSI_HOST *hd = shost_priv(host); 3375 3379 MPT_ADAPTER *ioc = hd->ioc; 3376 3380 3377 3381 return snprintf(buf, PAGE_SIZE, "%02xh\n",ioc->nvdata_version_default); 3378 3382 } 3379 - static CLASS_DEVICE_ATTR(version_nvdata_default, S_IRUGO, 3383 + static DEVICE_ATTR(version_nvdata_default, S_IRUGO, 3380 3384 mptscsih_version_nvdata_default_show, NULL); 3381 3385 3382 3386 static ssize_t 3383 - mptscsih_board_name_show(struct class_device *cdev, char *buf) 3387 + mptscsih_board_name_show(struct device *dev, struct device_attribute *attr, 3388 + char *buf) 3384 3389 { 3385 - struct Scsi_Host *host = class_to_shost(cdev); 3390 + struct Scsi_Host *host = class_to_shost(dev); 3386 3391 MPT_SCSI_HOST *hd = shost_priv(host); 3387 3392 MPT_ADAPTER *ioc = hd->ioc; 3388 3393 3389 3394 return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_name); 3390 3395 } 3391 - static CLASS_DEVICE_ATTR(board_name, S_IRUGO, mptscsih_board_name_show, NULL); 3396 + static DEVICE_ATTR(board_name, S_IRUGO, mptscsih_board_name_show, NULL); 3392 3397 3393 3398 static ssize_t 3394 - mptscsih_board_assembly_show(struct class_device *cdev, char *buf) 3399 + mptscsih_board_assembly_show(struct device *dev, 3400 + struct device_attribute *attr, char *buf) 3395 3401 { 3396 - struct Scsi_Host *host = class_to_shost(cdev); 3402 + struct Scsi_Host *host = class_to_shost(dev); 3397 3403 MPT_SCSI_HOST *hd = shost_priv(host); 3398 3404 MPT_ADAPTER *ioc = hd->ioc; 3399 3405 3400 3406 return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_assembly); 3401 3407 } 3402 - static CLASS_DEVICE_ATTR(board_assembly, S_IRUGO, 3408 + static DEVICE_ATTR(board_assembly, S_IRUGO, 3403 3409 mptscsih_board_assembly_show, NULL); 3404 3410 3405 3411 static ssize_t 3406 - mptscsih_board_tracer_show(struct class_device *cdev, char *buf) 3412 + mptscsih_board_tracer_show(struct device *dev, struct device_attribute *attr, 3413 + char *buf) 3407 3414 { 3408 - struct Scsi_Host *host = class_to_shost(cdev); 3415 + struct Scsi_Host *host = class_to_shost(dev); 3409 3416 MPT_SCSI_HOST *hd = shost_priv(host); 3410 3417 MPT_ADAPTER *ioc = hd->ioc; 3411 3418 3412 3419 return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_tracer); 3413 3420 } 3414 - static CLASS_DEVICE_ATTR(board_tracer, S_IRUGO, 3421 + static DEVICE_ATTR(board_tracer, S_IRUGO, 3415 3422 mptscsih_board_tracer_show, NULL); 3416 3423 3417 3424 static ssize_t 3418 - mptscsih_io_delay_show(struct class_device *cdev, char *buf) 3425 + mptscsih_io_delay_show(struct device *dev, struct device_attribute *attr, 3426 + char *buf) 3419 3427 { 3420 - struct Scsi_Host *host = class_to_shost(cdev); 3428 + struct Scsi_Host *host = class_to_shost(dev); 3421 3429 MPT_SCSI_HOST *hd = shost_priv(host); 3422 3430 MPT_ADAPTER *ioc = hd->ioc; 3423 3431 3424 3432 return snprintf(buf, PAGE_SIZE, "%02d\n", ioc->io_missing_delay); 3425 3433 } 3426 - static CLASS_DEVICE_ATTR(io_delay, S_IRUGO, 3434 + static DEVICE_ATTR(io_delay, S_IRUGO, 3427 3435 mptscsih_io_delay_show, NULL); 3428 3436 3429 3437 static ssize_t 3430 - mptscsih_device_delay_show(struct class_device *cdev, char *buf) 3438 + mptscsih_device_delay_show(struct device *dev, struct device_attribute *attr, 3439 + char *buf) 3431 3440 { 3432 - struct Scsi_Host *host = class_to_shost(cdev); 3441 + struct Scsi_Host *host = class_to_shost(dev); 3433 3442 MPT_SCSI_HOST *hd = shost_priv(host); 3434 3443 MPT_ADAPTER *ioc = hd->ioc; 3435 3444 3436 3445 return snprintf(buf, PAGE_SIZE, "%02d\n", ioc->device_missing_delay); 3437 3446 } 3438 - static CLASS_DEVICE_ATTR(device_delay, S_IRUGO, 3447 + static DEVICE_ATTR(device_delay, S_IRUGO, 3439 3448 mptscsih_device_delay_show, NULL); 3440 3449 3441 3450 static ssize_t 3442 - mptscsih_debug_level_show(struct class_device *cdev, char *buf) 3451 + mptscsih_debug_level_show(struct device *dev, struct device_attribute *attr, 3452 + char *buf) 3443 3453 { 3444 - struct Scsi_Host *host = class_to_shost(cdev); 3454 + struct Scsi_Host *host = class_to_shost(dev); 3445 3455 MPT_SCSI_HOST *hd = shost_priv(host); 3446 3456 MPT_ADAPTER *ioc = hd->ioc; 3447 3457 3448 3458 return snprintf(buf, PAGE_SIZE, "%08xh\n", ioc->debug_level); 3449 3459 } 3450 3460 static ssize_t 3451 - mptscsih_debug_level_store(struct class_device *cdev, const char *buf, 3452 - size_t count) 3461 + mptscsih_debug_level_store(struct device *dev, struct device_attribute *attr, 3462 + const char *buf, size_t count) 3453 3463 { 3454 - struct Scsi_Host *host = class_to_shost(cdev); 3464 + struct Scsi_Host *host = class_to_shost(dev); 3455 3465 MPT_SCSI_HOST *hd = shost_priv(host); 3456 3466 MPT_ADAPTER *ioc = hd->ioc; 3457 3467 int val = 0; ··· 3476 3462 ioc->name, ioc->debug_level); 3477 3463 return strlen(buf); 3478 3464 } 3479 - static CLASS_DEVICE_ATTR(debug_level, S_IRUGO | S_IWUSR, 3480 - mptscsih_debug_level_show, mptscsih_debug_level_store); 3465 + static DEVICE_ATTR(debug_level, S_IRUGO | S_IWUSR, 3466 + mptscsih_debug_level_show, mptscsih_debug_level_store); 3481 3467 3482 - struct class_device_attribute *mptscsih_host_attrs[] = { 3483 - &class_device_attr_version_fw, 3484 - &class_device_attr_version_bios, 3485 - &class_device_attr_version_mpi, 3486 - &class_device_attr_version_product, 3487 - &class_device_attr_version_nvdata_persistent, 3488 - &class_device_attr_version_nvdata_default, 3489 - &class_device_attr_board_name, 3490 - &class_device_attr_board_assembly, 3491 - &class_device_attr_board_tracer, 3492 - &class_device_attr_io_delay, 3493 - &class_device_attr_device_delay, 3494 - &class_device_attr_debug_level, 3468 + struct device_attribute *mptscsih_host_attrs[] = { 3469 + &dev_attr_version_fw, 3470 + &dev_attr_version_bios, 3471 + &dev_attr_version_mpi, 3472 + &dev_attr_version_product, 3473 + &dev_attr_version_nvdata_persistent, 3474 + &dev_attr_version_nvdata_default, 3475 + &dev_attr_board_name, 3476 + &dev_attr_board_assembly, 3477 + &dev_attr_board_tracer, 3478 + &dev_attr_io_delay, 3479 + &dev_attr_device_delay, 3480 + &dev_attr_debug_level, 3495 3481 NULL, 3496 3482 }; 3497 3483 EXPORT_SYMBOL(mptscsih_host_attrs);
+1 -1
drivers/message/fusion/mptscsih.h
··· 129 129 extern int mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, int ctx2abort, ulong timeout); 130 130 extern u8 mptscsih_raid_id_to_num(MPT_ADAPTER *ioc, u8 channel, u8 id); 131 131 extern int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, u8 channel, u8 id); 132 - extern struct class_device_attribute *mptscsih_host_attrs[]; 132 + extern struct device_attribute *mptscsih_host_attrs[];
+64 -54
drivers/misc/enclosure.c
··· 40 40 * Looks through the list of registered enclosures to see 41 41 * if it can find a match for a device. Returns NULL if no 42 42 * enclosure is found. Obtains a reference to the enclosure class 43 - * device which must be released with class_device_put(). 43 + * device which must be released with device_put(). 44 44 */ 45 45 struct enclosure_device *enclosure_find(struct device *dev) 46 46 { 47 - struct enclosure_device *edev = NULL; 47 + struct enclosure_device *edev; 48 48 49 49 mutex_lock(&container_list_lock); 50 50 list_for_each_entry(edev, &container_list, node) { 51 - if (edev->cdev.dev == dev) { 52 - class_device_get(&edev->cdev); 51 + if (edev->edev.parent == dev) { 52 + get_device(&edev->edev); 53 53 mutex_unlock(&container_list_lock); 54 54 return edev; 55 55 } ··· 117 117 118 118 edev->components = components; 119 119 120 - edev->cdev.class = &enclosure_class; 121 - edev->cdev.dev = get_device(dev); 120 + edev->edev.class = &enclosure_class; 121 + edev->edev.parent = get_device(dev); 122 122 edev->cb = cb; 123 - snprintf(edev->cdev.class_id, BUS_ID_SIZE, "%s", name); 124 - err = class_device_register(&edev->cdev); 123 + snprintf(edev->edev.bus_id, BUS_ID_SIZE, "%s", name); 124 + err = device_register(&edev->edev); 125 125 if (err) 126 126 goto err; 127 127 ··· 135 135 return edev; 136 136 137 137 err: 138 - put_device(edev->cdev.dev); 138 + put_device(edev->edev.parent); 139 139 kfree(edev); 140 140 return ERR_PTR(err); 141 141 } ··· 158 158 159 159 for (i = 0; i < edev->components; i++) 160 160 if (edev->component[i].number != -1) 161 - class_device_unregister(&edev->component[i].cdev); 161 + device_unregister(&edev->component[i].cdev); 162 162 163 163 /* prevent any callbacks into service user */ 164 164 edev->cb = &enclosure_null_callbacks; 165 - class_device_unregister(&edev->cdev); 165 + device_unregister(&edev->edev); 166 166 } 167 167 EXPORT_SYMBOL_GPL(enclosure_unregister); 168 168 169 - static void enclosure_release(struct class_device *cdev) 169 + static void enclosure_release(struct device *cdev) 170 170 { 171 171 struct enclosure_device *edev = to_enclosure_device(cdev); 172 172 173 - put_device(cdev->dev); 173 + put_device(cdev->parent); 174 174 kfree(edev); 175 175 } 176 176 177 - static void enclosure_component_release(struct class_device *cdev) 177 + static void enclosure_component_release(struct device *dev) 178 178 { 179 - if (cdev->dev) 180 - put_device(cdev->dev); 181 - class_device_put(cdev->parent); 179 + struct enclosure_component *cdev = to_enclosure_component(dev); 180 + 181 + put_device(cdev->dev); 182 + put_device(dev->parent); 182 183 } 183 184 184 185 /** ··· 202 201 const char *name) 203 202 { 204 203 struct enclosure_component *ecomp; 205 - struct class_device *cdev; 204 + struct device *cdev; 206 205 int err; 207 206 208 207 if (number >= edev->components) ··· 216 215 ecomp->type = type; 217 216 ecomp->number = number; 218 217 cdev = &ecomp->cdev; 219 - cdev->parent = class_device_get(&edev->cdev); 218 + cdev->parent = get_device(&edev->edev); 220 219 cdev->class = &enclosure_component_class; 221 220 if (name) 222 - snprintf(cdev->class_id, BUS_ID_SIZE, "%s", name); 221 + snprintf(cdev->bus_id, BUS_ID_SIZE, "%s", name); 223 222 else 224 - snprintf(cdev->class_id, BUS_ID_SIZE, "%u", number); 223 + snprintf(cdev->bus_id, BUS_ID_SIZE, "%u", number); 225 224 226 - err = class_device_register(cdev); 225 + err = device_register(cdev); 227 226 if (err) 228 227 ERR_PTR(err); 229 228 ··· 248 247 int enclosure_add_device(struct enclosure_device *edev, int component, 249 248 struct device *dev) 250 249 { 251 - struct class_device *cdev; 250 + struct enclosure_component *cdev; 252 251 253 252 if (!edev || component >= edev->components) 254 253 return -EINVAL; 255 254 256 - cdev = &edev->component[component].cdev; 255 + cdev = &edev->component[component]; 257 256 258 - class_device_del(cdev); 259 - if (cdev->dev) 260 - put_device(cdev->dev); 257 + device_del(&cdev->cdev); 258 + put_device(cdev->dev); 261 259 cdev->dev = get_device(dev); 262 - return class_device_add(cdev); 260 + return device_add(&cdev->cdev); 263 261 } 264 262 EXPORT_SYMBOL_GPL(enclosure_add_device); 265 263 ··· 272 272 */ 273 273 int enclosure_remove_device(struct enclosure_device *edev, int component) 274 274 { 275 - struct class_device *cdev; 275 + struct enclosure_component *cdev; 276 276 277 277 if (!edev || component >= edev->components) 278 278 return -EINVAL; 279 279 280 - cdev = &edev->component[component].cdev; 280 + cdev = &edev->component[component]; 281 281 282 - class_device_del(cdev); 283 - if (cdev->dev) 284 - put_device(cdev->dev); 282 + device_del(&cdev->cdev); 283 + put_device(cdev->dev); 285 284 cdev->dev = NULL; 286 - return class_device_add(cdev); 285 + return device_add(&cdev->cdev); 287 286 } 288 287 EXPORT_SYMBOL_GPL(enclosure_remove_device); 289 288 ··· 290 291 * sysfs pieces below 291 292 */ 292 293 293 - static ssize_t enclosure_show_components(struct class_device *cdev, char *buf) 294 + static ssize_t enclosure_show_components(struct device *cdev, 295 + struct device_attribute *attr, 296 + char *buf) 294 297 { 295 298 struct enclosure_device *edev = to_enclosure_device(cdev); 296 299 297 300 return snprintf(buf, 40, "%d\n", edev->components); 298 301 } 299 302 300 - static struct class_device_attribute enclosure_attrs[] = { 303 + static struct device_attribute enclosure_attrs[] = { 301 304 __ATTR(components, S_IRUGO, enclosure_show_components, NULL), 302 305 __ATTR_NULL 303 306 }; ··· 307 306 static struct class enclosure_class = { 308 307 .name = "enclosure", 309 308 .owner = THIS_MODULE, 310 - .release = enclosure_release, 311 - .class_dev_attrs = enclosure_attrs, 309 + .dev_release = enclosure_release, 310 + .dev_attrs = enclosure_attrs, 312 311 }; 313 312 314 313 static const char *const enclosure_status [] = { ··· 327 326 [ENCLOSURE_COMPONENT_ARRAY_DEVICE] = "array device", 328 327 }; 329 328 330 - static ssize_t get_component_fault(struct class_device *cdev, char *buf) 329 + static ssize_t get_component_fault(struct device *cdev, 330 + struct device_attribute *attr, char *buf) 331 331 { 332 332 struct enclosure_device *edev = to_enclosure_device(cdev->parent); 333 333 struct enclosure_component *ecomp = to_enclosure_component(cdev); ··· 338 336 return snprintf(buf, 40, "%d\n", ecomp->fault); 339 337 } 340 338 341 - static ssize_t set_component_fault(struct class_device *cdev, const char *buf, 342 - size_t count) 339 + static ssize_t set_component_fault(struct device *cdev, 340 + struct device_attribute *attr, 341 + const char *buf, size_t count) 343 342 { 344 343 struct enclosure_device *edev = to_enclosure_device(cdev->parent); 345 344 struct enclosure_component *ecomp = to_enclosure_component(cdev); ··· 351 348 return count; 352 349 } 353 350 354 - static ssize_t get_component_status(struct class_device *cdev, char *buf) 351 + static ssize_t get_component_status(struct device *cdev, 352 + struct device_attribute *attr,char *buf) 355 353 { 356 354 struct enclosure_device *edev = to_enclosure_device(cdev->parent); 357 355 struct enclosure_component *ecomp = to_enclosure_component(cdev); ··· 362 358 return snprintf(buf, 40, "%s\n", enclosure_status[ecomp->status]); 363 359 } 364 360 365 - static ssize_t set_component_status(struct class_device *cdev, const char *buf, 366 - size_t count) 361 + static ssize_t set_component_status(struct device *cdev, 362 + struct device_attribute *attr, 363 + const char *buf, size_t count) 367 364 { 368 365 struct enclosure_device *edev = to_enclosure_device(cdev->parent); 369 366 struct enclosure_component *ecomp = to_enclosure_component(cdev); ··· 385 380 return -EINVAL; 386 381 } 387 382 388 - static ssize_t get_component_active(struct class_device *cdev, char *buf) 383 + static ssize_t get_component_active(struct device *cdev, 384 + struct device_attribute *attr, char *buf) 389 385 { 390 386 struct enclosure_device *edev = to_enclosure_device(cdev->parent); 391 387 struct enclosure_component *ecomp = to_enclosure_component(cdev); ··· 396 390 return snprintf(buf, 40, "%d\n", ecomp->active); 397 391 } 398 392 399 - static ssize_t set_component_active(struct class_device *cdev, const char *buf, 400 - size_t count) 393 + static ssize_t set_component_active(struct device *cdev, 394 + struct device_attribute *attr, 395 + const char *buf, size_t count) 401 396 { 402 397 struct enclosure_device *edev = to_enclosure_device(cdev->parent); 403 398 struct enclosure_component *ecomp = to_enclosure_component(cdev); ··· 409 402 return count; 410 403 } 411 404 412 - static ssize_t get_component_locate(struct class_device *cdev, char *buf) 405 + static ssize_t get_component_locate(struct device *cdev, 406 + struct device_attribute *attr, char *buf) 413 407 { 414 408 struct enclosure_device *edev = to_enclosure_device(cdev->parent); 415 409 struct enclosure_component *ecomp = to_enclosure_component(cdev); ··· 420 412 return snprintf(buf, 40, "%d\n", ecomp->locate); 421 413 } 422 414 423 - static ssize_t set_component_locate(struct class_device *cdev, const char *buf, 424 - size_t count) 415 + static ssize_t set_component_locate(struct device *cdev, 416 + struct device_attribute *attr, 417 + const char *buf, size_t count) 425 418 { 426 419 struct enclosure_device *edev = to_enclosure_device(cdev->parent); 427 420 struct enclosure_component *ecomp = to_enclosure_component(cdev); ··· 433 424 return count; 434 425 } 435 426 436 - static ssize_t get_component_type(struct class_device *cdev, char *buf) 427 + static ssize_t get_component_type(struct device *cdev, 428 + struct device_attribute *attr, char *buf) 437 429 { 438 430 struct enclosure_component *ecomp = to_enclosure_component(cdev); 439 431 ··· 442 432 } 443 433 444 434 445 - static struct class_device_attribute enclosure_component_attrs[] = { 435 + static struct device_attribute enclosure_component_attrs[] = { 446 436 __ATTR(fault, S_IRUGO | S_IWUSR, get_component_fault, 447 437 set_component_fault), 448 438 __ATTR(status, S_IRUGO | S_IWUSR, get_component_status, ··· 458 448 static struct class enclosure_component_class = { 459 449 .name = "enclosure_component", 460 450 .owner = THIS_MODULE, 461 - .class_dev_attrs = enclosure_component_attrs, 462 - .release = enclosure_component_release, 451 + .dev_attrs = enclosure_component_attrs, 452 + .dev_release = enclosure_component_release, 463 453 }; 464 454 465 455 static int __init enclosure_init(void)
+5 -4
drivers/scsi/3w-9xxx.c
··· 140 140 /* Functions */ 141 141 142 142 /* Show some statistics about the card */ 143 - static ssize_t twa_show_stats(struct class_device *class_dev, char *buf) 143 + static ssize_t twa_show_stats(struct device *dev, 144 + struct device_attribute *attr, char *buf) 144 145 { 145 - struct Scsi_Host *host = class_to_shost(class_dev); 146 + struct Scsi_Host *host = class_to_shost(dev); 146 147 TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata; 147 148 unsigned long flags = 0; 148 149 ssize_t len; ··· 185 184 } /* End twa_change_queue_depth() */ 186 185 187 186 /* Create sysfs 'stats' entry */ 188 - static struct class_device_attribute twa_host_stats_attr = { 187 + static struct device_attribute twa_host_stats_attr = { 189 188 .attr = { 190 189 .name = "stats", 191 190 .mode = S_IRUGO, ··· 194 193 }; 195 194 196 195 /* Host attributes initializer */ 197 - static struct class_device_attribute *twa_host_attrs[] = { 196 + static struct device_attribute *twa_host_attrs[] = { 198 197 &twa_host_stats_attr, 199 198 NULL, 200 199 };
+5 -4
drivers/scsi/3w-xxxx.c
··· 484 484 } /* End tw_state_request_start() */ 485 485 486 486 /* Show some statistics about the card */ 487 - static ssize_t tw_show_stats(struct class_device *class_dev, char *buf) 487 + static ssize_t tw_show_stats(struct device *dev, struct device_attribute *attr, 488 + char *buf) 488 489 { 489 - struct Scsi_Host *host = class_to_shost(class_dev); 490 + struct Scsi_Host *host = class_to_shost(dev); 490 491 TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata; 491 492 unsigned long flags = 0; 492 493 ssize_t len; ··· 529 528 } /* End tw_change_queue_depth() */ 530 529 531 530 /* Create sysfs 'stats' entry */ 532 - static struct class_device_attribute tw_host_stats_attr = { 531 + static struct device_attribute tw_host_stats_attr = { 533 532 .attr = { 534 533 .name = "stats", 535 534 .mode = S_IRUGO, ··· 538 537 }; 539 538 540 539 /* Host attributes initializer */ 541 - static struct class_device_attribute *tw_host_attrs[] = { 540 + static struct device_attribute *tw_host_attrs[] = { 542 541 &tw_host_stats_attr, 543 542 NULL, 544 543 };
+1 -1
drivers/scsi/aacraid/aachba.c
··· 1316 1316 tmp>>24,(tmp>>16)&0xff,tmp&0xff, 1317 1317 le32_to_cpu(dev->adapter_info.biosbuild)); 1318 1318 buffer[0] = '\0'; 1319 - if (aac_show_serial_number( 1319 + if (aac_get_serial_number( 1320 1320 shost_to_class(dev->scsi_host_ptr), buffer)) 1321 1321 printk(KERN_INFO "%s%d: serial %s", 1322 1322 dev->name, dev->id, buffer);
+2 -2
drivers/scsi/aacraid/aacraid.h
··· 1850 1850 int aac_scsi_cmd(struct scsi_cmnd *cmd); 1851 1851 int aac_dev_ioctl(struct aac_dev *dev, int cmd, void __user *arg); 1852 1852 #ifndef shost_to_class 1853 - #define shost_to_class(shost) &shost->shost_classdev 1853 + #define shost_to_class(shost) &shost->shost_dev 1854 1854 #endif 1855 - ssize_t aac_show_serial_number(struct class_device *class_dev, char *buf); 1855 + ssize_t aac_get_serial_number(struct device *dev, char *buf); 1856 1856 int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg); 1857 1857 int aac_rx_init(struct aac_dev *dev); 1858 1858 int aac_rkt_init(struct aac_dev *dev);
+53 -40
drivers/scsi/aacraid/linit.c
··· 755 755 } 756 756 #endif 757 757 758 - static ssize_t aac_show_model(struct class_device *class_dev, 759 - char *buf) 758 + static ssize_t aac_show_model(struct device *device, 759 + struct device_attribute *attr, char *buf) 760 760 { 761 - struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; 761 + struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; 762 762 int len; 763 763 764 764 if (dev->supplement_adapter_info.AdapterTypeText[0]) { ··· 774 774 return len; 775 775 } 776 776 777 - static ssize_t aac_show_vendor(struct class_device *class_dev, 778 - char *buf) 777 + static ssize_t aac_show_vendor(struct device *device, 778 + struct device_attribute *attr, char *buf) 779 779 { 780 - struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; 780 + struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; 781 781 int len; 782 782 783 783 if (dev->supplement_adapter_info.AdapterTypeText[0]) { ··· 793 793 return len; 794 794 } 795 795 796 - static ssize_t aac_show_flags(struct class_device *class_dev, char *buf) 796 + static ssize_t aac_show_flags(struct device *cdev, 797 + struct device_attribute *attr, char *buf) 797 798 { 798 799 int len = 0; 799 - struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; 800 + struct aac_dev *dev = (struct aac_dev*)class_to_shost(cdev)->hostdata; 800 801 801 802 if (nblank(dprintk(x))) 802 803 len = snprintf(buf, PAGE_SIZE, "dprintk\n"); ··· 813 812 return len; 814 813 } 815 814 816 - static ssize_t aac_show_kernel_version(struct class_device *class_dev, 817 - char *buf) 815 + static ssize_t aac_show_kernel_version(struct device *device, 816 + struct device_attribute *attr, 817 + char *buf) 818 818 { 819 - struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; 819 + struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; 820 820 int len, tmp; 821 821 822 822 tmp = le32_to_cpu(dev->adapter_info.kernelrev); ··· 827 825 return len; 828 826 } 829 827 830 - static ssize_t aac_show_monitor_version(struct class_device *class_dev, 831 - char *buf) 828 + static ssize_t aac_show_monitor_version(struct device *device, 829 + struct device_attribute *attr, 830 + char *buf) 832 831 { 833 - struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; 832 + struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; 834 833 int len, tmp; 835 834 836 835 tmp = le32_to_cpu(dev->adapter_info.monitorrev); ··· 841 838 return len; 842 839 } 843 840 844 - static ssize_t aac_show_bios_version(struct class_device *class_dev, 845 - char *buf) 841 + static ssize_t aac_show_bios_version(struct device *device, 842 + struct device_attribute *attr, 843 + char *buf) 846 844 { 847 - struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; 845 + struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; 848 846 int len, tmp; 849 847 850 848 tmp = le32_to_cpu(dev->adapter_info.biosrev); ··· 855 851 return len; 856 852 } 857 853 858 - ssize_t aac_show_serial_number(struct class_device *class_dev, char *buf) 854 + ssize_t aac_show_serial_number(struct device *device, 855 + struct device_attribute *attr, char *buf) 859 856 { 860 - struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; 857 + struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; 861 858 int len = 0; 862 859 863 860 if (le32_to_cpu(dev->adapter_info.serial[0]) != 0xBAD0) ··· 874 869 return len; 875 870 } 876 871 877 - static ssize_t aac_show_max_channel(struct class_device *class_dev, char *buf) 872 + static ssize_t aac_show_max_channel(struct device *device, 873 + struct device_attribute *attr, char *buf) 878 874 { 879 875 return snprintf(buf, PAGE_SIZE, "%d\n", 880 - class_to_shost(class_dev)->max_channel); 876 + class_to_shost(device)->max_channel); 881 877 } 882 878 883 - static ssize_t aac_show_max_id(struct class_device *class_dev, char *buf) 879 + static ssize_t aac_show_max_id(struct device *device, 880 + struct device_attribute *attr, char *buf) 884 881 { 885 882 return snprintf(buf, PAGE_SIZE, "%d\n", 886 - class_to_shost(class_dev)->max_id); 883 + class_to_shost(device)->max_id); 887 884 } 888 885 889 - static ssize_t aac_store_reset_adapter(struct class_device *class_dev, 890 - const char *buf, size_t count) 886 + static ssize_t aac_store_reset_adapter(struct device *device, 887 + struct device_attribute *attr, 888 + const char *buf, size_t count) 891 889 { 892 890 int retval = -EACCES; 893 891 894 892 if (!capable(CAP_SYS_ADMIN)) 895 893 return retval; 896 - retval = aac_reset_adapter((struct aac_dev*)class_to_shost(class_dev)->hostdata, buf[0] == '!'); 894 + retval = aac_reset_adapter((struct aac_dev*)class_to_shost(device)->hostdata, buf[0] == '!'); 897 895 if (retval >= 0) 898 896 retval = count; 899 897 return retval; 900 898 } 901 899 902 - static ssize_t aac_show_reset_adapter(struct class_device *class_dev, 903 - char *buf) 900 + static ssize_t aac_show_reset_adapter(struct device *device, 901 + struct device_attribute *attr, 902 + char *buf) 904 903 { 905 - struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; 904 + struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; 906 905 int len, tmp; 907 906 908 907 tmp = aac_adapter_check_health(dev); ··· 916 907 return len; 917 908 } 918 909 919 - static struct class_device_attribute aac_model = { 910 + static struct device_attribute aac_model = { 920 911 .attr = { 921 912 .name = "model", 922 913 .mode = S_IRUGO, 923 914 }, 924 915 .show = aac_show_model, 925 916 }; 926 - static struct class_device_attribute aac_vendor = { 917 + static struct device_attribute aac_vendor = { 927 918 .attr = { 928 919 .name = "vendor", 929 920 .mode = S_IRUGO, 930 921 }, 931 922 .show = aac_show_vendor, 932 923 }; 933 - static struct class_device_attribute aac_flags = { 924 + static struct device_attribute aac_flags = { 934 925 .attr = { 935 926 .name = "flags", 936 927 .mode = S_IRUGO, 937 928 }, 938 929 .show = aac_show_flags, 939 930 }; 940 - static struct class_device_attribute aac_kernel_version = { 931 + static struct device_attribute aac_kernel_version = { 941 932 .attr = { 942 933 .name = "hba_kernel_version", 943 934 .mode = S_IRUGO, 944 935 }, 945 936 .show = aac_show_kernel_version, 946 937 }; 947 - static struct class_device_attribute aac_monitor_version = { 938 + static struct device_attribute aac_monitor_version = { 948 939 .attr = { 949 940 .name = "hba_monitor_version", 950 941 .mode = S_IRUGO, 951 942 }, 952 943 .show = aac_show_monitor_version, 953 944 }; 954 - static struct class_device_attribute aac_bios_version = { 945 + static struct device_attribute aac_bios_version = { 955 946 .attr = { 956 947 .name = "hba_bios_version", 957 948 .mode = S_IRUGO, 958 949 }, 959 950 .show = aac_show_bios_version, 960 951 }; 961 - static struct class_device_attribute aac_serial_number = { 952 + static struct device_attribute aac_serial_number = { 962 953 .attr = { 963 954 .name = "serial_number", 964 955 .mode = S_IRUGO, 965 956 }, 966 957 .show = aac_show_serial_number, 967 958 }; 968 - static struct class_device_attribute aac_max_channel = { 959 + static struct device_attribute aac_max_channel = { 969 960 .attr = { 970 961 .name = "max_channel", 971 962 .mode = S_IRUGO, 972 963 }, 973 964 .show = aac_show_max_channel, 974 965 }; 975 - static struct class_device_attribute aac_max_id = { 966 + static struct device_attribute aac_max_id = { 976 967 .attr = { 977 968 .name = "max_id", 978 969 .mode = S_IRUGO, 979 970 }, 980 971 .show = aac_show_max_id, 981 972 }; 982 - static struct class_device_attribute aac_reset = { 973 + static struct device_attribute aac_reset = { 983 974 .attr = { 984 975 .name = "reset_host", 985 976 .mode = S_IWUSR|S_IRUGO, ··· 988 979 .show = aac_show_reset_adapter, 989 980 }; 990 981 991 - static struct class_device_attribute *aac_attrs[] = { 982 + static struct device_attribute *aac_attrs[] = { 992 983 &aac_model, 993 984 &aac_vendor, 994 985 &aac_flags, ··· 1002 993 NULL 1003 994 }; 1004 995 996 + ssize_t aac_get_serial_number(struct device *device, char *buf) 997 + { 998 + return aac_show_serial_number(device, &aac_serial_number, buf); 999 + } 1005 1000 1006 1001 static const struct file_operations aac_cfg_fops = { 1007 1002 .owner = THIS_MODULE,
+2 -2
drivers/scsi/arcmsr/arcmsr.h
··· 44 44 */ 45 45 #include <linux/interrupt.h> 46 46 47 - struct class_device_attribute; 47 + struct device_attribute; 48 48 /*The limit of outstanding scsi command that firmware can handle*/ 49 49 #define ARCMSR_MAX_OUTSTANDING_CMD 256 50 50 #define ARCMSR_MAX_FREECCB_NUM 320 ··· 556 556 extern void arcmsr_post_ioctldata2iop(struct AdapterControlBlock *); 557 557 extern void arcmsr_iop_message_read(struct AdapterControlBlock *); 558 558 extern struct QBUFFER __iomem *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *); 559 - extern struct class_device_attribute *arcmsr_host_attrs[]; 559 + extern struct device_attribute *arcmsr_host_attrs[]; 560 560 extern int arcmsr_alloc_sysfs_attr(struct AdapterControlBlock *); 561 561 void arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb);
+95 -66
drivers/scsi/arcmsr/arcmsr_attr.c
··· 57 57 #include <scsi/scsi_transport.h> 58 58 #include "arcmsr.h" 59 59 60 - struct class_device_attribute *arcmsr_host_attrs[]; 60 + struct device_attribute *arcmsr_host_attrs[]; 61 61 62 62 static ssize_t arcmsr_sysfs_iop_message_read(struct kobject *kobj, 63 63 struct bin_attribute *bin, 64 64 char *buf, loff_t off, 65 65 size_t count) 66 66 { 67 - struct class_device *cdev = container_of(kobj,struct class_device,kobj); 68 - struct Scsi_Host *host = class_to_shost(cdev); 67 + struct device *dev = container_of(kobj,struct device,kobj); 68 + struct Scsi_Host *host = class_to_shost(dev); 69 69 struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; 70 70 uint8_t *pQbuffer,*ptmpQbuffer; 71 71 int32_t allxfer_len = 0; ··· 110 110 char *buf, loff_t off, 111 111 size_t count) 112 112 { 113 - struct class_device *cdev = container_of(kobj,struct class_device,kobj); 114 - struct Scsi_Host *host = class_to_shost(cdev); 113 + struct device *dev = container_of(kobj,struct device,kobj); 114 + struct Scsi_Host *host = class_to_shost(dev); 115 115 struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; 116 116 int32_t my_empty_len, user_len, wqbuf_firstindex, wqbuf_lastindex; 117 117 uint8_t *pQbuffer, *ptmpuserbuffer; ··· 158 158 char *buf, loff_t off, 159 159 size_t count) 160 160 { 161 - struct class_device *cdev = container_of(kobj,struct class_device,kobj); 162 - struct Scsi_Host *host = class_to_shost(cdev); 161 + struct device *dev = container_of(kobj,struct device,kobj); 162 + struct Scsi_Host *host = class_to_shost(dev); 163 163 struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; 164 164 uint8_t *pQbuffer; 165 165 ··· 220 220 struct Scsi_Host *host = acb->host; 221 221 int error; 222 222 223 - error = sysfs_create_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_read_attr); 223 + error = sysfs_create_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_read_attr); 224 224 if (error) { 225 225 printk(KERN_ERR "arcmsr: alloc sysfs mu_read failed\n"); 226 226 goto error_bin_file_message_read; 227 227 } 228 - error = sysfs_create_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_write_attr); 228 + error = sysfs_create_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_write_attr); 229 229 if (error) { 230 230 printk(KERN_ERR "arcmsr: alloc sysfs mu_write failed\n"); 231 231 goto error_bin_file_message_write; 232 232 } 233 - error = sysfs_create_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_clear_attr); 233 + error = sysfs_create_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_clear_attr); 234 234 if (error) { 235 235 printk(KERN_ERR "arcmsr: alloc sysfs mu_clear failed\n"); 236 236 goto error_bin_file_message_clear; 237 237 } 238 238 return 0; 239 239 error_bin_file_message_clear: 240 - sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_write_attr); 240 + sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_write_attr); 241 241 error_bin_file_message_write: 242 - sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_read_attr); 242 + sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_read_attr); 243 243 error_bin_file_message_read: 244 244 return error; 245 245 } 246 246 247 - void 248 - arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb) { 247 + void arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb) 248 + { 249 249 struct Scsi_Host *host = acb->host; 250 250 251 - sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_clear_attr); 252 - sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_write_attr); 253 - sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_read_attr); 251 + sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_clear_attr); 252 + sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_write_attr); 253 + sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_read_attr); 254 254 } 255 255 256 256 257 257 static ssize_t 258 - arcmsr_attr_host_driver_version(struct class_device *cdev, char *buf) { 258 + arcmsr_attr_host_driver_version(struct device *dev, 259 + struct device_attribute *attr, char *buf) 260 + { 259 261 return snprintf(buf, PAGE_SIZE, 260 262 "%s\n", 261 263 ARCMSR_DRIVER_VERSION); 262 264 } 263 265 264 266 static ssize_t 265 - arcmsr_attr_host_driver_posted_cmd(struct class_device *cdev, char *buf) { 266 - struct Scsi_Host *host = class_to_shost(cdev); 267 - struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; 267 + arcmsr_attr_host_driver_posted_cmd(struct device *dev, 268 + struct device_attribute *attr, char *buf) 269 + { 270 + struct Scsi_Host *host = class_to_shost(dev); 271 + struct AdapterControlBlock *acb = 272 + (struct AdapterControlBlock *) host->hostdata; 268 273 return snprintf(buf, PAGE_SIZE, 269 274 "%4d\n", 270 275 atomic_read(&acb->ccboutstandingcount)); 271 276 } 272 277 273 278 static ssize_t 274 - arcmsr_attr_host_driver_reset(struct class_device *cdev, char *buf) { 275 - struct Scsi_Host *host = class_to_shost(cdev); 276 - struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; 279 + arcmsr_attr_host_driver_reset(struct device *dev, 280 + struct device_attribute *attr, char *buf) 281 + { 282 + struct Scsi_Host *host = class_to_shost(dev); 283 + struct AdapterControlBlock *acb = 284 + (struct AdapterControlBlock *) host->hostdata; 277 285 return snprintf(buf, PAGE_SIZE, 278 286 "%4d\n", 279 287 acb->num_resets); 280 288 } 281 289 282 290 static ssize_t 283 - arcmsr_attr_host_driver_abort(struct class_device *cdev, char *buf) { 284 - struct Scsi_Host *host = class_to_shost(cdev); 285 - struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; 291 + arcmsr_attr_host_driver_abort(struct device *dev, 292 + struct device_attribute *attr, char *buf) 293 + { 294 + struct Scsi_Host *host = class_to_shost(dev); 295 + struct AdapterControlBlock *acb = 296 + (struct AdapterControlBlock *) host->hostdata; 286 297 return snprintf(buf, PAGE_SIZE, 287 298 "%4d\n", 288 299 acb->num_aborts); 289 300 } 290 301 291 302 static ssize_t 292 - arcmsr_attr_host_fw_model(struct class_device *cdev, char *buf) { 293 - struct Scsi_Host *host = class_to_shost(cdev); 294 - struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; 303 + arcmsr_attr_host_fw_model(struct device *dev, struct device_attribute *attr, 304 + char *buf) 305 + { 306 + struct Scsi_Host *host = class_to_shost(dev); 307 + struct AdapterControlBlock *acb = 308 + (struct AdapterControlBlock *) host->hostdata; 295 309 return snprintf(buf, PAGE_SIZE, 296 310 "%s\n", 297 311 acb->firm_model); 298 312 } 299 313 300 314 static ssize_t 301 - arcmsr_attr_host_fw_version(struct class_device *cdev, char *buf) { 302 - struct Scsi_Host *host = class_to_shost(cdev); 303 - struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; 315 + arcmsr_attr_host_fw_version(struct device *dev, 316 + struct device_attribute *attr, char *buf) 317 + { 318 + struct Scsi_Host *host = class_to_shost(dev); 319 + struct AdapterControlBlock *acb = 320 + (struct AdapterControlBlock *) host->hostdata; 304 321 305 322 return snprintf(buf, PAGE_SIZE, 306 323 "%s\n", ··· 325 308 } 326 309 327 310 static ssize_t 328 - arcmsr_attr_host_fw_request_len(struct class_device *cdev, char *buf) { 329 - struct Scsi_Host *host = class_to_shost(cdev); 330 - struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; 311 + arcmsr_attr_host_fw_request_len(struct device *dev, 312 + struct device_attribute *attr, char *buf) 313 + { 314 + struct Scsi_Host *host = class_to_shost(dev); 315 + struct AdapterControlBlock *acb = 316 + (struct AdapterControlBlock *) host->hostdata; 331 317 332 318 return snprintf(buf, PAGE_SIZE, 333 319 "%4d\n", ··· 338 318 } 339 319 340 320 static ssize_t 341 - arcmsr_attr_host_fw_numbers_queue(struct class_device *cdev, char *buf) { 342 - struct Scsi_Host *host = class_to_shost(cdev); 343 - struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; 321 + arcmsr_attr_host_fw_numbers_queue(struct device *dev, 322 + struct device_attribute *attr, char *buf) 323 + { 324 + struct Scsi_Host *host = class_to_shost(dev); 325 + struct AdapterControlBlock *acb = 326 + (struct AdapterControlBlock *) host->hostdata; 344 327 345 328 return snprintf(buf, PAGE_SIZE, 346 329 "%4d\n", ··· 351 328 } 352 329 353 330 static ssize_t 354 - arcmsr_attr_host_fw_sdram_size(struct class_device *cdev, char *buf) { 355 - struct Scsi_Host *host = class_to_shost(cdev); 356 - struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; 331 + arcmsr_attr_host_fw_sdram_size(struct device *dev, 332 + struct device_attribute *attr, char *buf) 333 + { 334 + struct Scsi_Host *host = class_to_shost(dev); 335 + struct AdapterControlBlock *acb = 336 + (struct AdapterControlBlock *) host->hostdata; 357 337 358 338 return snprintf(buf, PAGE_SIZE, 359 339 "%4d\n", ··· 364 338 } 365 339 366 340 static ssize_t 367 - arcmsr_attr_host_fw_hd_channels(struct class_device *cdev, char *buf) { 368 - struct Scsi_Host *host = class_to_shost(cdev); 369 - struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; 341 + arcmsr_attr_host_fw_hd_channels(struct device *dev, 342 + struct device_attribute *attr, char *buf) 343 + { 344 + struct Scsi_Host *host = class_to_shost(dev); 345 + struct AdapterControlBlock *acb = 346 + (struct AdapterControlBlock *) host->hostdata; 370 347 371 348 return snprintf(buf, PAGE_SIZE, 372 349 "%4d\n", 373 350 acb->firm_hd_channels); 374 351 } 375 352 376 - static CLASS_DEVICE_ATTR(host_driver_version, S_IRUGO, arcmsr_attr_host_driver_version, NULL); 377 - static CLASS_DEVICE_ATTR(host_driver_posted_cmd, S_IRUGO, arcmsr_attr_host_driver_posted_cmd, NULL); 378 - static CLASS_DEVICE_ATTR(host_driver_reset, S_IRUGO, arcmsr_attr_host_driver_reset, NULL); 379 - static CLASS_DEVICE_ATTR(host_driver_abort, S_IRUGO, arcmsr_attr_host_driver_abort, NULL); 380 - static CLASS_DEVICE_ATTR(host_fw_model, S_IRUGO, arcmsr_attr_host_fw_model, NULL); 381 - static CLASS_DEVICE_ATTR(host_fw_version, S_IRUGO, arcmsr_attr_host_fw_version, NULL); 382 - static CLASS_DEVICE_ATTR(host_fw_request_len, S_IRUGO, arcmsr_attr_host_fw_request_len, NULL); 383 - static CLASS_DEVICE_ATTR(host_fw_numbers_queue, S_IRUGO, arcmsr_attr_host_fw_numbers_queue, NULL); 384 - static CLASS_DEVICE_ATTR(host_fw_sdram_size, S_IRUGO, arcmsr_attr_host_fw_sdram_size, NULL); 385 - static CLASS_DEVICE_ATTR(host_fw_hd_channels, S_IRUGO, arcmsr_attr_host_fw_hd_channels, NULL); 353 + static DEVICE_ATTR(host_driver_version, S_IRUGO, arcmsr_attr_host_driver_version, NULL); 354 + static DEVICE_ATTR(host_driver_posted_cmd, S_IRUGO, arcmsr_attr_host_driver_posted_cmd, NULL); 355 + static DEVICE_ATTR(host_driver_reset, S_IRUGO, arcmsr_attr_host_driver_reset, NULL); 356 + static DEVICE_ATTR(host_driver_abort, S_IRUGO, arcmsr_attr_host_driver_abort, NULL); 357 + static DEVICE_ATTR(host_fw_model, S_IRUGO, arcmsr_attr_host_fw_model, NULL); 358 + static DEVICE_ATTR(host_fw_version, S_IRUGO, arcmsr_attr_host_fw_version, NULL); 359 + static DEVICE_ATTR(host_fw_request_len, S_IRUGO, arcmsr_attr_host_fw_request_len, NULL); 360 + static DEVICE_ATTR(host_fw_numbers_queue, S_IRUGO, arcmsr_attr_host_fw_numbers_queue, NULL); 361 + static DEVICE_ATTR(host_fw_sdram_size, S_IRUGO, arcmsr_attr_host_fw_sdram_size, NULL); 362 + static DEVICE_ATTR(host_fw_hd_channels, S_IRUGO, arcmsr_attr_host_fw_hd_channels, NULL); 386 363 387 - struct class_device_attribute *arcmsr_host_attrs[] = { 388 - &class_device_attr_host_driver_version, 389 - &class_device_attr_host_driver_posted_cmd, 390 - &class_device_attr_host_driver_reset, 391 - &class_device_attr_host_driver_abort, 392 - &class_device_attr_host_fw_model, 393 - &class_device_attr_host_fw_version, 394 - &class_device_attr_host_fw_request_len, 395 - &class_device_attr_host_fw_numbers_queue, 396 - &class_device_attr_host_fw_sdram_size, 397 - &class_device_attr_host_fw_hd_channels, 364 + struct device_attribute *arcmsr_host_attrs[] = { 365 + &dev_attr_host_driver_version, 366 + &dev_attr_host_driver_posted_cmd, 367 + &dev_attr_host_driver_reset, 368 + &dev_attr_host_driver_abort, 369 + &dev_attr_host_fw_model, 370 + &dev_attr_host_fw_version, 371 + &dev_attr_host_fw_request_len, 372 + &dev_attr_host_fw_numbers_queue, 373 + &dev_attr_host_fw_sdram_size, 374 + &dev_attr_host_fw_hd_channels, 398 375 NULL, 399 376 };
+6 -7
drivers/scsi/ch.c
··· 881 881 static int ch_probe(struct device *dev) 882 882 { 883 883 struct scsi_device *sd = to_scsi_device(dev); 884 - struct class_device *class_dev; 884 + struct device *class_dev; 885 885 int minor, ret = -ENOMEM; 886 886 scsi_changer *ch; 887 887 ··· 910 910 ch->minor = minor; 911 911 sprintf(ch->name,"ch%d",ch->minor); 912 912 913 - class_dev = class_device_create(ch_sysfs_class, NULL, 914 - MKDEV(SCSI_CHANGER_MAJOR, ch->minor), 915 - dev, "s%s", ch->name); 913 + class_dev = device_create(ch_sysfs_class, dev, 914 + MKDEV(SCSI_CHANGER_MAJOR,ch->minor), 915 + "s%s", ch->name); 916 916 if (IS_ERR(class_dev)) { 917 - printk(KERN_WARNING "ch%d: class_device_create failed\n", 917 + printk(KERN_WARNING "ch%d: device_create failed\n", 918 918 ch->minor); 919 919 ret = PTR_ERR(class_dev); 920 920 goto remove_idr; ··· 945 945 idr_remove(&ch_index_idr, ch->minor); 946 946 spin_unlock(&ch_index_lock); 947 947 948 - class_device_destroy(ch_sysfs_class, 949 - MKDEV(SCSI_CHANGER_MAJOR,ch->minor)); 948 + device_destroy(ch_sysfs_class, MKDEV(SCSI_CHANGER_MAJOR,ch->minor)); 950 949 kfree(ch->dt); 951 950 kfree(ch); 952 951 return 0;
+17 -17
drivers/scsi/hosts.c
··· 43 43 static int scsi_host_next_hn; /* host_no for next new host */ 44 44 45 45 46 - static void scsi_host_cls_release(struct class_device *class_dev) 46 + static void scsi_host_cls_release(struct device *dev) 47 47 { 48 - put_device(&class_to_shost(class_dev)->shost_gendev); 48 + put_device(&class_to_shost(dev)->shost_gendev); 49 49 } 50 50 51 51 static struct class shost_class = { 52 52 .name = "scsi_host", 53 - .release = scsi_host_cls_release, 53 + .dev_release = scsi_host_cls_release, 54 54 }; 55 55 56 56 /** ··· 174 174 spin_unlock_irqrestore(shost->host_lock, flags); 175 175 176 176 transport_unregister_device(&shost->shost_gendev); 177 - class_device_unregister(&shost->shost_classdev); 177 + device_unregister(&shost->shost_dev); 178 178 device_del(&shost->shost_gendev); 179 179 scsi_proc_hostdir_rm(shost->hostt); 180 180 } ··· 212 212 scsi_host_set_state(shost, SHOST_RUNNING); 213 213 get_device(shost->shost_gendev.parent); 214 214 215 - error = class_device_add(&shost->shost_classdev); 215 + error = device_add(&shost->shost_dev); 216 216 if (error) 217 217 goto out_del_gendev; 218 218 ··· 223 223 GFP_KERNEL); 224 224 if (shost->shost_data == NULL) { 225 225 error = -ENOMEM; 226 - goto out_del_classdev; 226 + goto out_del_dev; 227 227 } 228 228 } 229 229 ··· 250 250 destroy_workqueue(shost->work_q); 251 251 out_free_shost_data: 252 252 kfree(shost->shost_data); 253 - out_del_classdev: 254 - class_device_del(&shost->shost_classdev); 253 + out_del_dev: 254 + device_del(&shost->shost_dev); 255 255 out_del_gendev: 256 256 device_del(&shost->shost_gendev); 257 257 out: ··· 385 385 shost->host_no); 386 386 shost->shost_gendev.release = scsi_host_dev_release; 387 387 388 - class_device_initialize(&shost->shost_classdev); 389 - shost->shost_classdev.dev = &shost->shost_gendev; 390 - shost->shost_classdev.class = &shost_class; 391 - snprintf(shost->shost_classdev.class_id, BUS_ID_SIZE, "host%d", 392 - shost->host_no); 388 + device_initialize(&shost->shost_dev); 389 + shost->shost_dev.parent = &shost->shost_gendev; 390 + shost->shost_dev.class = &shost_class; 391 + snprintf(shost->shost_dev.bus_id, BUS_ID_SIZE, "host%d", 392 + shost->host_no); 393 393 394 394 shost->ehandler = kthread_run(scsi_error_handler, shost, 395 395 "scsi_eh_%d", shost->host_no); ··· 432 432 } 433 433 EXPORT_SYMBOL(scsi_unregister); 434 434 435 - static int __scsi_host_match(struct class_device *cdev, void *data) 435 + static int __scsi_host_match(struct device *dev, void *data) 436 436 { 437 437 struct Scsi_Host *p; 438 438 unsigned short *hostnum = (unsigned short *)data; 439 439 440 - p = class_to_shost(cdev); 440 + p = class_to_shost(dev); 441 441 return p->host_no == *hostnum; 442 442 } 443 443 ··· 450 450 **/ 451 451 struct Scsi_Host *scsi_host_lookup(unsigned short hostnum) 452 452 { 453 - struct class_device *cdev; 453 + struct device *cdev; 454 454 struct Scsi_Host *shost = ERR_PTR(-ENXIO); 455 455 456 - cdev = class_find_child(&shost_class, &hostnum, __scsi_host_match); 456 + cdev = class_find_device(&shost_class, &hostnum, __scsi_host_match); 457 457 if (cdev) 458 458 shost = scsi_host_get(class_to_shost(cdev)); 459 459
+8 -6
drivers/scsi/hptiop.c
··· 859 859 return queue_depth; 860 860 } 861 861 862 - static ssize_t hptiop_show_version(struct class_device *class_dev, char *buf) 862 + static ssize_t hptiop_show_version(struct device *dev, 863 + struct device_attribute *attr, char *buf) 863 864 { 864 865 return snprintf(buf, PAGE_SIZE, "%s\n", driver_ver); 865 866 } 866 867 867 - static ssize_t hptiop_show_fw_version(struct class_device *class_dev, char *buf) 868 + static ssize_t hptiop_show_fw_version(struct device *dev, 869 + struct device_attribute *attr, char *buf) 868 870 { 869 - struct Scsi_Host *host = class_to_shost(class_dev); 871 + struct Scsi_Host *host = class_to_shost(dev); 870 872 struct hptiop_hba *hba = (struct hptiop_hba *)host->hostdata; 871 873 872 874 return snprintf(buf, PAGE_SIZE, "%d.%d.%d.%d\n", ··· 878 876 hba->firmware_version & 0xff); 879 877 } 880 878 881 - static struct class_device_attribute hptiop_attr_version = { 879 + static struct device_attribute hptiop_attr_version = { 882 880 .attr = { 883 881 .name = "driver-version", 884 882 .mode = S_IRUGO, ··· 886 884 .show = hptiop_show_version, 887 885 }; 888 886 889 - static struct class_device_attribute hptiop_attr_fw_version = { 887 + static struct device_attribute hptiop_attr_fw_version = { 890 888 .attr = { 891 889 .name = "firmware-version", 892 890 .mode = S_IRUGO, ··· 894 892 .show = hptiop_show_fw_version, 895 893 }; 896 894 897 - static struct class_device_attribute *hptiop_attrs[] = { 895 + static struct device_attribute *hptiop_attrs[] = { 898 896 &hptiop_attr_version, 899 897 &hptiop_attr_fw_version, 900 898 NULL
+25 -19
drivers/scsi/ibmvscsi/ibmvscsi.c
··· 1456 1456 /* ------------------------------------------------------------ 1457 1457 * sysfs attributes 1458 1458 */ 1459 - static ssize_t show_host_srp_version(struct class_device *class_dev, char *buf) 1459 + static ssize_t show_host_srp_version(struct device *dev, 1460 + struct device_attribute *attr, char *buf) 1460 1461 { 1461 - struct Scsi_Host *shost = class_to_shost(class_dev); 1462 + struct Scsi_Host *shost = class_to_shost(dev); 1462 1463 struct ibmvscsi_host_data *hostdata = shost_priv(shost); 1463 1464 int len; 1464 1465 ··· 1468 1467 return len; 1469 1468 } 1470 1469 1471 - static struct class_device_attribute ibmvscsi_host_srp_version = { 1470 + static struct device_attribute ibmvscsi_host_srp_version = { 1472 1471 .attr = { 1473 1472 .name = "srp_version", 1474 1473 .mode = S_IRUGO, ··· 1476 1475 .show = show_host_srp_version, 1477 1476 }; 1478 1477 1479 - static ssize_t show_host_partition_name(struct class_device *class_dev, 1478 + static ssize_t show_host_partition_name(struct device *dev, 1479 + struct device_attribute *attr, 1480 1480 char *buf) 1481 1481 { 1482 - struct Scsi_Host *shost = class_to_shost(class_dev); 1482 + struct Scsi_Host *shost = class_to_shost(dev); 1483 1483 struct ibmvscsi_host_data *hostdata = shost_priv(shost); 1484 1484 int len; 1485 1485 ··· 1489 1487 return len; 1490 1488 } 1491 1489 1492 - static struct class_device_attribute ibmvscsi_host_partition_name = { 1490 + static struct device_attribute ibmvscsi_host_partition_name = { 1493 1491 .attr = { 1494 1492 .name = "partition_name", 1495 1493 .mode = S_IRUGO, ··· 1497 1495 .show = show_host_partition_name, 1498 1496 }; 1499 1497 1500 - static ssize_t show_host_partition_number(struct class_device *class_dev, 1498 + static ssize_t show_host_partition_number(struct device *dev, 1499 + struct device_attribute *attr, 1501 1500 char *buf) 1502 1501 { 1503 - struct Scsi_Host *shost = class_to_shost(class_dev); 1502 + struct Scsi_Host *shost = class_to_shost(dev); 1504 1503 struct ibmvscsi_host_data *hostdata = shost_priv(shost); 1505 1504 int len; 1506 1505 ··· 1510 1507 return len; 1511 1508 } 1512 1509 1513 - static struct class_device_attribute ibmvscsi_host_partition_number = { 1510 + static struct device_attribute ibmvscsi_host_partition_number = { 1514 1511 .attr = { 1515 1512 .name = "partition_number", 1516 1513 .mode = S_IRUGO, ··· 1518 1515 .show = show_host_partition_number, 1519 1516 }; 1520 1517 1521 - static ssize_t show_host_mad_version(struct class_device *class_dev, char *buf) 1518 + static ssize_t show_host_mad_version(struct device *dev, 1519 + struct device_attribute *attr, char *buf) 1522 1520 { 1523 - struct Scsi_Host *shost = class_to_shost(class_dev); 1521 + struct Scsi_Host *shost = class_to_shost(dev); 1524 1522 struct ibmvscsi_host_data *hostdata = shost_priv(shost); 1525 1523 int len; 1526 1524 ··· 1530 1526 return len; 1531 1527 } 1532 1528 1533 - static struct class_device_attribute ibmvscsi_host_mad_version = { 1529 + static struct device_attribute ibmvscsi_host_mad_version = { 1534 1530 .attr = { 1535 1531 .name = "mad_version", 1536 1532 .mode = S_IRUGO, ··· 1538 1534 .show = show_host_mad_version, 1539 1535 }; 1540 1536 1541 - static ssize_t show_host_os_type(struct class_device *class_dev, char *buf) 1537 + static ssize_t show_host_os_type(struct device *dev, 1538 + struct device_attribute *attr, char *buf) 1542 1539 { 1543 - struct Scsi_Host *shost = class_to_shost(class_dev); 1540 + struct Scsi_Host *shost = class_to_shost(dev); 1544 1541 struct ibmvscsi_host_data *hostdata = shost_priv(shost); 1545 1542 int len; 1546 1543 ··· 1549 1544 return len; 1550 1545 } 1551 1546 1552 - static struct class_device_attribute ibmvscsi_host_os_type = { 1547 + static struct device_attribute ibmvscsi_host_os_type = { 1553 1548 .attr = { 1554 1549 .name = "os_type", 1555 1550 .mode = S_IRUGO, ··· 1557 1552 .show = show_host_os_type, 1558 1553 }; 1559 1554 1560 - static ssize_t show_host_config(struct class_device *class_dev, char *buf) 1555 + static ssize_t show_host_config(struct device *dev, 1556 + struct device_attribute *attr, char *buf) 1561 1557 { 1562 - struct Scsi_Host *shost = class_to_shost(class_dev); 1558 + struct Scsi_Host *shost = class_to_shost(dev); 1563 1559 struct ibmvscsi_host_data *hostdata = shost_priv(shost); 1564 1560 1565 1561 /* returns null-terminated host config data */ ··· 1570 1564 return 0; 1571 1565 } 1572 1566 1573 - static struct class_device_attribute ibmvscsi_host_config = { 1567 + static struct device_attribute ibmvscsi_host_config = { 1574 1568 .attr = { 1575 1569 .name = "config", 1576 1570 .mode = S_IRUGO, ··· 1578 1572 .show = show_host_config, 1579 1573 }; 1580 1574 1581 - static struct class_device_attribute *ibmvscsi_attrs[] = { 1575 + static struct device_attribute *ibmvscsi_attrs[] = { 1582 1576 &ibmvscsi_host_srp_version, 1583 1577 &ibmvscsi_host_partition_name, 1584 1578 &ibmvscsi_host_partition_number,
+14 -11
drivers/scsi/ibmvscsi/ibmvstgt.c
··· 780 780 return 0; 781 781 } 782 782 783 - static ssize_t system_id_show(struct class_device *cdev, char *buf) 783 + static ssize_t system_id_show(struct device *dev, 784 + struct device_attribute *attr, char *buf) 784 785 { 785 786 return snprintf(buf, PAGE_SIZE, "%s\n", system_id); 786 787 } 787 788 788 - static ssize_t partition_number_show(struct class_device *cdev, char *buf) 789 + static ssize_t partition_number_show(struct device *dev, 790 + struct device_attribute *attr, char *buf) 789 791 { 790 792 return snprintf(buf, PAGE_SIZE, "%x\n", partition_number); 791 793 } 792 794 793 - static ssize_t unit_address_show(struct class_device *cdev, char *buf) 795 + static ssize_t unit_address_show(struct device *dev, 796 + struct device_attribute *attr, char *buf) 794 797 { 795 - struct Scsi_Host *shost = class_to_shost(cdev); 798 + struct Scsi_Host *shost = class_to_shost(dev); 796 799 struct srp_target *target = host_to_srp_target(shost); 797 800 struct vio_port *vport = target_to_port(target); 798 801 return snprintf(buf, PAGE_SIZE, "%x\n", vport->dma_dev->unit_address); 799 802 } 800 803 801 - static CLASS_DEVICE_ATTR(system_id, S_IRUGO, system_id_show, NULL); 802 - static CLASS_DEVICE_ATTR(partition_number, S_IRUGO, partition_number_show, NULL); 803 - static CLASS_DEVICE_ATTR(unit_address, S_IRUGO, unit_address_show, NULL); 804 + static DEVICE_ATTR(system_id, S_IRUGO, system_id_show, NULL); 805 + static DEVICE_ATTR(partition_number, S_IRUGO, partition_number_show, NULL); 806 + static DEVICE_ATTR(unit_address, S_IRUGO, unit_address_show, NULL); 804 807 805 - static struct class_device_attribute *ibmvstgt_attrs[] = { 806 - &class_device_attr_system_id, 807 - &class_device_attr_partition_number, 808 - &class_device_attr_unit_address, 808 + static struct device_attribute *ibmvstgt_attrs[] = { 809 + &dev_attr_system_id, 810 + &dev_attr_partition_number, 811 + &dev_attr_unit_address, 809 812 NULL, 810 813 }; 811 814
+75 -65
drivers/scsi/ipr.c
··· 2431 2431 } 2432 2432 2433 2433 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); 2434 - kobject_uevent(&ioa_cfg->host->shost_classdev.kobj, KOBJ_CHANGE); 2434 + kobject_uevent(&ioa_cfg->host->shost_dev.kobj, KOBJ_CHANGE); 2435 2435 LEAVE; 2436 2436 } 2437 2437 ··· 2451 2451 struct bin_attribute *bin_attr, 2452 2452 char *buf, loff_t off, size_t count) 2453 2453 { 2454 - struct class_device *cdev = container_of(kobj,struct class_device,kobj); 2455 - struct Scsi_Host *shost = class_to_shost(cdev); 2454 + struct device *dev = container_of(kobj, struct device, kobj); 2455 + struct Scsi_Host *shost = class_to_shost(dev); 2456 2456 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; 2457 2457 unsigned long lock_flags = 0; 2458 2458 int size = IPR_TRACE_SIZE; ··· 2492 2492 2493 2493 /** 2494 2494 * ipr_show_write_caching - Show the write caching attribute 2495 - * @class_dev: class device struct 2496 - * @buf: buffer 2495 + * @dev: device struct 2496 + * @buf: buffer 2497 2497 * 2498 2498 * Return value: 2499 2499 * number of bytes printed to buffer 2500 2500 **/ 2501 - static ssize_t ipr_show_write_caching(struct class_device *class_dev, char *buf) 2501 + static ssize_t ipr_show_write_caching(struct device *dev, 2502 + struct device_attribute *attr, char *buf) 2502 2503 { 2503 - struct Scsi_Host *shost = class_to_shost(class_dev); 2504 + struct Scsi_Host *shost = class_to_shost(dev); 2504 2505 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; 2505 2506 unsigned long lock_flags = 0; 2506 2507 int i, len = 0; ··· 2520 2519 2521 2520 /** 2522 2521 * ipr_store_write_caching - Enable/disable adapter write cache 2523 - * @class_dev: class_device struct 2524 - * @buf: buffer 2525 - * @count: buffer size 2522 + * @dev: device struct 2523 + * @buf: buffer 2524 + * @count: buffer size 2526 2525 * 2527 2526 * This function will enable/disable adapter write cache. 2528 2527 * 2529 2528 * Return value: 2530 2529 * count on success / other on failure 2531 2530 **/ 2532 - static ssize_t ipr_store_write_caching(struct class_device *class_dev, 2533 - const char *buf, size_t count) 2531 + static ssize_t ipr_store_write_caching(struct device *dev, 2532 + struct device_attribute *attr, 2533 + const char *buf, size_t count) 2534 2534 { 2535 - struct Scsi_Host *shost = class_to_shost(class_dev); 2535 + struct Scsi_Host *shost = class_to_shost(dev); 2536 2536 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; 2537 2537 unsigned long lock_flags = 0; 2538 2538 enum ipr_cache_state new_state = CACHE_INVALID; ··· 2571 2569 return count; 2572 2570 } 2573 2571 2574 - static struct class_device_attribute ipr_ioa_cache_attr = { 2572 + static struct device_attribute ipr_ioa_cache_attr = { 2575 2573 .attr = { 2576 2574 .name = "write_cache", 2577 2575 .mode = S_IRUGO | S_IWUSR, ··· 2582 2580 2583 2581 /** 2584 2582 * ipr_show_fw_version - Show the firmware version 2585 - * @class_dev: class device struct 2586 - * @buf: buffer 2583 + * @dev: class device struct 2584 + * @buf: buffer 2587 2585 * 2588 2586 * Return value: 2589 2587 * number of bytes printed to buffer 2590 2588 **/ 2591 - static ssize_t ipr_show_fw_version(struct class_device *class_dev, char *buf) 2589 + static ssize_t ipr_show_fw_version(struct device *dev, 2590 + struct device_attribute *attr, char *buf) 2592 2591 { 2593 - struct Scsi_Host *shost = class_to_shost(class_dev); 2592 + struct Scsi_Host *shost = class_to_shost(dev); 2594 2593 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; 2595 2594 struct ipr_inquiry_page3 *ucode_vpd = &ioa_cfg->vpd_cbs->page3_data; 2596 2595 unsigned long lock_flags = 0; ··· 2606 2603 return len; 2607 2604 } 2608 2605 2609 - static struct class_device_attribute ipr_fw_version_attr = { 2606 + static struct device_attribute ipr_fw_version_attr = { 2610 2607 .attr = { 2611 2608 .name = "fw_version", 2612 2609 .mode = S_IRUGO, ··· 2616 2613 2617 2614 /** 2618 2615 * ipr_show_log_level - Show the adapter's error logging level 2619 - * @class_dev: class device struct 2620 - * @buf: buffer 2616 + * @dev: class device struct 2617 + * @buf: buffer 2621 2618 * 2622 2619 * Return value: 2623 2620 * number of bytes printed to buffer 2624 2621 **/ 2625 - static ssize_t ipr_show_log_level(struct class_device *class_dev, char *buf) 2622 + static ssize_t ipr_show_log_level(struct device *dev, 2623 + struct device_attribute *attr, char *buf) 2626 2624 { 2627 - struct Scsi_Host *shost = class_to_shost(class_dev); 2625 + struct Scsi_Host *shost = class_to_shost(dev); 2628 2626 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; 2629 2627 unsigned long lock_flags = 0; 2630 2628 int len; ··· 2638 2634 2639 2635 /** 2640 2636 * ipr_store_log_level - Change the adapter's error logging level 2641 - * @class_dev: class device struct 2642 - * @buf: buffer 2637 + * @dev: class device struct 2638 + * @buf: buffer 2643 2639 * 2644 2640 * Return value: 2645 2641 * number of bytes printed to buffer 2646 2642 **/ 2647 - static ssize_t ipr_store_log_level(struct class_device *class_dev, 2643 + static ssize_t ipr_store_log_level(struct device *dev, 2644 + struct device_attribute *attr, 2648 2645 const char *buf, size_t count) 2649 2646 { 2650 - struct Scsi_Host *shost = class_to_shost(class_dev); 2647 + struct Scsi_Host *shost = class_to_shost(dev); 2651 2648 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; 2652 2649 unsigned long lock_flags = 0; 2653 2650 ··· 2658 2653 return strlen(buf); 2659 2654 } 2660 2655 2661 - static struct class_device_attribute ipr_log_level_attr = { 2656 + static struct device_attribute ipr_log_level_attr = { 2662 2657 .attr = { 2663 2658 .name = "log_level", 2664 2659 .mode = S_IRUGO | S_IWUSR, ··· 2669 2664 2670 2665 /** 2671 2666 * ipr_store_diagnostics - IOA Diagnostics interface 2672 - * @class_dev: class_device struct 2673 - * @buf: buffer 2674 - * @count: buffer size 2667 + * @dev: device struct 2668 + * @buf: buffer 2669 + * @count: buffer size 2675 2670 * 2676 2671 * This function will reset the adapter and wait a reasonable 2677 2672 * amount of time for any errors that the adapter might log. ··· 2679 2674 * Return value: 2680 2675 * count on success / other on failure 2681 2676 **/ 2682 - static ssize_t ipr_store_diagnostics(struct class_device *class_dev, 2677 + static ssize_t ipr_store_diagnostics(struct device *dev, 2678 + struct device_attribute *attr, 2683 2679 const char *buf, size_t count) 2684 2680 { 2685 - struct Scsi_Host *shost = class_to_shost(class_dev); 2681 + struct Scsi_Host *shost = class_to_shost(dev); 2686 2682 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; 2687 2683 unsigned long lock_flags = 0; 2688 2684 int rc = count; ··· 2720 2714 return rc; 2721 2715 } 2722 2716 2723 - static struct class_device_attribute ipr_diagnostics_attr = { 2717 + static struct device_attribute ipr_diagnostics_attr = { 2724 2718 .attr = { 2725 2719 .name = "run_diagnostics", 2726 2720 .mode = S_IWUSR, ··· 2730 2724 2731 2725 /** 2732 2726 * ipr_show_adapter_state - Show the adapter's state 2733 - * @class_dev: class device struct 2734 - * @buf: buffer 2727 + * @class_dev: device struct 2728 + * @buf: buffer 2735 2729 * 2736 2730 * Return value: 2737 2731 * number of bytes printed to buffer 2738 2732 **/ 2739 - static ssize_t ipr_show_adapter_state(struct class_device *class_dev, char *buf) 2733 + static ssize_t ipr_show_adapter_state(struct device *dev, 2734 + struct device_attribute *attr, char *buf) 2740 2735 { 2741 - struct Scsi_Host *shost = class_to_shost(class_dev); 2736 + struct Scsi_Host *shost = class_to_shost(dev); 2742 2737 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; 2743 2738 unsigned long lock_flags = 0; 2744 2739 int len; ··· 2755 2748 2756 2749 /** 2757 2750 * ipr_store_adapter_state - Change adapter state 2758 - * @class_dev: class_device struct 2759 - * @buf: buffer 2760 - * @count: buffer size 2751 + * @dev: device struct 2752 + * @buf: buffer 2753 + * @count: buffer size 2761 2754 * 2762 2755 * This function will change the adapter's state. 2763 2756 * 2764 2757 * Return value: 2765 2758 * count on success / other on failure 2766 2759 **/ 2767 - static ssize_t ipr_store_adapter_state(struct class_device *class_dev, 2760 + static ssize_t ipr_store_adapter_state(struct device *dev, 2761 + struct device_attribute *attr, 2768 2762 const char *buf, size_t count) 2769 2763 { 2770 - struct Scsi_Host *shost = class_to_shost(class_dev); 2764 + struct Scsi_Host *shost = class_to_shost(dev); 2771 2765 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; 2772 2766 unsigned long lock_flags; 2773 2767 int result = count; ··· 2789 2781 return result; 2790 2782 } 2791 2783 2792 - static struct class_device_attribute ipr_ioa_state_attr = { 2784 + static struct device_attribute ipr_ioa_state_attr = { 2793 2785 .attr = { 2794 2786 .name = "state", 2795 2787 .mode = S_IRUGO | S_IWUSR, ··· 2800 2792 2801 2793 /** 2802 2794 * ipr_store_reset_adapter - Reset the adapter 2803 - * @class_dev: class_device struct 2804 - * @buf: buffer 2805 - * @count: buffer size 2795 + * @dev: device struct 2796 + * @buf: buffer 2797 + * @count: buffer size 2806 2798 * 2807 2799 * This function will reset the adapter. 2808 2800 * 2809 2801 * Return value: 2810 2802 * count on success / other on failure 2811 2803 **/ 2812 - static ssize_t ipr_store_reset_adapter(struct class_device *class_dev, 2804 + static ssize_t ipr_store_reset_adapter(struct device *dev, 2805 + struct device_attribute *attr, 2813 2806 const char *buf, size_t count) 2814 2807 { 2815 - struct Scsi_Host *shost = class_to_shost(class_dev); 2808 + struct Scsi_Host *shost = class_to_shost(dev); 2816 2809 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; 2817 2810 unsigned long lock_flags; 2818 2811 int result = count; ··· 2830 2821 return result; 2831 2822 } 2832 2823 2833 - static struct class_device_attribute ipr_ioa_reset_attr = { 2824 + static struct device_attribute ipr_ioa_reset_attr = { 2834 2825 .attr = { 2835 2826 .name = "reset_host", 2836 2827 .mode = S_IWUSR, ··· 3063 3054 3064 3055 /** 3065 3056 * ipr_store_update_fw - Update the firmware on the adapter 3066 - * @class_dev: class_device struct 3067 - * @buf: buffer 3068 - * @count: buffer size 3057 + * @class_dev: device struct 3058 + * @buf: buffer 3059 + * @count: buffer size 3069 3060 * 3070 3061 * This function will update the firmware on the adapter. 3071 3062 * 3072 3063 * Return value: 3073 3064 * count on success / other on failure 3074 3065 **/ 3075 - static ssize_t ipr_store_update_fw(struct class_device *class_dev, 3076 - const char *buf, size_t count) 3066 + static ssize_t ipr_store_update_fw(struct device *dev, 3067 + struct device_attribute *attr, 3068 + const char *buf, size_t count) 3077 3069 { 3078 - struct Scsi_Host *shost = class_to_shost(class_dev); 3070 + struct Scsi_Host *shost = class_to_shost(dev); 3079 3071 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; 3080 3072 struct ipr_ucode_image_header *image_hdr; 3081 3073 const struct firmware *fw_entry; ··· 3134 3124 return result; 3135 3125 } 3136 3126 3137 - static struct class_device_attribute ipr_update_fw_attr = { 3127 + static struct device_attribute ipr_update_fw_attr = { 3138 3128 .attr = { 3139 3129 .name = "update_fw", 3140 3130 .mode = S_IWUSR, ··· 3142 3132 .store = ipr_store_update_fw 3143 3133 }; 3144 3134 3145 - static struct class_device_attribute *ipr_ioa_attrs[] = { 3135 + static struct device_attribute *ipr_ioa_attrs[] = { 3146 3136 &ipr_fw_version_attr, 3147 3137 &ipr_log_level_attr, 3148 3138 &ipr_diagnostics_attr, ··· 3169 3159 struct bin_attribute *bin_attr, 3170 3160 char *buf, loff_t off, size_t count) 3171 3161 { 3172 - struct class_device *cdev = container_of(kobj,struct class_device,kobj); 3162 + struct device *cdev = container_of(kobj, struct device, kobj); 3173 3163 struct Scsi_Host *shost = class_to_shost(cdev); 3174 3164 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; 3175 3165 struct ipr_dump *dump; ··· 3332 3322 struct bin_attribute *bin_attr, 3333 3323 char *buf, loff_t off, size_t count) 3334 3324 { 3335 - struct class_device *cdev = container_of(kobj,struct class_device,kobj); 3325 + struct device *cdev = container_of(kobj, struct device, kobj); 3336 3326 struct Scsi_Host *shost = class_to_shost(cdev); 3337 3327 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; 3338 3328 int rc; ··· 7681 7671 7682 7672 ENTER; 7683 7673 7684 - ipr_remove_trace_file(&ioa_cfg->host->shost_classdev.kobj, 7674 + ipr_remove_trace_file(&ioa_cfg->host->shost_dev.kobj, 7685 7675 &ipr_trace_attr); 7686 - ipr_remove_dump_file(&ioa_cfg->host->shost_classdev.kobj, 7676 + ipr_remove_dump_file(&ioa_cfg->host->shost_dev.kobj, 7687 7677 &ipr_dump_attr); 7688 7678 scsi_remove_host(ioa_cfg->host); 7689 7679 ··· 7724 7714 return rc; 7725 7715 } 7726 7716 7727 - rc = ipr_create_trace_file(&ioa_cfg->host->shost_classdev.kobj, 7717 + rc = ipr_create_trace_file(&ioa_cfg->host->shost_dev.kobj, 7728 7718 &ipr_trace_attr); 7729 7719 7730 7720 if (rc) { ··· 7733 7723 return rc; 7734 7724 } 7735 7725 7736 - rc = ipr_create_dump_file(&ioa_cfg->host->shost_classdev.kobj, 7726 + rc = ipr_create_dump_file(&ioa_cfg->host->shost_dev.kobj, 7737 7727 &ipr_dump_attr); 7738 7728 7739 7729 if (rc) { 7740 - ipr_remove_trace_file(&ioa_cfg->host->shost_classdev.kobj, 7730 + ipr_remove_trace_file(&ioa_cfg->host->shost_dev.kobj, 7741 7731 &ipr_trace_attr); 7742 7732 scsi_remove_host(ioa_cfg->host); 7743 7733 __ipr_remove(pdev);
+256 -226
drivers/scsi/lpfc/lpfc_attr.c
··· 66 66 } 67 67 68 68 static ssize_t 69 - lpfc_drvr_version_show(struct class_device *cdev, char *buf) 69 + lpfc_drvr_version_show(struct device *dev, struct device_attribute *attr, 70 + char *buf) 70 71 { 71 72 return snprintf(buf, PAGE_SIZE, LPFC_MODULE_DESC "\n"); 72 73 } 73 74 74 75 static ssize_t 75 - lpfc_info_show(struct class_device *cdev, char *buf) 76 + lpfc_info_show(struct device *dev, struct device_attribute *attr, 77 + char *buf) 76 78 { 77 - struct Scsi_Host *host = class_to_shost(cdev); 79 + struct Scsi_Host *host = class_to_shost(dev); 78 80 79 81 return snprintf(buf, PAGE_SIZE, "%s\n",lpfc_info(host)); 80 82 } 81 83 82 84 static ssize_t 83 - lpfc_serialnum_show(struct class_device *cdev, char *buf) 85 + lpfc_serialnum_show(struct device *dev, struct device_attribute *attr, 86 + char *buf) 84 87 { 85 - struct Scsi_Host *shost = class_to_shost(cdev); 88 + struct Scsi_Host *shost = class_to_shost(dev); 86 89 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 87 90 struct lpfc_hba *phba = vport->phba; 88 91 ··· 93 90 } 94 91 95 92 static ssize_t 96 - lpfc_temp_sensor_show(struct class_device *cdev, char *buf) 93 + lpfc_temp_sensor_show(struct device *dev, struct device_attribute *attr, 94 + char *buf) 97 95 { 98 - struct Scsi_Host *shost = class_to_shost(cdev); 96 + struct Scsi_Host *shost = class_to_shost(dev); 99 97 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 100 98 struct lpfc_hba *phba = vport->phba; 101 99 return snprintf(buf, PAGE_SIZE, "%d\n",phba->temp_sensor_support); 102 100 } 103 101 104 102 static ssize_t 105 - lpfc_modeldesc_show(struct class_device *cdev, char *buf) 103 + lpfc_modeldesc_show(struct device *dev, struct device_attribute *attr, 104 + char *buf) 106 105 { 107 - struct Scsi_Host *shost = class_to_shost(cdev); 106 + struct Scsi_Host *shost = class_to_shost(dev); 108 107 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 109 108 struct lpfc_hba *phba = vport->phba; 110 109 ··· 114 109 } 115 110 116 111 static ssize_t 117 - lpfc_modelname_show(struct class_device *cdev, char *buf) 112 + lpfc_modelname_show(struct device *dev, struct device_attribute *attr, 113 + char *buf) 118 114 { 119 - struct Scsi_Host *shost = class_to_shost(cdev); 115 + struct Scsi_Host *shost = class_to_shost(dev); 120 116 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 121 117 struct lpfc_hba *phba = vport->phba; 122 118 ··· 125 119 } 126 120 127 121 static ssize_t 128 - lpfc_programtype_show(struct class_device *cdev, char *buf) 122 + lpfc_programtype_show(struct device *dev, struct device_attribute *attr, 123 + char *buf) 129 124 { 130 - struct Scsi_Host *shost = class_to_shost(cdev); 125 + struct Scsi_Host *shost = class_to_shost(dev); 131 126 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 132 127 struct lpfc_hba *phba = vport->phba; 133 128 ··· 136 129 } 137 130 138 131 static ssize_t 139 - lpfc_vportnum_show(struct class_device *cdev, char *buf) 132 + lpfc_vportnum_show(struct device *dev, struct device_attribute *attr, 133 + char *buf) 140 134 { 141 - struct Scsi_Host *shost = class_to_shost(cdev); 135 + struct Scsi_Host *shost = class_to_shost(dev); 142 136 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 143 137 struct lpfc_hba *phba = vport->phba; 144 138 ··· 147 139 } 148 140 149 141 static ssize_t 150 - lpfc_fwrev_show(struct class_device *cdev, char *buf) 142 + lpfc_fwrev_show(struct device *dev, struct device_attribute *attr, 143 + char *buf) 151 144 { 152 - struct Scsi_Host *shost = class_to_shost(cdev); 145 + struct Scsi_Host *shost = class_to_shost(dev); 153 146 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 154 147 struct lpfc_hba *phba = vport->phba; 155 148 char fwrev[32]; ··· 160 151 } 161 152 162 153 static ssize_t 163 - lpfc_hdw_show(struct class_device *cdev, char *buf) 154 + lpfc_hdw_show(struct device *dev, struct device_attribute *attr, char *buf) 164 155 { 165 156 char hdw[9]; 166 - struct Scsi_Host *shost = class_to_shost(cdev); 157 + struct Scsi_Host *shost = class_to_shost(dev); 167 158 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 168 159 struct lpfc_hba *phba = vport->phba; 169 160 lpfc_vpd_t *vp = &phba->vpd; ··· 172 163 return snprintf(buf, PAGE_SIZE, "%s\n", hdw); 173 164 } 174 165 static ssize_t 175 - lpfc_option_rom_version_show(struct class_device *cdev, char *buf) 166 + lpfc_option_rom_version_show(struct device *dev, struct device_attribute *attr, 167 + char *buf) 176 168 { 177 - struct Scsi_Host *shost = class_to_shost(cdev); 169 + struct Scsi_Host *shost = class_to_shost(dev); 178 170 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 179 171 struct lpfc_hba *phba = vport->phba; 180 172 181 173 return snprintf(buf, PAGE_SIZE, "%s\n", phba->OptionROMVersion); 182 174 } 183 175 static ssize_t 184 - lpfc_state_show(struct class_device *cdev, char *buf) 176 + lpfc_state_show(struct device *dev, struct device_attribute *attr, 177 + char *buf) 185 178 { 186 - struct Scsi_Host *shost = class_to_shost(cdev); 179 + struct Scsi_Host *shost = class_to_shost(dev); 187 180 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 188 181 struct lpfc_hba *phba = vport->phba; 189 182 int len = 0; ··· 254 243 } 255 244 256 245 static ssize_t 257 - lpfc_num_discovered_ports_show(struct class_device *cdev, char *buf) 246 + lpfc_num_discovered_ports_show(struct device *dev, 247 + struct device_attribute *attr, char *buf) 258 248 { 259 - struct Scsi_Host *shost = class_to_shost(cdev); 249 + struct Scsi_Host *shost = class_to_shost(dev); 260 250 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 261 251 262 252 return snprintf(buf, PAGE_SIZE, "%d\n", ··· 379 367 } 380 368 381 369 static ssize_t 382 - lpfc_issue_reset(struct class_device *cdev, const char *buf, size_t count) 370 + lpfc_issue_reset(struct device *dev, struct device_attribute *attr, 371 + const char *buf, size_t count) 383 372 { 384 - struct Scsi_Host *shost = class_to_shost(cdev); 373 + struct Scsi_Host *shost = class_to_shost(dev); 385 374 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 386 375 struct lpfc_hba *phba = vport->phba; 387 376 ··· 398 385 } 399 386 400 387 static ssize_t 401 - lpfc_nport_evt_cnt_show(struct class_device *cdev, char *buf) 388 + lpfc_nport_evt_cnt_show(struct device *dev, struct device_attribute *attr, 389 + char *buf) 402 390 { 403 - struct Scsi_Host *shost = class_to_shost(cdev); 391 + struct Scsi_Host *shost = class_to_shost(dev); 404 392 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 405 393 struct lpfc_hba *phba = vport->phba; 406 394 ··· 409 395 } 410 396 411 397 static ssize_t 412 - lpfc_board_mode_show(struct class_device *cdev, char *buf) 398 + lpfc_board_mode_show(struct device *dev, struct device_attribute *attr, 399 + char *buf) 413 400 { 414 - struct Scsi_Host *shost = class_to_shost(cdev); 401 + struct Scsi_Host *shost = class_to_shost(dev); 415 402 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 416 403 struct lpfc_hba *phba = vport->phba; 417 404 char * state; ··· 430 415 } 431 416 432 417 static ssize_t 433 - lpfc_board_mode_store(struct class_device *cdev, const char *buf, size_t count) 418 + lpfc_board_mode_store(struct device *dev, struct device_attribute *attr, 419 + const char *buf, size_t count) 434 420 { 435 - struct Scsi_Host *shost = class_to_shost(cdev); 421 + struct Scsi_Host *shost = class_to_shost(dev); 436 422 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 437 423 struct lpfc_hba *phba = vport->phba; 438 424 struct completion online_compl; ··· 525 509 } 526 510 527 511 static ssize_t 528 - lpfc_max_rpi_show(struct class_device *cdev, char *buf) 512 + lpfc_max_rpi_show(struct device *dev, struct device_attribute *attr, 513 + char *buf) 529 514 { 530 - struct Scsi_Host *shost = class_to_shost(cdev); 515 + struct Scsi_Host *shost = class_to_shost(dev); 531 516 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 532 517 struct lpfc_hba *phba = vport->phba; 533 518 uint32_t cnt; ··· 539 522 } 540 523 541 524 static ssize_t 542 - lpfc_used_rpi_show(struct class_device *cdev, char *buf) 525 + lpfc_used_rpi_show(struct device *dev, struct device_attribute *attr, 526 + char *buf) 543 527 { 544 - struct Scsi_Host *shost = class_to_shost(cdev); 528 + struct Scsi_Host *shost = class_to_shost(dev); 545 529 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 546 530 struct lpfc_hba *phba = vport->phba; 547 531 uint32_t cnt, acnt; ··· 553 535 } 554 536 555 537 static ssize_t 556 - lpfc_max_xri_show(struct class_device *cdev, char *buf) 538 + lpfc_max_xri_show(struct device *dev, struct device_attribute *attr, 539 + char *buf) 557 540 { 558 - struct Scsi_Host *shost = class_to_shost(cdev); 541 + struct Scsi_Host *shost = class_to_shost(dev); 559 542 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 560 543 struct lpfc_hba *phba = vport->phba; 561 544 uint32_t cnt; ··· 567 548 } 568 549 569 550 static ssize_t 570 - lpfc_used_xri_show(struct class_device *cdev, char *buf) 551 + lpfc_used_xri_show(struct device *dev, struct device_attribute *attr, 552 + char *buf) 571 553 { 572 - struct Scsi_Host *shost = class_to_shost(cdev); 554 + struct Scsi_Host *shost = class_to_shost(dev); 573 555 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 574 556 struct lpfc_hba *phba = vport->phba; 575 557 uint32_t cnt, acnt; ··· 581 561 } 582 562 583 563 static ssize_t 584 - lpfc_max_vpi_show(struct class_device *cdev, char *buf) 564 + lpfc_max_vpi_show(struct device *dev, struct device_attribute *attr, 565 + char *buf) 585 566 { 586 - struct Scsi_Host *shost = class_to_shost(cdev); 567 + struct Scsi_Host *shost = class_to_shost(dev); 587 568 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 588 569 struct lpfc_hba *phba = vport->phba; 589 570 uint32_t cnt; ··· 595 574 } 596 575 597 576 static ssize_t 598 - lpfc_used_vpi_show(struct class_device *cdev, char *buf) 577 + lpfc_used_vpi_show(struct device *dev, struct device_attribute *attr, 578 + char *buf) 599 579 { 600 - struct Scsi_Host *shost = class_to_shost(cdev); 580 + struct Scsi_Host *shost = class_to_shost(dev); 601 581 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 602 582 struct lpfc_hba *phba = vport->phba; 603 583 uint32_t cnt, acnt; ··· 609 587 } 610 588 611 589 static ssize_t 612 - lpfc_npiv_info_show(struct class_device *cdev, char *buf) 590 + lpfc_npiv_info_show(struct device *dev, struct device_attribute *attr, 591 + char *buf) 613 592 { 614 - struct Scsi_Host *shost = class_to_shost(cdev); 593 + struct Scsi_Host *shost = class_to_shost(dev); 615 594 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 616 595 struct lpfc_hba *phba = vport->phba; 617 596 ··· 624 601 } 625 602 626 603 static ssize_t 627 - lpfc_poll_show(struct class_device *cdev, char *buf) 604 + lpfc_poll_show(struct device *dev, struct device_attribute *attr, 605 + char *buf) 628 606 { 629 - struct Scsi_Host *shost = class_to_shost(cdev); 607 + struct Scsi_Host *shost = class_to_shost(dev); 630 608 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 631 609 struct lpfc_hba *phba = vport->phba; 632 610 ··· 635 611 } 636 612 637 613 static ssize_t 638 - lpfc_poll_store(struct class_device *cdev, const char *buf, 639 - size_t count) 614 + lpfc_poll_store(struct device *dev, struct device_attribute *attr, 615 + const char *buf, size_t count) 640 616 { 641 - struct Scsi_Host *shost = class_to_shost(cdev); 617 + struct Scsi_Host *shost = class_to_shost(dev); 642 618 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 643 619 struct lpfc_hba *phba = vport->phba; 644 620 uint32_t creg_val; ··· 694 670 695 671 #define lpfc_param_show(attr) \ 696 672 static ssize_t \ 697 - lpfc_##attr##_show(struct class_device *cdev, char *buf) \ 673 + lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \ 674 + char *buf) \ 698 675 { \ 699 - struct Scsi_Host *shost = class_to_shost(cdev);\ 676 + struct Scsi_Host *shost = class_to_shost(dev);\ 700 677 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ 701 678 struct lpfc_hba *phba = vport->phba;\ 702 679 int val = 0;\ ··· 708 683 709 684 #define lpfc_param_hex_show(attr) \ 710 685 static ssize_t \ 711 - lpfc_##attr##_show(struct class_device *cdev, char *buf) \ 686 + lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \ 687 + char *buf) \ 712 688 { \ 713 - struct Scsi_Host *shost = class_to_shost(cdev);\ 689 + struct Scsi_Host *shost = class_to_shost(dev);\ 714 690 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ 715 691 struct lpfc_hba *phba = vport->phba;\ 716 692 int val = 0;\ ··· 751 725 752 726 #define lpfc_param_store(attr) \ 753 727 static ssize_t \ 754 - lpfc_##attr##_store(struct class_device *cdev, const char *buf, size_t count) \ 728 + lpfc_##attr##_store(struct device *dev, struct device_attribute *attr, \ 729 + const char *buf, size_t count) \ 755 730 { \ 756 - struct Scsi_Host *shost = class_to_shost(cdev);\ 731 + struct Scsi_Host *shost = class_to_shost(dev);\ 757 732 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ 758 733 struct lpfc_hba *phba = vport->phba;\ 759 734 int val=0;\ ··· 770 743 771 744 #define lpfc_vport_param_show(attr) \ 772 745 static ssize_t \ 773 - lpfc_##attr##_show(struct class_device *cdev, char *buf) \ 746 + lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \ 747 + char *buf) \ 774 748 { \ 775 - struct Scsi_Host *shost = class_to_shost(cdev);\ 749 + struct Scsi_Host *shost = class_to_shost(dev);\ 776 750 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ 777 751 int val = 0;\ 778 752 val = vport->cfg_##attr;\ ··· 782 754 783 755 #define lpfc_vport_param_hex_show(attr) \ 784 756 static ssize_t \ 785 - lpfc_##attr##_show(struct class_device *cdev, char *buf) \ 757 + lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \ 758 + char *buf) \ 786 759 { \ 787 - struct Scsi_Host *shost = class_to_shost(cdev);\ 760 + struct Scsi_Host *shost = class_to_shost(dev);\ 788 761 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ 789 762 int val = 0;\ 790 763 val = vport->cfg_##attr;\ ··· 823 794 824 795 #define lpfc_vport_param_store(attr) \ 825 796 static ssize_t \ 826 - lpfc_##attr##_store(struct class_device *cdev, const char *buf, size_t count) \ 797 + lpfc_##attr##_store(struct device *dev, struct device_attribute *attr, \ 798 + const char *buf, size_t count) \ 827 799 { \ 828 - struct Scsi_Host *shost = class_to_shost(cdev);\ 800 + struct Scsi_Host *shost = class_to_shost(dev);\ 829 801 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ 830 802 int val=0;\ 831 803 if (!isdigit(buf[0]))\ ··· 852 822 MODULE_PARM_DESC(lpfc_##name, desc);\ 853 823 lpfc_param_show(name)\ 854 824 lpfc_param_init(name, defval, minval, maxval)\ 855 - static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) 825 + static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) 856 826 857 827 #define LPFC_ATTR_RW(name, defval, minval, maxval, desc) \ 858 828 static int lpfc_##name = defval;\ ··· 862 832 lpfc_param_init(name, defval, minval, maxval)\ 863 833 lpfc_param_set(name, defval, minval, maxval)\ 864 834 lpfc_param_store(name)\ 865 - static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ 866 - lpfc_##name##_show, lpfc_##name##_store) 835 + static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ 836 + lpfc_##name##_show, lpfc_##name##_store) 867 837 868 838 #define LPFC_ATTR_HEX_R(name, defval, minval, maxval, desc) \ 869 839 static int lpfc_##name = defval;\ ··· 871 841 MODULE_PARM_DESC(lpfc_##name, desc);\ 872 842 lpfc_param_hex_show(name)\ 873 843 lpfc_param_init(name, defval, minval, maxval)\ 874 - static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) 844 + static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) 875 845 876 846 #define LPFC_ATTR_HEX_RW(name, defval, minval, maxval, desc) \ 877 847 static int lpfc_##name = defval;\ ··· 881 851 lpfc_param_init(name, defval, minval, maxval)\ 882 852 lpfc_param_set(name, defval, minval, maxval)\ 883 853 lpfc_param_store(name)\ 884 - static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ 885 - lpfc_##name##_show, lpfc_##name##_store) 854 + static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ 855 + lpfc_##name##_show, lpfc_##name##_store) 886 856 887 857 #define LPFC_VPORT_ATTR(name, defval, minval, maxval, desc) \ 888 858 static int lpfc_##name = defval;\ ··· 896 866 MODULE_PARM_DESC(lpfc_##name, desc);\ 897 867 lpfc_vport_param_show(name)\ 898 868 lpfc_vport_param_init(name, defval, minval, maxval)\ 899 - static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) 869 + static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) 900 870 901 871 #define LPFC_VPORT_ATTR_RW(name, defval, minval, maxval, desc) \ 902 872 static int lpfc_##name = defval;\ ··· 906 876 lpfc_vport_param_init(name, defval, minval, maxval)\ 907 877 lpfc_vport_param_set(name, defval, minval, maxval)\ 908 878 lpfc_vport_param_store(name)\ 909 - static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ 910 - lpfc_##name##_show, lpfc_##name##_store) 879 + static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ 880 + lpfc_##name##_show, lpfc_##name##_store) 911 881 912 882 #define LPFC_VPORT_ATTR_HEX_R(name, defval, minval, maxval, desc) \ 913 883 static int lpfc_##name = defval;\ ··· 915 885 MODULE_PARM_DESC(lpfc_##name, desc);\ 916 886 lpfc_vport_param_hex_show(name)\ 917 887 lpfc_vport_param_init(name, defval, minval, maxval)\ 918 - static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) 888 + static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) 919 889 920 890 #define LPFC_VPORT_ATTR_HEX_RW(name, defval, minval, maxval, desc) \ 921 891 static int lpfc_##name = defval;\ ··· 925 895 lpfc_vport_param_init(name, defval, minval, maxval)\ 926 896 lpfc_vport_param_set(name, defval, minval, maxval)\ 927 897 lpfc_vport_param_store(name)\ 928 - static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ 929 - lpfc_##name##_show, lpfc_##name##_store) 898 + static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ 899 + lpfc_##name##_show, lpfc_##name##_store) 930 900 931 - static CLASS_DEVICE_ATTR(info, S_IRUGO, lpfc_info_show, NULL); 932 - static CLASS_DEVICE_ATTR(serialnum, S_IRUGO, lpfc_serialnum_show, NULL); 933 - static CLASS_DEVICE_ATTR(modeldesc, S_IRUGO, lpfc_modeldesc_show, NULL); 934 - static CLASS_DEVICE_ATTR(modelname, S_IRUGO, lpfc_modelname_show, NULL); 935 - static CLASS_DEVICE_ATTR(programtype, S_IRUGO, lpfc_programtype_show, NULL); 936 - static CLASS_DEVICE_ATTR(portnum, S_IRUGO, lpfc_vportnum_show, NULL); 937 - static CLASS_DEVICE_ATTR(fwrev, S_IRUGO, lpfc_fwrev_show, NULL); 938 - static CLASS_DEVICE_ATTR(hdw, S_IRUGO, lpfc_hdw_show, NULL); 939 - static CLASS_DEVICE_ATTR(state, S_IRUGO, lpfc_state_show, NULL); 940 - static CLASS_DEVICE_ATTR(option_rom_version, S_IRUGO, 941 - lpfc_option_rom_version_show, NULL); 942 - static CLASS_DEVICE_ATTR(num_discovered_ports, S_IRUGO, 943 - lpfc_num_discovered_ports_show, NULL); 944 - static CLASS_DEVICE_ATTR(nport_evt_cnt, S_IRUGO, lpfc_nport_evt_cnt_show, NULL); 945 - static CLASS_DEVICE_ATTR(lpfc_drvr_version, S_IRUGO, lpfc_drvr_version_show, 946 - NULL); 947 - static CLASS_DEVICE_ATTR(board_mode, S_IRUGO | S_IWUSR, 948 - lpfc_board_mode_show, lpfc_board_mode_store); 949 - static CLASS_DEVICE_ATTR(issue_reset, S_IWUSR, NULL, lpfc_issue_reset); 950 - static CLASS_DEVICE_ATTR(max_vpi, S_IRUGO, lpfc_max_vpi_show, NULL); 951 - static CLASS_DEVICE_ATTR(used_vpi, S_IRUGO, lpfc_used_vpi_show, NULL); 952 - static CLASS_DEVICE_ATTR(max_rpi, S_IRUGO, lpfc_max_rpi_show, NULL); 953 - static CLASS_DEVICE_ATTR(used_rpi, S_IRUGO, lpfc_used_rpi_show, NULL); 954 - static CLASS_DEVICE_ATTR(max_xri, S_IRUGO, lpfc_max_xri_show, NULL); 955 - static CLASS_DEVICE_ATTR(used_xri, S_IRUGO, lpfc_used_xri_show, NULL); 956 - static CLASS_DEVICE_ATTR(npiv_info, S_IRUGO, lpfc_npiv_info_show, NULL); 957 - static CLASS_DEVICE_ATTR(lpfc_temp_sensor, S_IRUGO, lpfc_temp_sensor_show, 958 - NULL); 901 + static DEVICE_ATTR(info, S_IRUGO, lpfc_info_show, NULL); 902 + static DEVICE_ATTR(serialnum, S_IRUGO, lpfc_serialnum_show, NULL); 903 + static DEVICE_ATTR(modeldesc, S_IRUGO, lpfc_modeldesc_show, NULL); 904 + static DEVICE_ATTR(modelname, S_IRUGO, lpfc_modelname_show, NULL); 905 + static DEVICE_ATTR(programtype, S_IRUGO, lpfc_programtype_show, NULL); 906 + static DEVICE_ATTR(portnum, S_IRUGO, lpfc_vportnum_show, NULL); 907 + static DEVICE_ATTR(fwrev, S_IRUGO, lpfc_fwrev_show, NULL); 908 + static DEVICE_ATTR(hdw, S_IRUGO, lpfc_hdw_show, NULL); 909 + static DEVICE_ATTR(state, S_IRUGO, lpfc_state_show, NULL); 910 + static DEVICE_ATTR(option_rom_version, S_IRUGO, 911 + lpfc_option_rom_version_show, NULL); 912 + static DEVICE_ATTR(num_discovered_ports, S_IRUGO, 913 + lpfc_num_discovered_ports_show, NULL); 914 + static DEVICE_ATTR(nport_evt_cnt, S_IRUGO, lpfc_nport_evt_cnt_show, NULL); 915 + static DEVICE_ATTR(lpfc_drvr_version, S_IRUGO, lpfc_drvr_version_show, NULL); 916 + static DEVICE_ATTR(board_mode, S_IRUGO | S_IWUSR, 917 + lpfc_board_mode_show, lpfc_board_mode_store); 918 + static DEVICE_ATTR(issue_reset, S_IWUSR, NULL, lpfc_issue_reset); 919 + static DEVICE_ATTR(max_vpi, S_IRUGO, lpfc_max_vpi_show, NULL); 920 + static DEVICE_ATTR(used_vpi, S_IRUGO, lpfc_used_vpi_show, NULL); 921 + static DEVICE_ATTR(max_rpi, S_IRUGO, lpfc_max_rpi_show, NULL); 922 + static DEVICE_ATTR(used_rpi, S_IRUGO, lpfc_used_rpi_show, NULL); 923 + static DEVICE_ATTR(max_xri, S_IRUGO, lpfc_max_xri_show, NULL); 924 + static DEVICE_ATTR(used_xri, S_IRUGO, lpfc_used_xri_show, NULL); 925 + static DEVICE_ATTR(npiv_info, S_IRUGO, lpfc_npiv_info_show, NULL); 926 + static DEVICE_ATTR(lpfc_temp_sensor, S_IRUGO, lpfc_temp_sensor_show, NULL); 959 927 960 928 961 929 static char *lpfc_soft_wwn_key = "C99G71SL8032A"; 962 930 963 931 static ssize_t 964 - lpfc_soft_wwn_enable_store(struct class_device *cdev, const char *buf, 965 - size_t count) 932 + lpfc_soft_wwn_enable_store(struct device *dev, struct device_attribute *attr, 933 + const char *buf, size_t count) 966 934 { 967 - struct Scsi_Host *shost = class_to_shost(cdev); 935 + struct Scsi_Host *shost = class_to_shost(dev); 968 936 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 969 937 struct lpfc_hba *phba = vport->phba; 970 938 unsigned int cnt = count; ··· 991 963 phba->soft_wwn_enable = 1; 992 964 return count; 993 965 } 994 - static CLASS_DEVICE_ATTR(lpfc_soft_wwn_enable, S_IWUSR, NULL, 995 - lpfc_soft_wwn_enable_store); 966 + static DEVICE_ATTR(lpfc_soft_wwn_enable, S_IWUSR, NULL, 967 + lpfc_soft_wwn_enable_store); 996 968 997 969 static ssize_t 998 - lpfc_soft_wwpn_show(struct class_device *cdev, char *buf) 970 + lpfc_soft_wwpn_show(struct device *dev, struct device_attribute *attr, 971 + char *buf) 999 972 { 1000 - struct Scsi_Host *shost = class_to_shost(cdev); 973 + struct Scsi_Host *shost = class_to_shost(dev); 1001 974 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 1002 975 struct lpfc_hba *phba = vport->phba; 1003 976 ··· 1008 979 1009 980 1010 981 static ssize_t 1011 - lpfc_soft_wwpn_store(struct class_device *cdev, const char *buf, size_t count) 982 + lpfc_soft_wwpn_store(struct device *dev, struct device_attribute *attr, 983 + const char *buf, size_t count) 1012 984 { 1013 - struct Scsi_Host *shost = class_to_shost(cdev); 985 + struct Scsi_Host *shost = class_to_shost(dev); 1014 986 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 1015 987 struct lpfc_hba *phba = vport->phba; 1016 988 struct completion online_compl; ··· 1077 1047 "reinit adapter - %d\n", stat2); 1078 1048 return (stat1 || stat2) ? -EIO : count; 1079 1049 } 1080 - static CLASS_DEVICE_ATTR(lpfc_soft_wwpn, S_IRUGO | S_IWUSR,\ 1081 - lpfc_soft_wwpn_show, lpfc_soft_wwpn_store); 1050 + static DEVICE_ATTR(lpfc_soft_wwpn, S_IRUGO | S_IWUSR,\ 1051 + lpfc_soft_wwpn_show, lpfc_soft_wwpn_store); 1082 1052 1083 1053 static ssize_t 1084 - lpfc_soft_wwnn_show(struct class_device *cdev, char *buf) 1054 + lpfc_soft_wwnn_show(struct device *dev, struct device_attribute *attr, 1055 + char *buf) 1085 1056 { 1086 - struct Scsi_Host *shost = class_to_shost(cdev); 1057 + struct Scsi_Host *shost = class_to_shost(dev); 1087 1058 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; 1088 1059 return snprintf(buf, PAGE_SIZE, "0x%llx\n", 1089 1060 (unsigned long long)phba->cfg_soft_wwnn); ··· 1092 1061 1093 1062 1094 1063 static ssize_t 1095 - lpfc_soft_wwnn_store(struct class_device *cdev, const char *buf, size_t count) 1064 + lpfc_soft_wwnn_store(struct device *dev, struct device_attribute *attr, 1065 + const char *buf, size_t count) 1096 1066 { 1097 - struct Scsi_Host *shost = class_to_shost(cdev); 1067 + struct Scsi_Host *shost = class_to_shost(dev); 1098 1068 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; 1099 1069 unsigned int i, j, cnt=count; 1100 1070 u8 wwnn[8]; ··· 1139 1107 1140 1108 return count; 1141 1109 } 1142 - static CLASS_DEVICE_ATTR(lpfc_soft_wwnn, S_IRUGO | S_IWUSR,\ 1143 - lpfc_soft_wwnn_show, lpfc_soft_wwnn_store); 1110 + static DEVICE_ATTR(lpfc_soft_wwnn, S_IRUGO | S_IWUSR,\ 1111 + lpfc_soft_wwnn_show, lpfc_soft_wwnn_store); 1144 1112 1145 1113 1146 1114 static int lpfc_poll = 0; ··· 1150 1118 " 1 - poll with interrupts enabled" 1151 1119 " 3 - poll and disable FCP ring interrupts"); 1152 1120 1153 - static CLASS_DEVICE_ATTR(lpfc_poll, S_IRUGO | S_IWUSR, 1154 - lpfc_poll_show, lpfc_poll_store); 1121 + static DEVICE_ATTR(lpfc_poll, S_IRUGO | S_IWUSR, 1122 + lpfc_poll_show, lpfc_poll_store); 1155 1123 1156 1124 int lpfc_sli_mode = 0; 1157 1125 module_param(lpfc_sli_mode, int, 0); ··· 1165 1133 MODULE_PARM_DESC(lpfc_enable_npiv, "Enable NPIV functionality"); 1166 1134 lpfc_param_show(enable_npiv); 1167 1135 lpfc_param_init(enable_npiv, 0, 0, 1); 1168 - static CLASS_DEVICE_ATTR(lpfc_enable_npiv, S_IRUGO, 1136 + static DEVICE_ATTR(lpfc_enable_npiv, S_IRUGO, 1169 1137 lpfc_enable_npiv_show, NULL); 1170 1138 1171 1139 /* ··· 1179 1147 "Seconds driver will hold I/O waiting " 1180 1148 "for a device to come back"); 1181 1149 static ssize_t 1182 - lpfc_nodev_tmo_show(struct class_device *cdev, char *buf) 1150 + lpfc_nodev_tmo_show(struct device *dev, struct device_attribute *attr, 1151 + char *buf) 1183 1152 { 1184 - struct Scsi_Host *shost = class_to_shost(cdev); 1153 + struct Scsi_Host *shost = class_to_shost(dev); 1185 1154 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 1186 1155 int val = 0; 1187 1156 val = vport->cfg_devloss_tmo; ··· 1254 1221 1255 1222 lpfc_vport_param_store(nodev_tmo) 1256 1223 1257 - static CLASS_DEVICE_ATTR(lpfc_nodev_tmo, S_IRUGO | S_IWUSR, 1258 - lpfc_nodev_tmo_show, lpfc_nodev_tmo_store); 1224 + static DEVICE_ATTR(lpfc_nodev_tmo, S_IRUGO | S_IWUSR, 1225 + lpfc_nodev_tmo_show, lpfc_nodev_tmo_store); 1259 1226 1260 1227 /* 1261 1228 # lpfc_devloss_tmo: If set, it will hold all I/O errors on devices that ··· 1288 1255 } 1289 1256 1290 1257 lpfc_vport_param_store(devloss_tmo) 1291 - static CLASS_DEVICE_ATTR(lpfc_devloss_tmo, S_IRUGO | S_IWUSR, 1292 - lpfc_devloss_tmo_show, lpfc_devloss_tmo_store); 1258 + static DEVICE_ATTR(lpfc_devloss_tmo, S_IRUGO | S_IWUSR, 1259 + lpfc_devloss_tmo_show, lpfc_devloss_tmo_store); 1293 1260 1294 1261 /* 1295 1262 # lpfc_log_verbose: Only turn this flag on if you are willing to risk being ··· 1407 1374 return 0; 1408 1375 } 1409 1376 lpfc_vport_param_store(restrict_login); 1410 - static CLASS_DEVICE_ATTR(lpfc_restrict_login, S_IRUGO | S_IWUSR, 1411 - lpfc_restrict_login_show, lpfc_restrict_login_store); 1377 + static DEVICE_ATTR(lpfc_restrict_login, S_IRUGO | S_IWUSR, 1378 + lpfc_restrict_login_show, lpfc_restrict_login_store); 1412 1379 1413 1380 /* 1414 1381 # Some disk devices have a "select ID" or "select Target" capability. ··· 1466 1433 lpfc_param_show(topology) 1467 1434 lpfc_param_init(topology, 0, 0, 6) 1468 1435 lpfc_param_store(topology) 1469 - static CLASS_DEVICE_ATTR(lpfc_topology, S_IRUGO | S_IWUSR, 1436 + static DEVICE_ATTR(lpfc_topology, S_IRUGO | S_IWUSR, 1470 1437 lpfc_topology_show, lpfc_topology_store); 1471 1438 1472 1439 /* ··· 1530 1497 } 1531 1498 1532 1499 lpfc_param_store(link_speed) 1533 - static CLASS_DEVICE_ATTR(lpfc_link_speed, S_IRUGO | S_IWUSR, 1500 + static DEVICE_ATTR(lpfc_link_speed, S_IRUGO | S_IWUSR, 1534 1501 lpfc_link_speed_show, lpfc_link_speed_store); 1535 1502 1536 1503 /* ··· 1656 1623 LPFC_ATTR_R(sg_seg_cnt, LPFC_DEFAULT_SG_SEG_CNT, LPFC_DEFAULT_SG_SEG_CNT, 1657 1624 LPFC_MAX_SG_SEG_CNT, "Max Scatter Gather Segment Count"); 1658 1625 1659 - struct class_device_attribute *lpfc_hba_attrs[] = { 1660 - &class_device_attr_info, 1661 - &class_device_attr_serialnum, 1662 - &class_device_attr_modeldesc, 1663 - &class_device_attr_modelname, 1664 - &class_device_attr_programtype, 1665 - &class_device_attr_portnum, 1666 - &class_device_attr_fwrev, 1667 - &class_device_attr_hdw, 1668 - &class_device_attr_option_rom_version, 1669 - &class_device_attr_state, 1670 - &class_device_attr_num_discovered_ports, 1671 - &class_device_attr_lpfc_drvr_version, 1672 - &class_device_attr_lpfc_temp_sensor, 1673 - &class_device_attr_lpfc_log_verbose, 1674 - &class_device_attr_lpfc_lun_queue_depth, 1675 - &class_device_attr_lpfc_hba_queue_depth, 1676 - &class_device_attr_lpfc_peer_port_login, 1677 - &class_device_attr_lpfc_nodev_tmo, 1678 - &class_device_attr_lpfc_devloss_tmo, 1679 - &class_device_attr_lpfc_fcp_class, 1680 - &class_device_attr_lpfc_use_adisc, 1681 - &class_device_attr_lpfc_ack0, 1682 - &class_device_attr_lpfc_topology, 1683 - &class_device_attr_lpfc_scan_down, 1684 - &class_device_attr_lpfc_link_speed, 1685 - &class_device_attr_lpfc_cr_delay, 1686 - &class_device_attr_lpfc_cr_count, 1687 - &class_device_attr_lpfc_multi_ring_support, 1688 - &class_device_attr_lpfc_multi_ring_rctl, 1689 - &class_device_attr_lpfc_multi_ring_type, 1690 - &class_device_attr_lpfc_fdmi_on, 1691 - &class_device_attr_lpfc_max_luns, 1692 - &class_device_attr_lpfc_enable_npiv, 1693 - &class_device_attr_nport_evt_cnt, 1694 - &class_device_attr_board_mode, 1695 - &class_device_attr_max_vpi, 1696 - &class_device_attr_used_vpi, 1697 - &class_device_attr_max_rpi, 1698 - &class_device_attr_used_rpi, 1699 - &class_device_attr_max_xri, 1700 - &class_device_attr_used_xri, 1701 - &class_device_attr_npiv_info, 1702 - &class_device_attr_issue_reset, 1703 - &class_device_attr_lpfc_poll, 1704 - &class_device_attr_lpfc_poll_tmo, 1705 - &class_device_attr_lpfc_use_msi, 1706 - &class_device_attr_lpfc_soft_wwnn, 1707 - &class_device_attr_lpfc_soft_wwpn, 1708 - &class_device_attr_lpfc_soft_wwn_enable, 1709 - &class_device_attr_lpfc_enable_hba_reset, 1710 - &class_device_attr_lpfc_enable_hba_heartbeat, 1711 - &class_device_attr_lpfc_sg_seg_cnt, 1626 + struct device_attribute *lpfc_hba_attrs[] = { 1627 + &dev_attr_info, 1628 + &dev_attr_serialnum, 1629 + &dev_attr_modeldesc, 1630 + &dev_attr_modelname, 1631 + &dev_attr_programtype, 1632 + &dev_attr_portnum, 1633 + &dev_attr_fwrev, 1634 + &dev_attr_hdw, 1635 + &dev_attr_option_rom_version, 1636 + &dev_attr_state, 1637 + &dev_attr_num_discovered_ports, 1638 + &dev_attr_lpfc_drvr_version, 1639 + &dev_attr_lpfc_temp_sensor, 1640 + &dev_attr_lpfc_log_verbose, 1641 + &dev_attr_lpfc_lun_queue_depth, 1642 + &dev_attr_lpfc_hba_queue_depth, 1643 + &dev_attr_lpfc_peer_port_login, 1644 + &dev_attr_lpfc_nodev_tmo, 1645 + &dev_attr_lpfc_devloss_tmo, 1646 + &dev_attr_lpfc_fcp_class, 1647 + &dev_attr_lpfc_use_adisc, 1648 + &dev_attr_lpfc_ack0, 1649 + &dev_attr_lpfc_topology, 1650 + &dev_attr_lpfc_scan_down, 1651 + &dev_attr_lpfc_link_speed, 1652 + &dev_attr_lpfc_cr_delay, 1653 + &dev_attr_lpfc_cr_count, 1654 + &dev_attr_lpfc_multi_ring_support, 1655 + &dev_attr_lpfc_multi_ring_rctl, 1656 + &dev_attr_lpfc_multi_ring_type, 1657 + &dev_attr_lpfc_fdmi_on, 1658 + &dev_attr_lpfc_max_luns, 1659 + &dev_attr_lpfc_enable_npiv, 1660 + &dev_attr_nport_evt_cnt, 1661 + &dev_attr_board_mode, 1662 + &dev_attr_max_vpi, 1663 + &dev_attr_used_vpi, 1664 + &dev_attr_max_rpi, 1665 + &dev_attr_used_rpi, 1666 + &dev_attr_max_xri, 1667 + &dev_attr_used_xri, 1668 + &dev_attr_npiv_info, 1669 + &dev_attr_issue_reset, 1670 + &dev_attr_lpfc_poll, 1671 + &dev_attr_lpfc_poll_tmo, 1672 + &dev_attr_lpfc_use_msi, 1673 + &dev_attr_lpfc_soft_wwnn, 1674 + &dev_attr_lpfc_soft_wwpn, 1675 + &dev_attr_lpfc_soft_wwn_enable, 1676 + &dev_attr_lpfc_enable_hba_reset, 1677 + &dev_attr_lpfc_enable_hba_heartbeat, 1678 + &dev_attr_lpfc_sg_seg_cnt, 1712 1679 NULL, 1713 1680 }; 1714 1681 1715 - struct class_device_attribute *lpfc_vport_attrs[] = { 1716 - &class_device_attr_info, 1717 - &class_device_attr_state, 1718 - &class_device_attr_num_discovered_ports, 1719 - &class_device_attr_lpfc_drvr_version, 1720 - 1721 - &class_device_attr_lpfc_log_verbose, 1722 - &class_device_attr_lpfc_lun_queue_depth, 1723 - &class_device_attr_lpfc_nodev_tmo, 1724 - &class_device_attr_lpfc_devloss_tmo, 1725 - &class_device_attr_lpfc_hba_queue_depth, 1726 - &class_device_attr_lpfc_peer_port_login, 1727 - &class_device_attr_lpfc_restrict_login, 1728 - &class_device_attr_lpfc_fcp_class, 1729 - &class_device_attr_lpfc_use_adisc, 1730 - &class_device_attr_lpfc_fdmi_on, 1731 - &class_device_attr_lpfc_max_luns, 1732 - &class_device_attr_nport_evt_cnt, 1733 - &class_device_attr_npiv_info, 1734 - &class_device_attr_lpfc_enable_da_id, 1682 + struct device_attribute *lpfc_vport_attrs[] = { 1683 + &dev_attr_info, 1684 + &dev_attr_state, 1685 + &dev_attr_num_discovered_ports, 1686 + &dev_attr_lpfc_drvr_version, 1687 + &dev_attr_lpfc_log_verbose, 1688 + &dev_attr_lpfc_lun_queue_depth, 1689 + &dev_attr_lpfc_nodev_tmo, 1690 + &dev_attr_lpfc_devloss_tmo, 1691 + &dev_attr_lpfc_hba_queue_depth, 1692 + &dev_attr_lpfc_peer_port_login, 1693 + &dev_attr_lpfc_restrict_login, 1694 + &dev_attr_lpfc_fcp_class, 1695 + &dev_attr_lpfc_use_adisc, 1696 + &dev_attr_lpfc_fdmi_on, 1697 + &dev_attr_lpfc_max_luns, 1698 + &dev_attr_nport_evt_cnt, 1699 + &dev_attr_npiv_info, 1700 + &dev_attr_lpfc_enable_da_id, 1735 1701 NULL, 1736 1702 }; 1737 1703 ··· 1739 1707 char *buf, loff_t off, size_t count) 1740 1708 { 1741 1709 size_t buf_off; 1742 - struct class_device *cdev = container_of(kobj, struct class_device, 1743 - kobj); 1744 - struct Scsi_Host *shost = class_to_shost(cdev); 1710 + struct device *dev = container_of(kobj, struct device, kobj); 1711 + struct Scsi_Host *shost = class_to_shost(dev); 1745 1712 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 1746 1713 struct lpfc_hba *phba = vport->phba; 1747 1714 ··· 1772 1741 { 1773 1742 size_t buf_off; 1774 1743 uint32_t * tmp_ptr; 1775 - struct class_device *cdev = container_of(kobj, struct class_device, 1776 - kobj); 1777 - struct Scsi_Host *shost = class_to_shost(cdev); 1744 + struct device *dev = container_of(kobj, struct device, kobj); 1745 + struct Scsi_Host *shost = class_to_shost(dev); 1778 1746 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 1779 1747 struct lpfc_hba *phba = vport->phba; 1780 1748 ··· 1828 1798 sysfs_mbox_write(struct kobject *kobj, struct bin_attribute *bin_attr, 1829 1799 char *buf, loff_t off, size_t count) 1830 1800 { 1831 - struct class_device *cdev = container_of(kobj, struct class_device, 1832 - kobj); 1833 - struct Scsi_Host *shost = class_to_shost(cdev); 1801 + struct device *dev = container_of(kobj, struct device, kobj); 1802 + struct Scsi_Host *shost = class_to_shost(dev); 1834 1803 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 1835 1804 struct lpfc_hba *phba = vport->phba; 1836 1805 struct lpfcMboxq *mbox = NULL; ··· 1882 1853 sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr, 1883 1854 char *buf, loff_t off, size_t count) 1884 1855 { 1885 - struct class_device *cdev = container_of(kobj, struct class_device, 1886 - kobj); 1887 - struct Scsi_Host *shost = class_to_shost(cdev); 1856 + struct device *dev = container_of(kobj, struct device, kobj); 1857 + struct Scsi_Host *shost = class_to_shost(dev); 1888 1858 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 1889 1859 struct lpfc_hba *phba = vport->phba; 1890 1860 int rc; ··· 2066 2038 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 2067 2039 int error; 2068 2040 2069 - error = sysfs_create_bin_file(&shost->shost_classdev.kobj, 2041 + error = sysfs_create_bin_file(&shost->shost_dev.kobj, 2070 2042 &sysfs_ctlreg_attr); 2071 2043 if (error) 2072 2044 goto out; 2073 2045 2074 - error = sysfs_create_bin_file(&shost->shost_classdev.kobj, 2046 + error = sysfs_create_bin_file(&shost->shost_dev.kobj, 2075 2047 &sysfs_mbox_attr); 2076 2048 if (error) 2077 2049 goto out_remove_ctlreg_attr; 2078 2050 2079 2051 return 0; 2080 2052 out_remove_ctlreg_attr: 2081 - sysfs_remove_bin_file(&shost->shost_classdev.kobj, &sysfs_ctlreg_attr); 2053 + sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr); 2082 2054 out: 2083 2055 return error; 2084 2056 } ··· 2088 2060 { 2089 2061 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 2090 2062 2091 - sysfs_remove_bin_file(&shost->shost_classdev.kobj, &sysfs_mbox_attr); 2092 - sysfs_remove_bin_file(&shost->shost_classdev.kobj, &sysfs_ctlreg_attr); 2063 + sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_mbox_attr); 2064 + sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr); 2093 2065 } 2094 2066 2095 2067 ··· 2471 2443 2472 2444 #define lpfc_rport_show_function(field, format_string, sz, cast) \ 2473 2445 static ssize_t \ 2474 - lpfc_show_rport_##field (struct class_device *cdev, char *buf) \ 2446 + lpfc_show_rport_##field (struct device *dev, \ 2447 + struct device_attribute *attr, \ 2448 + char *buf) \ 2475 2449 { \ 2476 - struct fc_rport *rport = transport_class_to_rport(cdev); \ 2450 + struct fc_rport *rport = transport_class_to_rport(dev); \ 2477 2451 struct lpfc_rport_data *rdata = rport->hostdata; \ 2478 2452 return snprintf(buf, sz, format_string, \ 2479 2453 (rdata->target) ? cast rdata->target->field : 0); \
+2 -2
drivers/scsi/lpfc/lpfc_crtn.h
··· 253 253 void lpfc_get_vport_cfgparam(struct lpfc_vport *); 254 254 int lpfc_alloc_sysfs_attr(struct lpfc_vport *); 255 255 void lpfc_free_sysfs_attr(struct lpfc_vport *); 256 - extern struct class_device_attribute *lpfc_hba_attrs[]; 257 - extern struct class_device_attribute *lpfc_vport_attrs[]; 256 + extern struct device_attribute *lpfc_hba_attrs[]; 257 + extern struct device_attribute *lpfc_vport_attrs[]; 258 258 extern struct scsi_host_template lpfc_template; 259 259 extern struct scsi_host_template lpfc_vport_template; 260 260 extern struct fc_function_template lpfc_transport_functions;
+7 -6
drivers/scsi/megaraid/megaraid_mbox.c
··· 125 125 126 126 static void megaraid_mbox_dpc(unsigned long); 127 127 128 - static ssize_t megaraid_sysfs_show_app_hndl(struct class_device *, char *); 128 + static ssize_t megaraid_sysfs_show_app_hndl(struct device *, struct device_attribute *attr, char *); 129 129 static ssize_t megaraid_sysfs_show_ldnum(struct device *, struct device_attribute *attr, char *); 130 130 131 131 static int megaraid_cmm_register(adapter_t *); ··· 313 313 // definitions for the device attributes for exporting logical drive number 314 314 // for a scsi address (Host, Channel, Id, Lun) 315 315 316 - CLASS_DEVICE_ATTR(megaraid_mbox_app_hndl, S_IRUSR, megaraid_sysfs_show_app_hndl, 316 + DEVICE_ATTR(megaraid_mbox_app_hndl, S_IRUSR, megaraid_sysfs_show_app_hndl, 317 317 NULL); 318 318 319 319 // Host template initializer for megaraid mbox sysfs device attributes 320 - static struct class_device_attribute *megaraid_shost_attrs[] = { 321 - &class_device_attr_megaraid_mbox_app_hndl, 320 + static struct device_attribute *megaraid_shost_attrs[] = { 321 + &dev_attr_megaraid_mbox_app_hndl, 322 322 NULL, 323 323 }; 324 324 ··· 4063 4063 * handle, since we do not interface with applications directly. 4064 4064 */ 4065 4065 static ssize_t 4066 - megaraid_sysfs_show_app_hndl(struct class_device *cdev, char *buf) 4066 + megaraid_sysfs_show_app_hndl(struct device *dev, struct device_attribute *attr, 4067 + char *buf) 4067 4068 { 4068 - struct Scsi_Host *shost = class_to_shost(cdev); 4069 + struct Scsi_Host *shost = class_to_shost(dev); 4069 4070 adapter_t *adapter = (adapter_t *)SCSIHOST2ADAP(shost); 4070 4071 uint32_t app_hndl; 4071 4072
+4 -3
drivers/scsi/ncr53c8xx.c
··· 8243 8243 8244 8244 #undef next_wcmd 8245 8245 8246 - static ssize_t show_ncr53c8xx_revision(struct class_device *dev, char *buf) 8246 + static ssize_t show_ncr53c8xx_revision(struct device *dev, 8247 + struct device_attribute *attr, char *buf) 8247 8248 { 8248 8249 struct Scsi_Host *host = class_to_shost(dev); 8249 8250 struct host_data *host_data = (struct host_data *)host->hostdata; ··· 8252 8251 return snprintf(buf, 20, "0x%x\n", host_data->ncb->revision_id); 8253 8252 } 8254 8253 8255 - static struct class_device_attribute ncr53c8xx_revision_attr = { 8254 + static struct device_attribute ncr53c8xx_revision_attr = { 8256 8255 .attr = { .name = "revision", .mode = S_IRUGO, }, 8257 8256 .show = show_ncr53c8xx_revision, 8258 8257 }; 8259 8258 8260 - static struct class_device_attribute *ncr53c8xx_host_attrs[] = { 8259 + static struct device_attribute *ncr53c8xx_host_attrs[] = { 8261 8260 &ncr53c8xx_revision_attr, 8262 8261 NULL 8263 8262 };
+39 -37
drivers/scsi/osst.c
··· 5591 5591 * sysfs support for accessing ADR header information 5592 5592 */ 5593 5593 5594 - static ssize_t osst_adr_rev_show(struct class_device *class_dev, char *buf) 5594 + static ssize_t osst_adr_rev_show(struct device *dev, 5595 + struct device_attribute *attr, char *buf) 5595 5596 { 5596 - struct osst_tape * STp = (struct osst_tape *) class_get_devdata (class_dev); 5597 + struct osst_tape * STp = (struct osst_tape *) dev_get_drvdata (dev); 5597 5598 ssize_t l = 0; 5598 5599 5599 5600 if (STp && STp->header_ok && STp->linux_media) ··· 5602 5601 return l; 5603 5602 } 5604 5603 5605 - CLASS_DEVICE_ATTR(ADR_rev, S_IRUGO, osst_adr_rev_show, NULL); 5604 + DEVICE_ATTR(ADR_rev, S_IRUGO, osst_adr_rev_show, NULL); 5606 5605 5607 - static ssize_t osst_linux_media_version_show(struct class_device *class_dev, char *buf) 5606 + static ssize_t osst_linux_media_version_show(struct device *dev, 5607 + struct device_attribute *attr, 5608 + char *buf) 5608 5609 { 5609 - struct osst_tape * STp = (struct osst_tape *) class_get_devdata (class_dev); 5610 + struct osst_tape * STp = (struct osst_tape *) dev_get_drvdata (dev); 5610 5611 ssize_t l = 0; 5611 5612 5612 5613 if (STp && STp->header_ok && STp->linux_media) ··· 5616 5613 return l; 5617 5614 } 5618 5615 5619 - CLASS_DEVICE_ATTR(media_version, S_IRUGO, osst_linux_media_version_show, NULL); 5616 + DEVICE_ATTR(media_version, S_IRUGO, osst_linux_media_version_show, NULL); 5620 5617 5621 - static ssize_t osst_capacity_show(struct class_device *class_dev, char *buf) 5618 + static ssize_t osst_capacity_show(struct device *dev, 5619 + struct device_attribute *attr, char *buf) 5622 5620 { 5623 - struct osst_tape * STp = (struct osst_tape *) class_get_devdata (class_dev); 5621 + struct osst_tape * STp = (struct osst_tape *) dev_get_drvdata (dev); 5624 5622 ssize_t l = 0; 5625 5623 5626 5624 if (STp && STp->header_ok && STp->linux_media) ··· 5629 5625 return l; 5630 5626 } 5631 5627 5632 - CLASS_DEVICE_ATTR(capacity, S_IRUGO, osst_capacity_show, NULL); 5628 + DEVICE_ATTR(capacity, S_IRUGO, osst_capacity_show, NULL); 5633 5629 5634 - static ssize_t osst_first_data_ppos_show(struct class_device *class_dev, char *buf) 5630 + static ssize_t osst_first_data_ppos_show(struct device *dev, 5631 + struct device_attribute *attr, 5632 + char *buf) 5635 5633 { 5636 - struct osst_tape * STp = (struct osst_tape *) class_get_devdata (class_dev); 5634 + struct osst_tape * STp = (struct osst_tape *) dev_get_drvdata (dev); 5637 5635 ssize_t l = 0; 5638 5636 5639 5637 if (STp && STp->header_ok && STp->linux_media) ··· 5643 5637 return l; 5644 5638 } 5645 5639 5646 - CLASS_DEVICE_ATTR(BOT_frame, S_IRUGO, osst_first_data_ppos_show, NULL); 5640 + DEVICE_ATTR(BOT_frame, S_IRUGO, osst_first_data_ppos_show, NULL); 5647 5641 5648 - static ssize_t osst_eod_frame_ppos_show(struct class_device *class_dev, char *buf) 5642 + static ssize_t osst_eod_frame_ppos_show(struct device *dev, 5643 + struct device_attribute *attr, 5644 + char *buf) 5649 5645 { 5650 - struct osst_tape * STp = (struct osst_tape *) class_get_devdata (class_dev); 5646 + struct osst_tape * STp = (struct osst_tape *) dev_get_drvdata (dev); 5651 5647 ssize_t l = 0; 5652 5648 5653 5649 if (STp && STp->header_ok && STp->linux_media) ··· 5657 5649 return l; 5658 5650 } 5659 5651 5660 - CLASS_DEVICE_ATTR(EOD_frame, S_IRUGO, osst_eod_frame_ppos_show, NULL); 5652 + DEVICE_ATTR(EOD_frame, S_IRUGO, osst_eod_frame_ppos_show, NULL); 5661 5653 5662 - static ssize_t osst_filemark_cnt_show(struct class_device *class_dev, char *buf) 5654 + static ssize_t osst_filemark_cnt_show(struct device *dev, 5655 + struct device_attribute *attr, char *buf) 5663 5656 { 5664 - struct osst_tape * STp = (struct osst_tape *) class_get_devdata (class_dev); 5657 + struct osst_tape * STp = (struct osst_tape *) dev_get_drvdata (dev); 5665 5658 ssize_t l = 0; 5666 5659 5667 5660 if (STp && STp->header_ok && STp->linux_media) ··· 5670 5661 return l; 5671 5662 } 5672 5663 5673 - CLASS_DEVICE_ATTR(file_count, S_IRUGO, osst_filemark_cnt_show, NULL); 5664 + DEVICE_ATTR(file_count, S_IRUGO, osst_filemark_cnt_show, NULL); 5674 5665 5675 5666 static struct class *osst_sysfs_class; 5676 5667 ··· 5687 5678 5688 5679 static void osst_sysfs_destroy(dev_t dev) 5689 5680 { 5690 - class_device_destroy(osst_sysfs_class, dev); 5681 + device_destroy(osst_sysfs_class, dev); 5691 5682 } 5692 5683 5693 5684 static int osst_sysfs_add(dev_t dev, struct device *device, struct osst_tape * STp, char * name) 5694 5685 { 5695 - struct class_device *osst_class_member; 5686 + struct device *osst_member; 5696 5687 int err; 5697 5688 5698 - osst_class_member = class_device_create(osst_sysfs_class, NULL, dev, 5699 - device, "%s", name); 5700 - if (IS_ERR(osst_class_member)) { 5689 + osst_member = device_create(osst_sysfs_class, device, dev, "%s", name); 5690 + if (IS_ERR(osst_member)) { 5701 5691 printk(KERN_WARNING "osst :W: Unable to add sysfs class member %s\n", name); 5702 - return PTR_ERR(osst_class_member); 5692 + return PTR_ERR(osst_member); 5703 5693 } 5704 5694 5705 - class_set_devdata(osst_class_member, STp); 5706 - err = class_device_create_file(osst_class_member, 5707 - &class_device_attr_ADR_rev); 5695 + dev_set_drvdata(osst_member, STp); 5696 + err = device_create_file(osst_member, &dev_attr_ADR_rev); 5708 5697 if (err) 5709 5698 goto err_out; 5710 - err = class_device_create_file(osst_class_member, 5711 - &class_device_attr_media_version); 5699 + err = device_create_file(osst_member, &dev_attr_media_version); 5712 5700 if (err) 5713 5701 goto err_out; 5714 - err = class_device_create_file(osst_class_member, 5715 - &class_device_attr_capacity); 5702 + err = device_create_file(osst_member, &dev_attr_capacity); 5716 5703 if (err) 5717 5704 goto err_out; 5718 - err = class_device_create_file(osst_class_member, 5719 - &class_device_attr_BOT_frame); 5705 + err = device_create_file(osst_member, &dev_attr_BOT_frame); 5720 5706 if (err) 5721 5707 goto err_out; 5722 - err = class_device_create_file(osst_class_member, 5723 - &class_device_attr_EOD_frame); 5708 + err = device_create_file(osst_member, &dev_attr_EOD_frame); 5724 5709 if (err) 5725 5710 goto err_out; 5726 - err = class_device_create_file(osst_class_member, 5727 - &class_device_attr_file_count); 5711 + err = device_create_file(osst_member, &dev_attr_file_count); 5728 5712 if (err) 5729 5713 goto err_out; 5730 5714
+8 -6
drivers/scsi/pcmcia/sym53c500_cs.c
··· 632 632 } 633 633 634 634 static ssize_t 635 - SYM53C500_show_pio(struct class_device *cdev, char *buf) 635 + SYM53C500_show_pio(struct device *dev, struct device_attribute *attr, 636 + char *buf) 636 637 { 637 - struct Scsi_Host *SHp = class_to_shost(cdev); 638 + struct Scsi_Host *SHp = class_to_shost(dev); 638 639 struct sym53c500_data *data = 639 640 (struct sym53c500_data *)SHp->hostdata; 640 641 ··· 643 642 } 644 643 645 644 static ssize_t 646 - SYM53C500_store_pio(struct class_device *cdev, const char *buf, size_t count) 645 + SYM53C500_store_pio(struct device *dev, struct device_attribute *attr, 646 + const char *buf, size_t count) 647 647 { 648 648 int pio; 649 - struct Scsi_Host *SHp = class_to_shost(cdev); 649 + struct Scsi_Host *SHp = class_to_shost(dev); 650 650 struct sym53c500_data *data = 651 651 (struct sym53c500_data *)SHp->hostdata; 652 652 ··· 664 662 * SCSI HBA device attributes we want to 665 663 * make available via sysfs. 666 664 */ 667 - static struct class_device_attribute SYM53C500_pio_attr = { 665 + static struct device_attribute SYM53C500_pio_attr = { 668 666 .attr = { 669 667 .name = "fast_pio", 670 668 .mode = (S_IRUGO | S_IWUSR), ··· 673 671 .store = SYM53C500_store_pio, 674 672 }; 675 673 676 - static struct class_device_attribute *SYM53C500_shost_attrs[] = { 674 + static struct device_attribute *SYM53C500_shost_attrs[] = { 677 675 &SYM53C500_pio_attr, 678 676 NULL, 679 677 };
+95 -80
drivers/scsi/qla2xxx/qla_attr.c
··· 530 530 /* Scsi_Host attributes. */ 531 531 532 532 static ssize_t 533 - qla2x00_drvr_version_show(struct class_device *cdev, char *buf) 533 + qla2x00_drvr_version_show(struct device *dev, 534 + struct device_attribute *attr, char *buf) 534 535 { 535 536 return snprintf(buf, PAGE_SIZE, "%s\n", qla2x00_version_str); 536 537 } 537 538 538 539 static ssize_t 539 - qla2x00_fw_version_show(struct class_device *cdev, char *buf) 540 + qla2x00_fw_version_show(struct device *dev, 541 + struct device_attribute *attr, char *buf) 540 542 { 541 - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); 543 + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); 542 544 char fw_str[30]; 543 545 544 546 return snprintf(buf, PAGE_SIZE, "%s\n", ··· 548 546 } 549 547 550 548 static ssize_t 551 - qla2x00_serial_num_show(struct class_device *cdev, char *buf) 549 + qla2x00_serial_num_show(struct device *dev, struct device_attribute *attr, 550 + char *buf) 552 551 { 553 - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); 552 + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); 554 553 uint32_t sn; 555 554 556 555 if (IS_FWI2_CAPABLE(ha)) ··· 563 560 } 564 561 565 562 static ssize_t 566 - qla2x00_isp_name_show(struct class_device *cdev, char *buf) 563 + qla2x00_isp_name_show(struct device *dev, struct device_attribute *attr, 564 + char *buf) 567 565 { 568 - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); 566 + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); 569 567 return snprintf(buf, PAGE_SIZE, "ISP%04X\n", ha->pdev->device); 570 568 } 571 569 572 570 static ssize_t 573 - qla2x00_isp_id_show(struct class_device *cdev, char *buf) 571 + qla2x00_isp_id_show(struct device *dev, struct device_attribute *attr, 572 + char *buf) 574 573 { 575 - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); 574 + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); 576 575 return snprintf(buf, PAGE_SIZE, "%04x %04x %04x %04x\n", 577 576 ha->product_id[0], ha->product_id[1], ha->product_id[2], 578 577 ha->product_id[3]); 579 578 } 580 579 581 580 static ssize_t 582 - qla2x00_model_name_show(struct class_device *cdev, char *buf) 581 + qla2x00_model_name_show(struct device *dev, struct device_attribute *attr, 582 + char *buf) 583 583 { 584 - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); 584 + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); 585 585 return snprintf(buf, PAGE_SIZE, "%s\n", ha->model_number); 586 586 } 587 587 588 588 static ssize_t 589 - qla2x00_model_desc_show(struct class_device *cdev, char *buf) 589 + qla2x00_model_desc_show(struct device *dev, struct device_attribute *attr, 590 + char *buf) 590 591 { 591 - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); 592 + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); 592 593 return snprintf(buf, PAGE_SIZE, "%s\n", 593 594 ha->model_desc ? ha->model_desc: ""); 594 595 } 595 596 596 597 static ssize_t 597 - qla2x00_pci_info_show(struct class_device *cdev, char *buf) 598 + qla2x00_pci_info_show(struct device *dev, struct device_attribute *attr, 599 + char *buf) 598 600 { 599 - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); 601 + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); 600 602 char pci_info[30]; 601 603 602 604 return snprintf(buf, PAGE_SIZE, "%s\n", ··· 609 601 } 610 602 611 603 static ssize_t 612 - qla2x00_state_show(struct class_device *cdev, char *buf) 604 + qla2x00_state_show(struct device *dev, struct device_attribute *attr, 605 + char *buf) 613 606 { 614 - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); 607 + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); 615 608 int len = 0; 616 609 617 610 if (atomic_read(&ha->loop_state) == LOOP_DOWN || ··· 648 639 } 649 640 650 641 static ssize_t 651 - qla2x00_zio_show(struct class_device *cdev, char *buf) 642 + qla2x00_zio_show(struct device *dev, struct device_attribute *attr, 643 + char *buf) 652 644 { 653 - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); 645 + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); 654 646 int len = 0; 655 647 656 648 switch (ha->zio_mode) { ··· 666 656 } 667 657 668 658 static ssize_t 669 - qla2x00_zio_store(struct class_device *cdev, const char *buf, size_t count) 659 + qla2x00_zio_store(struct device *dev, struct device_attribute *attr, 660 + const char *buf, size_t count) 670 661 { 671 - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); 662 + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); 672 663 int val = 0; 673 664 uint16_t zio_mode; 674 665 ··· 693 682 } 694 683 695 684 static ssize_t 696 - qla2x00_zio_timer_show(struct class_device *cdev, char *buf) 685 + qla2x00_zio_timer_show(struct device *dev, struct device_attribute *attr, 686 + char *buf) 697 687 { 698 - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); 688 + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); 699 689 700 690 return snprintf(buf, PAGE_SIZE, "%d us\n", ha->zio_timer * 100); 701 691 } 702 692 703 693 static ssize_t 704 - qla2x00_zio_timer_store(struct class_device *cdev, const char *buf, 705 - size_t count) 694 + qla2x00_zio_timer_store(struct device *dev, struct device_attribute *attr, 695 + const char *buf, size_t count) 706 696 { 707 - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); 697 + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); 708 698 int val = 0; 709 699 uint16_t zio_timer; 710 700 ··· 721 709 } 722 710 723 711 static ssize_t 724 - qla2x00_beacon_show(struct class_device *cdev, char *buf) 712 + qla2x00_beacon_show(struct device *dev, struct device_attribute *attr, 713 + char *buf) 725 714 { 726 - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); 715 + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); 727 716 int len = 0; 728 717 729 718 if (ha->beacon_blink_led) ··· 735 722 } 736 723 737 724 static ssize_t 738 - qla2x00_beacon_store(struct class_device *cdev, const char *buf, 739 - size_t count) 725 + qla2x00_beacon_store(struct device *dev, struct device_attribute *attr, 726 + const char *buf, size_t count) 740 727 { 741 - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); 728 + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); 742 729 int val = 0; 743 730 int rval; 744 731 ··· 766 753 } 767 754 768 755 static ssize_t 769 - qla2x00_optrom_bios_version_show(struct class_device *cdev, char *buf) 756 + qla2x00_optrom_bios_version_show(struct device *dev, 757 + struct device_attribute *attr, char *buf) 770 758 { 771 - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); 759 + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); 772 760 773 761 return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->bios_revision[1], 774 762 ha->bios_revision[0]); 775 763 } 776 764 777 765 static ssize_t 778 - qla2x00_optrom_efi_version_show(struct class_device *cdev, char *buf) 766 + qla2x00_optrom_efi_version_show(struct device *dev, 767 + struct device_attribute *attr, char *buf) 779 768 { 780 - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); 769 + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); 781 770 782 771 return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->efi_revision[1], 783 772 ha->efi_revision[0]); 784 773 } 785 774 786 775 static ssize_t 787 - qla2x00_optrom_fcode_version_show(struct class_device *cdev, char *buf) 776 + qla2x00_optrom_fcode_version_show(struct device *dev, 777 + struct device_attribute *attr, char *buf) 788 778 { 789 - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); 779 + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); 790 780 791 781 return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->fcode_revision[1], 792 782 ha->fcode_revision[0]); 793 783 } 794 784 795 785 static ssize_t 796 - qla2x00_optrom_fw_version_show(struct class_device *cdev, char *buf) 786 + qla2x00_optrom_fw_version_show(struct device *dev, 787 + struct device_attribute *attr, char *buf) 797 788 { 798 - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); 789 + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); 799 790 800 791 return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d %d\n", 801 792 ha->fw_revision[0], ha->fw_revision[1], ha->fw_revision[2], 802 793 ha->fw_revision[3]); 803 794 } 804 795 805 - static CLASS_DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, 806 - NULL); 807 - static CLASS_DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); 808 - static CLASS_DEVICE_ATTR(serial_num, S_IRUGO, qla2x00_serial_num_show, NULL); 809 - static CLASS_DEVICE_ATTR(isp_name, S_IRUGO, qla2x00_isp_name_show, NULL); 810 - static CLASS_DEVICE_ATTR(isp_id, S_IRUGO, qla2x00_isp_id_show, NULL); 811 - static CLASS_DEVICE_ATTR(model_name, S_IRUGO, qla2x00_model_name_show, NULL); 812 - static CLASS_DEVICE_ATTR(model_desc, S_IRUGO, qla2x00_model_desc_show, NULL); 813 - static CLASS_DEVICE_ATTR(pci_info, S_IRUGO, qla2x00_pci_info_show, NULL); 814 - static CLASS_DEVICE_ATTR(state, S_IRUGO, qla2x00_state_show, NULL); 815 - static CLASS_DEVICE_ATTR(zio, S_IRUGO | S_IWUSR, qla2x00_zio_show, 816 - qla2x00_zio_store); 817 - static CLASS_DEVICE_ATTR(zio_timer, S_IRUGO | S_IWUSR, qla2x00_zio_timer_show, 818 - qla2x00_zio_timer_store); 819 - static CLASS_DEVICE_ATTR(beacon, S_IRUGO | S_IWUSR, qla2x00_beacon_show, 820 - qla2x00_beacon_store); 821 - static CLASS_DEVICE_ATTR(optrom_bios_version, S_IRUGO, 822 - qla2x00_optrom_bios_version_show, NULL); 823 - static CLASS_DEVICE_ATTR(optrom_efi_version, S_IRUGO, 824 - qla2x00_optrom_efi_version_show, NULL); 825 - static CLASS_DEVICE_ATTR(optrom_fcode_version, S_IRUGO, 826 - qla2x00_optrom_fcode_version_show, NULL); 827 - static CLASS_DEVICE_ATTR(optrom_fw_version, S_IRUGO, 828 - qla2x00_optrom_fw_version_show, NULL); 796 + static DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, NULL); 797 + static DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); 798 + static DEVICE_ATTR(serial_num, S_IRUGO, qla2x00_serial_num_show, NULL); 799 + static DEVICE_ATTR(isp_name, S_IRUGO, qla2x00_isp_name_show, NULL); 800 + static DEVICE_ATTR(isp_id, S_IRUGO, qla2x00_isp_id_show, NULL); 801 + static DEVICE_ATTR(model_name, S_IRUGO, qla2x00_model_name_show, NULL); 802 + static DEVICE_ATTR(model_desc, S_IRUGO, qla2x00_model_desc_show, NULL); 803 + static DEVICE_ATTR(pci_info, S_IRUGO, qla2x00_pci_info_show, NULL); 804 + static DEVICE_ATTR(state, S_IRUGO, qla2x00_state_show, NULL); 805 + static DEVICE_ATTR(zio, S_IRUGO | S_IWUSR, qla2x00_zio_show, qla2x00_zio_store); 806 + static DEVICE_ATTR(zio_timer, S_IRUGO | S_IWUSR, qla2x00_zio_timer_show, 807 + qla2x00_zio_timer_store); 808 + static DEVICE_ATTR(beacon, S_IRUGO | S_IWUSR, qla2x00_beacon_show, 809 + qla2x00_beacon_store); 810 + static DEVICE_ATTR(optrom_bios_version, S_IRUGO, 811 + qla2x00_optrom_bios_version_show, NULL); 812 + static DEVICE_ATTR(optrom_efi_version, S_IRUGO, 813 + qla2x00_optrom_efi_version_show, NULL); 814 + static DEVICE_ATTR(optrom_fcode_version, S_IRUGO, 815 + qla2x00_optrom_fcode_version_show, NULL); 816 + static DEVICE_ATTR(optrom_fw_version, S_IRUGO, qla2x00_optrom_fw_version_show, 817 + NULL); 829 818 830 - struct class_device_attribute *qla2x00_host_attrs[] = { 831 - &class_device_attr_driver_version, 832 - &class_device_attr_fw_version, 833 - &class_device_attr_serial_num, 834 - &class_device_attr_isp_name, 835 - &class_device_attr_isp_id, 836 - &class_device_attr_model_name, 837 - &class_device_attr_model_desc, 838 - &class_device_attr_pci_info, 839 - &class_device_attr_state, 840 - &class_device_attr_zio, 841 - &class_device_attr_zio_timer, 842 - &class_device_attr_beacon, 843 - &class_device_attr_optrom_bios_version, 844 - &class_device_attr_optrom_efi_version, 845 - &class_device_attr_optrom_fcode_version, 846 - &class_device_attr_optrom_fw_version, 819 + struct device_attribute *qla2x00_host_attrs[] = { 820 + &dev_attr_driver_version, 821 + &dev_attr_fw_version, 822 + &dev_attr_serial_num, 823 + &dev_attr_isp_name, 824 + &dev_attr_isp_id, 825 + &dev_attr_model_name, 826 + &dev_attr_model_desc, 827 + &dev_attr_pci_info, 828 + &dev_attr_state, 829 + &dev_attr_zio, 830 + &dev_attr_zio_timer, 831 + &dev_attr_beacon, 832 + &dev_attr_optrom_bios_version, 833 + &dev_attr_optrom_efi_version, 834 + &dev_attr_optrom_fcode_version, 835 + &dev_attr_optrom_fw_version, 847 836 NULL, 848 837 }; 849 838
+2 -2
drivers/scsi/qla2xxx/qla_gbl.h
··· 347 347 /* 348 348 * Global Function Prototypes in qla_attr.c source file. 349 349 */ 350 - struct class_device_attribute; 351 - extern struct class_device_attribute *qla2x00_host_attrs[]; 350 + struct device_attribute; 351 + extern struct device_attribute *qla2x00_host_attrs[]; 352 352 struct fc_function_template; 353 353 extern struct fc_function_template qla2xxx_transport_functions; 354 354 extern struct fc_function_template qla2xxx_transport_vport_functions;
+37 -36
drivers/scsi/raid_class.c
··· 24 24 struct raid_template r; 25 25 struct raid_function_template *f; 26 26 /* The actual attributes */ 27 - struct class_device_attribute private_attrs[RAID_NUM_ATTRS]; 27 + struct device_attribute private_attrs[RAID_NUM_ATTRS]; 28 28 /* The array of null terminated pointers to attributes 29 29 * needed by scsi_sysfs.c */ 30 - struct class_device_attribute *attrs[RAID_NUM_ATTRS + 1]; 30 + struct device_attribute *attrs[RAID_NUM_ATTRS + 1]; 31 31 }; 32 32 33 33 struct raid_component { 34 34 struct list_head node; 35 - struct class_device cdev; 35 + struct device dev; 36 36 int num; 37 37 }; 38 38 ··· 50 50 tc_to_raid_internal(tc); \ 51 51 }) 52 52 53 - #define class_device_to_raid_internal(cdev) ({ \ 53 + #define device_to_raid_internal(dev) ({ \ 54 54 struct attribute_container *ac = \ 55 - attribute_container_classdev_to_container(cdev); \ 55 + attribute_container_classdev_to_container(dev); \ 56 56 ac_to_raid_internal(ac); \ 57 57 }) 58 58 ··· 76 76 } 77 77 78 78 static int raid_setup(struct transport_container *tc, struct device *dev, 79 - struct class_device *cdev) 79 + struct device *cdev) 80 80 { 81 81 struct raid_data *rd; 82 82 83 - BUG_ON(class_get_devdata(cdev)); 83 + BUG_ON(dev_get_drvdata(cdev)); 84 84 85 85 rd = kzalloc(sizeof(*rd), GFP_KERNEL); 86 86 if (!rd) 87 87 return -ENOMEM; 88 88 89 89 INIT_LIST_HEAD(&rd->component_list); 90 - class_set_devdata(cdev, rd); 90 + dev_set_drvdata(cdev, rd); 91 91 92 92 return 0; 93 93 } 94 94 95 95 static int raid_remove(struct transport_container *tc, struct device *dev, 96 - struct class_device *cdev) 96 + struct device *cdev) 97 97 { 98 - struct raid_data *rd = class_get_devdata(cdev); 98 + struct raid_data *rd = dev_get_drvdata(cdev); 99 99 struct raid_component *rc, *next; 100 100 dev_printk(KERN_ERR, dev, "RAID REMOVE\n"); 101 - class_set_devdata(cdev, NULL); 101 + dev_set_drvdata(cdev, NULL); 102 102 list_for_each_entry_safe(rc, next, &rd->component_list, node) { 103 103 list_del(&rc->node); 104 - dev_printk(KERN_ERR, rc->cdev.dev, "RAID COMPONENT REMOVE\n"); 105 - class_device_unregister(&rc->cdev); 104 + dev_printk(KERN_ERR, rc->dev.parent, "RAID COMPONENT REMOVE\n"); 105 + device_unregister(&rc->dev); 106 106 } 107 107 dev_printk(KERN_ERR, dev, "RAID REMOVE DONE\n"); 108 108 kfree(rd); ··· 171 171 } 172 172 173 173 #define raid_attr_show_internal(attr, fmt, var, code) \ 174 - static ssize_t raid_show_##attr(struct class_device *cdev, char *buf) \ 174 + static ssize_t raid_show_##attr(struct device *dev, \ 175 + struct device_attribute *attr, \ 176 + char *buf) \ 175 177 { \ 176 - struct raid_data *rd = class_get_devdata(cdev); \ 178 + struct raid_data *rd = dev_get_drvdata(dev); \ 177 179 code \ 178 180 return snprintf(buf, 20, #fmt "\n", var); \ 179 181 } ··· 186 184 code \ 187 185 name = raid_##states##_name(rd->attr); \ 188 186 ) \ 189 - static CLASS_DEVICE_ATTR(attr, S_IRUGO, raid_show_##attr, NULL) 187 + static DEVICE_ATTR(attr, S_IRUGO, raid_show_##attr, NULL) 190 188 191 189 192 190 #define raid_attr_ro_internal(attr, code) \ 193 191 raid_attr_show_internal(attr, %d, rd->attr, code) \ 194 - static CLASS_DEVICE_ATTR(attr, S_IRUGO, raid_show_##attr, NULL) 192 + static DEVICE_ATTR(attr, S_IRUGO, raid_show_##attr, NULL) 195 193 196 194 #define ATTR_CODE(attr) \ 197 - struct raid_internal *i = class_device_to_raid_internal(cdev); \ 195 + struct raid_internal *i = device_to_raid_internal(dev); \ 198 196 if (i->f->get_##attr) \ 199 - i->f->get_##attr(cdev->dev); 197 + i->f->get_##attr(dev->parent); 200 198 201 199 #define raid_attr_ro(attr) raid_attr_ro_internal(attr, ) 202 200 #define raid_attr_ro_fn(attr) raid_attr_ro_internal(attr, ATTR_CODE(attr)) ··· 208 206 raid_attr_ro_fn(resync); 209 207 raid_attr_ro_state_fn(state); 210 208 211 - static void raid_component_release(struct class_device *cdev) 209 + static void raid_component_release(struct device *dev) 212 210 { 213 - struct raid_component *rc = container_of(cdev, struct raid_component, 214 - cdev); 215 - dev_printk(KERN_ERR, rc->cdev.dev, "COMPONENT RELEASE\n"); 216 - put_device(rc->cdev.dev); 211 + struct raid_component *rc = 212 + container_of(dev, struct raid_component, dev); 213 + dev_printk(KERN_ERR, rc->dev.parent, "COMPONENT RELEASE\n"); 214 + put_device(rc->dev.parent); 217 215 kfree(rc); 218 216 } 219 217 220 218 int raid_component_add(struct raid_template *r,struct device *raid_dev, 221 219 struct device *component_dev) 222 220 { 223 - struct class_device *cdev = 221 + struct device *cdev = 224 222 attribute_container_find_class_device(&r->raid_attrs.ac, 225 223 raid_dev); 226 224 struct raid_component *rc; 227 - struct raid_data *rd = class_get_devdata(cdev); 225 + struct raid_data *rd = dev_get_drvdata(cdev); 228 226 int err; 229 227 230 228 rc = kzalloc(sizeof(*rc), GFP_KERNEL); ··· 232 230 return -ENOMEM; 233 231 234 232 INIT_LIST_HEAD(&rc->node); 235 - class_device_initialize(&rc->cdev); 236 - rc->cdev.release = raid_component_release; 237 - rc->cdev.dev = get_device(component_dev); 233 + device_initialize(&rc->dev); 234 + rc->dev.release = raid_component_release; 235 + rc->dev.parent = get_device(component_dev); 238 236 rc->num = rd->component_count++; 239 237 240 - snprintf(rc->cdev.class_id, sizeof(rc->cdev.class_id), 238 + snprintf(rc->dev.bus_id, sizeof(rc->dev.bus_id), 241 239 "component-%d", rc->num); 242 240 list_add_tail(&rc->node, &rd->component_list); 243 - rc->cdev.parent = cdev; 244 - rc->cdev.class = &raid_class.class; 245 - err = class_device_add(&rc->cdev); 241 + rc->dev.class = &raid_class.class; 242 + err = device_add(&rc->dev); 246 243 if (err) 247 244 goto err_out; 248 245 ··· 274 273 275 274 attribute_container_register(&i->r.raid_attrs.ac); 276 275 277 - i->attrs[count++] = &class_device_attr_level; 278 - i->attrs[count++] = &class_device_attr_resync; 279 - i->attrs[count++] = &class_device_attr_state; 276 + i->attrs[count++] = &dev_attr_level; 277 + i->attrs[count++] = &dev_attr_resync; 278 + i->attrs[count++] = &dev_attr_state; 280 279 281 280 i->attrs[count] = NULL; 282 281 BUG_ON(count > RAID_NUM_ATTRS);
+12 -12
drivers/scsi/scsi_sas_internal.h
··· 13 13 struct sas_function_template *f; 14 14 struct sas_domain_function_template *dft; 15 15 16 - struct class_device_attribute private_host_attrs[SAS_HOST_ATTRS]; 17 - struct class_device_attribute private_phy_attrs[SAS_PHY_ATTRS]; 18 - struct class_device_attribute private_port_attrs[SAS_PORT_ATTRS]; 19 - struct class_device_attribute private_rphy_attrs[SAS_RPORT_ATTRS]; 20 - struct class_device_attribute private_end_dev_attrs[SAS_END_DEV_ATTRS]; 21 - struct class_device_attribute private_expander_attrs[SAS_EXPANDER_ATTRS]; 16 + struct device_attribute private_host_attrs[SAS_HOST_ATTRS]; 17 + struct device_attribute private_phy_attrs[SAS_PHY_ATTRS]; 18 + struct device_attribute private_port_attrs[SAS_PORT_ATTRS]; 19 + struct device_attribute private_rphy_attrs[SAS_RPORT_ATTRS]; 20 + struct device_attribute private_end_dev_attrs[SAS_END_DEV_ATTRS]; 21 + struct device_attribute private_expander_attrs[SAS_EXPANDER_ATTRS]; 22 22 23 23 struct transport_container phy_attr_cont; 24 24 struct transport_container port_attr_cont; ··· 30 30 * The array of null terminated pointers to attributes 31 31 * needed by scsi_sysfs.c 32 32 */ 33 - struct class_device_attribute *host_attrs[SAS_HOST_ATTRS + 1]; 34 - struct class_device_attribute *phy_attrs[SAS_PHY_ATTRS + 1]; 35 - struct class_device_attribute *port_attrs[SAS_PORT_ATTRS + 1]; 36 - struct class_device_attribute *rphy_attrs[SAS_RPORT_ATTRS + 1]; 37 - struct class_device_attribute *end_dev_attrs[SAS_END_DEV_ATTRS + 1]; 38 - struct class_device_attribute *expander_attrs[SAS_EXPANDER_ATTRS + 1]; 33 + struct device_attribute *host_attrs[SAS_HOST_ATTRS + 1]; 34 + struct device_attribute *phy_attrs[SAS_PHY_ATTRS + 1]; 35 + struct device_attribute *port_attrs[SAS_PORT_ATTRS + 1]; 36 + struct device_attribute *rphy_attrs[SAS_RPORT_ATTRS + 1]; 37 + struct device_attribute *end_dev_attrs[SAS_END_DEV_ATTRS + 1]; 38 + struct device_attribute *expander_attrs[SAS_EXPANDER_ATTRS + 1]; 39 39 }; 40 40 #define to_sas_internal(tmpl) container_of(tmpl, struct sas_internal, t) 41 41
+85 -65
drivers/scsi/scsi_sysfs.c
··· 119 119 */ 120 120 #define shost_show_function(name, field, format_string) \ 121 121 static ssize_t \ 122 - show_##name (struct class_device *class_dev, char *buf) \ 122 + show_##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 126 return snprintf (buf, 20, format_string, shost->field); \ 126 127 } 127 128 ··· 132 131 */ 133 132 #define shost_rd_attr2(name, field, format_string) \ 134 133 shost_show_function(name, field, format_string) \ 135 - static CLASS_DEVICE_ATTR(name, S_IRUGO, show_##name, NULL); 134 + static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL); 136 135 137 136 #define shost_rd_attr(field, format_string) \ 138 137 shost_rd_attr2(field, field, format_string) ··· 141 140 * Create the actual show/store functions and data structures. 142 141 */ 143 142 144 - static ssize_t store_scan(struct class_device *class_dev, const char *buf, 145 - size_t count) 143 + static ssize_t 144 + store_scan(struct device *dev, struct device_attribute *attr, 145 + const char *buf, size_t count) 146 146 { 147 - struct Scsi_Host *shost = class_to_shost(class_dev); 147 + struct Scsi_Host *shost = class_to_shost(dev); 148 148 int res; 149 149 150 150 res = scsi_scan(shost, buf); ··· 153 151 res = count; 154 152 return res; 155 153 }; 156 - static CLASS_DEVICE_ATTR(scan, S_IWUSR, NULL, store_scan); 154 + static DEVICE_ATTR(scan, S_IWUSR, NULL, store_scan); 157 155 158 156 static ssize_t 159 - store_shost_state(struct class_device *class_dev, const char *buf, size_t count) 157 + store_shost_state(struct device *dev, struct device_attribute *attr, 158 + const char *buf, size_t count) 160 159 { 161 160 int i; 162 - struct Scsi_Host *shost = class_to_shost(class_dev); 161 + struct Scsi_Host *shost = class_to_shost(dev); 163 162 enum scsi_host_state state = 0; 164 163 165 164 for (i = 0; i < ARRAY_SIZE(shost_states); i++) { ··· 180 177 } 181 178 182 179 static ssize_t 183 - show_shost_state(struct class_device *class_dev, char *buf) 180 + show_shost_state(struct device *dev, struct device_attribute *attr, char *buf) 184 181 { 185 - struct Scsi_Host *shost = class_to_shost(class_dev); 182 + struct Scsi_Host *shost = class_to_shost(dev); 186 183 const char *name = scsi_host_state_name(shost->shost_state); 187 184 188 185 if (!name) ··· 191 188 return snprintf(buf, 20, "%s\n", name); 192 189 } 193 190 194 - static CLASS_DEVICE_ATTR(state, S_IRUGO | S_IWUSR, show_shost_state, store_shost_state); 191 + /* DEVICE_ATTR(state) clashes with dev_attr_state for sdev */ 192 + struct device_attribute dev_attr_hstate = 193 + __ATTR(state, S_IRUGO | S_IWUSR, show_shost_state, store_shost_state); 195 194 196 195 static ssize_t 197 196 show_shost_mode(unsigned int mode, char *buf) ··· 211 206 return len; 212 207 } 213 208 214 - static ssize_t show_shost_supported_mode(struct class_device *class_dev, char *buf) 209 + static ssize_t 210 + show_shost_supported_mode(struct device *dev, struct device_attribute *attr, 211 + char *buf) 215 212 { 216 - struct Scsi_Host *shost = class_to_shost(class_dev); 213 + struct Scsi_Host *shost = class_to_shost(dev); 217 214 unsigned int supported_mode = shost->hostt->supported_mode; 218 215 219 216 if (supported_mode == MODE_UNKNOWN) ··· 225 218 return show_shost_mode(supported_mode, buf); 226 219 } 227 220 228 - static CLASS_DEVICE_ATTR(supported_mode, S_IRUGO | S_IWUSR, show_shost_supported_mode, NULL); 221 + static DEVICE_ATTR(supported_mode, S_IRUGO | S_IWUSR, show_shost_supported_mode, NULL); 229 222 230 - static ssize_t show_shost_active_mode(struct class_device *class_dev, char *buf) 223 + static ssize_t 224 + show_shost_active_mode(struct device *dev, 225 + struct device_attribute *attr, char *buf) 231 226 { 232 - struct Scsi_Host *shost = class_to_shost(class_dev); 227 + struct Scsi_Host *shost = class_to_shost(dev); 233 228 234 229 if (shost->active_mode == MODE_UNKNOWN) 235 230 return snprintf(buf, 20, "unknown\n"); ··· 239 230 return show_shost_mode(shost->active_mode, buf); 240 231 } 241 232 242 - static CLASS_DEVICE_ATTR(active_mode, S_IRUGO | S_IWUSR, show_shost_active_mode, NULL); 233 + static DEVICE_ATTR(active_mode, S_IRUGO | S_IWUSR, show_shost_active_mode, NULL); 243 234 244 235 shost_rd_attr(unique_id, "%u\n"); 245 236 shost_rd_attr(host_busy, "%hu\n"); ··· 249 240 shost_rd_attr(unchecked_isa_dma, "%d\n"); 250 241 shost_rd_attr2(proc_name, hostt->proc_name, "%s\n"); 251 242 252 - static struct class_device_attribute *scsi_sysfs_shost_attrs[] = { 253 - &class_device_attr_unique_id, 254 - &class_device_attr_host_busy, 255 - &class_device_attr_cmd_per_lun, 256 - &class_device_attr_can_queue, 257 - &class_device_attr_sg_tablesize, 258 - &class_device_attr_unchecked_isa_dma, 259 - &class_device_attr_proc_name, 260 - &class_device_attr_scan, 261 - &class_device_attr_state, 262 - &class_device_attr_supported_mode, 263 - &class_device_attr_active_mode, 243 + static struct device_attribute *scsi_sysfs_shost_attrs[] = { 244 + &dev_attr_unique_id, 245 + &dev_attr_host_busy, 246 + &dev_attr_cmd_per_lun, 247 + &dev_attr_can_queue, 248 + &dev_attr_sg_tablesize, 249 + &dev_attr_unchecked_isa_dma, 250 + &dev_attr_proc_name, 251 + &dev_attr_scan, 252 + &dev_attr_hstate, 253 + &dev_attr_supported_mode, 254 + &dev_attr_active_mode, 264 255 NULL 265 256 }; 266 257 267 - static void scsi_device_cls_release(struct class_device *class_dev) 258 + static void scsi_device_cls_release(struct device *class_dev) 268 259 { 269 260 struct scsi_device *sdev; 270 261 ··· 329 320 330 321 static struct class sdev_class = { 331 322 .name = "scsi_device", 332 - .release = scsi_device_cls_release, 323 + .dev_release = scsi_device_cls_release, 333 324 }; 334 325 335 326 /* all probing is done in the individual ->probe routines */ ··· 433 424 */ 434 425 #define sdev_show_function(field, format_string) \ 435 426 static ssize_t \ 436 - sdev_show_##field (struct device *dev, struct device_attribute *attr, char *buf) \ 427 + sdev_show_##field (struct device *dev, struct device_attribute *attr, \ 428 + char *buf) \ 437 429 { \ 438 430 struct scsi_device *sdev; \ 439 431 sdev = to_scsi_device(dev); \ ··· 458 448 sdev_show_function(field, format_string) \ 459 449 \ 460 450 static ssize_t \ 461 - sdev_store_##field (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ 451 + sdev_store_##field (struct device *dev, struct device_attribute *attr, \ 452 + const char *buf, size_t count) \ 462 453 { \ 463 454 struct scsi_device *sdev; \ 464 455 sdev = to_scsi_device(dev); \ ··· 479 468 sdev_show_function(field, "%d\n") \ 480 469 \ 481 470 static ssize_t \ 482 - sdev_store_##field (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ 471 + sdev_store_##field (struct device *dev, struct device_attribute *attr, \ 472 + const char *buf, size_t count) \ 483 473 { \ 484 474 int ret; \ 485 475 struct scsi_device *sdev; \ ··· 531 519 } 532 520 533 521 static ssize_t 534 - sdev_store_timeout (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 522 + sdev_store_timeout (struct device *dev, struct device_attribute *attr, 523 + const char *buf, size_t count) 535 524 { 536 525 struct scsi_device *sdev; 537 526 int timeout; ··· 544 531 static DEVICE_ATTR(timeout, S_IRUGO | S_IWUSR, sdev_show_timeout, sdev_store_timeout); 545 532 546 533 static ssize_t 547 - store_rescan_field (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 534 + store_rescan_field (struct device *dev, struct device_attribute *attr, 535 + const char *buf, size_t count) 548 536 { 549 537 scsi_rescan_device(dev); 550 538 return count; ··· 557 543 scsi_remove_device(to_scsi_device(dev)); 558 544 } 559 545 560 - static ssize_t sdev_store_delete(struct device *dev, struct device_attribute *attr, const char *buf, 561 - size_t count) 546 + static ssize_t 547 + sdev_store_delete(struct device *dev, struct device_attribute *attr, 548 + const char *buf, size_t count) 562 549 { 563 550 int rc; 564 551 ··· 574 559 static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete); 575 560 576 561 static ssize_t 577 - store_state_field(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 562 + store_state_field(struct device *dev, struct device_attribute *attr, 563 + const char *buf, size_t count) 578 564 { 579 565 int i; 580 566 struct scsi_device *sdev = to_scsi_device(dev); ··· 612 596 static DEVICE_ATTR(state, S_IRUGO | S_IWUSR, show_state_field, store_state_field); 613 597 614 598 static ssize_t 615 - show_queue_type_field(struct device *dev, struct device_attribute *attr, char *buf) 599 + show_queue_type_field(struct device *dev, struct device_attribute *attr, 600 + char *buf) 616 601 { 617 602 struct scsi_device *sdev = to_scsi_device(dev); 618 603 const char *name = "none"; ··· 629 612 static DEVICE_ATTR(queue_type, S_IRUGO, show_queue_type_field, NULL); 630 613 631 614 static ssize_t 632 - show_iostat_counterbits(struct device *dev, struct device_attribute *attr, char *buf) 615 + show_iostat_counterbits(struct device *dev, struct device_attribute *attr, char *buf) 633 616 { 634 617 return snprintf(buf, 20, "%d\n", (int)sizeof(atomic_t) * 8); 635 618 } ··· 638 621 639 622 #define show_sdev_iostat(field) \ 640 623 static ssize_t \ 641 - show_iostat_##field(struct device *dev, struct device_attribute *attr, char *buf) \ 624 + show_iostat_##field(struct device *dev, struct device_attribute *attr, \ 625 + char *buf) \ 642 626 { \ 643 627 struct scsi_device *sdev = to_scsi_device(dev); \ 644 628 unsigned long long count = atomic_read(&sdev->field); \ ··· 663 645 #define DECLARE_EVT_SHOW(name, Cap_name) \ 664 646 static ssize_t \ 665 647 sdev_show_evt_##name(struct device *dev, struct device_attribute *attr, \ 666 - char *buf) \ 648 + char *buf) \ 667 649 { \ 668 650 struct scsi_device *sdev = to_scsi_device(dev); \ 669 651 int val = test_bit(SDEV_EVT_##Cap_name, sdev->supported_events);\ ··· 672 654 673 655 #define DECLARE_EVT_STORE(name, Cap_name) \ 674 656 static ssize_t \ 675 - sdev_store_evt_##name(struct device *dev, struct device_attribute *attr, \ 657 + sdev_store_evt_##name(struct device *dev, struct device_attribute *attr,\ 676 658 const char *buf, size_t count) \ 677 659 { \ 678 660 struct scsi_device *sdev = to_scsi_device(dev); \ ··· 725 707 NULL 726 708 }; 727 709 728 - static ssize_t sdev_store_queue_depth_rw(struct device *dev, struct device_attribute *attr, const char *buf, 729 - size_t count) 710 + static ssize_t 711 + sdev_store_queue_depth_rw(struct device *dev, struct device_attribute *attr, 712 + const char *buf, size_t count) 730 713 { 731 714 int depth, retval; 732 715 struct scsi_device *sdev = to_scsi_device(dev); ··· 752 733 __ATTR(queue_depth, S_IRUGO | S_IWUSR, sdev_show_queue_depth, 753 734 sdev_store_queue_depth_rw); 754 735 755 - static ssize_t sdev_store_queue_type_rw(struct device *dev, struct device_attribute *attr, const char *buf, 756 - size_t count) 736 + static ssize_t 737 + sdev_store_queue_type_rw(struct device *dev, struct device_attribute *attr, 738 + const char *buf, size_t count) 757 739 { 758 740 struct scsi_device *sdev = to_scsi_device(dev); 759 741 struct scsi_host_template *sht = sdev->host->hostt; ··· 806 786 printk(KERN_INFO "error 1\n"); 807 787 return error; 808 788 } 809 - error = class_device_add(&sdev->sdev_classdev); 789 + error = device_add(&sdev->sdev_dev); 810 790 if (error) { 811 791 printk(KERN_INFO "error 2\n"); 812 792 goto clean_device; 813 793 } 814 794 815 - /* take a reference for the sdev_classdev; this is 795 + /* take a reference for the sdev_dev; this is 816 796 * released by the sdev_class .release */ 817 797 get_device(&sdev->sdev_gendev); 818 798 ··· 878 858 return; 879 859 880 860 bsg_unregister_queue(sdev->request_queue); 881 - class_device_unregister(&sdev->sdev_classdev); 861 + device_unregister(&sdev->sdev_dev); 882 862 transport_remove_device(dev); 883 863 device_del(dev); 884 864 scsi_device_set_state(sdev, SDEV_DEL); ··· 972 952 EXPORT_SYMBOL(scsi_register_interface); 973 953 974 954 975 - static struct class_device_attribute *class_attr_overridden( 976 - struct class_device_attribute **attrs, 977 - struct class_device_attribute *attr) 955 + static struct device_attribute *class_attr_overridden( 956 + struct device_attribute **attrs, 957 + struct device_attribute *attr) 978 958 { 979 959 int i; 980 960 ··· 986 966 return NULL; 987 967 } 988 968 989 - static int class_attr_add(struct class_device *classdev, 990 - struct class_device_attribute *attr) 969 + static int class_attr_add(struct device *classdev, 970 + struct device_attribute *attr) 991 971 { 992 - struct class_device_attribute *base_attr; 972 + struct device_attribute *base_attr; 993 973 994 974 /* 995 975 * Spare the caller from having to copy things it's not interested in. ··· 1006 986 attr->store = base_attr->store; 1007 987 } 1008 988 1009 - return class_device_create_file(classdev, attr); 989 + return device_create_file(classdev, attr); 1010 990 } 1011 991 1012 992 /** ··· 1020 1000 1021 1001 if (shost->hostt->shost_attrs) { 1022 1002 for (i = 0; shost->hostt->shost_attrs[i]; i++) { 1023 - error = class_attr_add(&shost->shost_classdev, 1003 + error = class_attr_add(&shost->shost_dev, 1024 1004 shost->hostt->shost_attrs[i]); 1025 1005 if (error) 1026 1006 return error; ··· 1030 1010 for (i = 0; scsi_sysfs_shost_attrs[i]; i++) { 1031 1011 if (!class_attr_overridden(shost->hostt->shost_attrs, 1032 1012 scsi_sysfs_shost_attrs[i])) { 1033 - error = class_device_create_file(&shost->shost_classdev, 1013 + error = device_create_file(&shost->shost_dev, 1034 1014 scsi_sysfs_shost_attrs[i]); 1035 1015 if (error) 1036 1016 return error; ··· 1061 1041 sdev->host->host_no, sdev->channel, sdev->id, 1062 1042 sdev->lun); 1063 1043 1064 - class_device_initialize(&sdev->sdev_classdev); 1065 - sdev->sdev_classdev.dev = &sdev->sdev_gendev; 1066 - sdev->sdev_classdev.class = &sdev_class; 1067 - snprintf(sdev->sdev_classdev.class_id, BUS_ID_SIZE, 1044 + device_initialize(&sdev->sdev_dev); 1045 + sdev->sdev_dev.parent = &sdev->sdev_gendev; 1046 + sdev->sdev_dev.class = &sdev_class; 1047 + snprintf(sdev->sdev_dev.bus_id, BUS_ID_SIZE, 1068 1048 "%d:%d:%d:%d", sdev->host->host_no, 1069 1049 sdev->channel, sdev->id, sdev->lun); 1070 1050 sdev->scsi_level = starget->scsi_level;
+208 -177
drivers/scsi/scsi_transport_fc.c
··· 72 72 * Redefine so that we can have same named attributes in the 73 73 * sdev/starget/host objects. 74 74 */ 75 - #define FC_CLASS_DEVICE_ATTR(_prefix,_name,_mode,_show,_store) \ 76 - struct class_device_attribute class_device_attr_##_prefix##_##_name = \ 75 + #define FC_DEVICE_ATTR(_prefix,_name,_mode,_show,_store) \ 76 + struct device_attribute device_attr_##_prefix##_##_name = \ 77 77 __ATTR(_name,_mode,_show,_store) 78 78 79 79 #define fc_enum_name_search(title, table_type, table) \ ··· 326 326 * part of the midlayer. As the remote port is specific to the 327 327 * fc transport, we must provide the attribute container. 328 328 */ 329 - struct class_device_attribute private_starget_attrs[ 329 + struct device_attribute private_starget_attrs[ 330 330 FC_STARGET_NUM_ATTRS]; 331 - struct class_device_attribute *starget_attrs[FC_STARGET_NUM_ATTRS + 1]; 331 + struct device_attribute *starget_attrs[FC_STARGET_NUM_ATTRS + 1]; 332 332 333 - struct class_device_attribute private_host_attrs[FC_HOST_NUM_ATTRS]; 334 - struct class_device_attribute *host_attrs[FC_HOST_NUM_ATTRS + 1]; 333 + struct device_attribute private_host_attrs[FC_HOST_NUM_ATTRS]; 334 + struct device_attribute *host_attrs[FC_HOST_NUM_ATTRS + 1]; 335 335 336 336 struct transport_container rport_attr_cont; 337 - struct class_device_attribute private_rport_attrs[FC_RPORT_NUM_ATTRS]; 338 - struct class_device_attribute *rport_attrs[FC_RPORT_NUM_ATTRS + 1]; 337 + struct device_attribute private_rport_attrs[FC_RPORT_NUM_ATTRS]; 338 + struct device_attribute *rport_attrs[FC_RPORT_NUM_ATTRS + 1]; 339 339 340 340 struct transport_container vport_attr_cont; 341 - struct class_device_attribute private_vport_attrs[FC_VPORT_NUM_ATTRS]; 342 - struct class_device_attribute *vport_attrs[FC_VPORT_NUM_ATTRS + 1]; 341 + struct device_attribute private_vport_attrs[FC_VPORT_NUM_ATTRS]; 342 + struct device_attribute *vport_attrs[FC_VPORT_NUM_ATTRS + 1]; 343 343 }; 344 344 345 345 #define to_fc_internal(tmpl) container_of(tmpl, struct fc_internal, t) 346 346 347 347 static int fc_target_setup(struct transport_container *tc, struct device *dev, 348 - struct class_device *cdev) 348 + struct device *cdev) 349 349 { 350 350 struct scsi_target *starget = to_scsi_target(dev); 351 351 struct fc_rport *rport = starget_to_rport(starget); ··· 375 375 NULL); 376 376 377 377 static int fc_host_setup(struct transport_container *tc, struct device *dev, 378 - struct class_device *cdev) 378 + struct device *cdev) 379 379 { 380 380 struct Scsi_Host *shost = dev_to_shost(dev); 381 381 struct fc_host_attrs *fc_host = shost_to_fc_host(shost); ··· 682 682 683 683 #define fc_rport_show_function(field, format_string, sz, cast) \ 684 684 static ssize_t \ 685 - show_fc_rport_##field (struct class_device *cdev, char *buf) \ 685 + show_fc_rport_##field (struct device *dev, \ 686 + struct device_attribute *attr, char *buf) \ 686 687 { \ 687 - struct fc_rport *rport = transport_class_to_rport(cdev); \ 688 + struct fc_rport *rport = transport_class_to_rport(dev); \ 688 689 struct Scsi_Host *shost = rport_to_shost(rport); \ 689 690 struct fc_internal *i = to_fc_internal(shost->transportt); \ 690 691 if ((i->f->get_rport_##field) && \ ··· 698 697 699 698 #define fc_rport_store_function(field) \ 700 699 static ssize_t \ 701 - store_fc_rport_##field(struct class_device *cdev, const char *buf, \ 702 - size_t count) \ 700 + store_fc_rport_##field(struct device *dev, \ 701 + struct device_attribute *attr, \ 702 + const char *buf, size_t count) \ 703 703 { \ 704 704 int val; \ 705 - struct fc_rport *rport = transport_class_to_rport(cdev); \ 705 + struct fc_rport *rport = transport_class_to_rport(dev); \ 706 706 struct Scsi_Host *shost = rport_to_shost(rport); \ 707 707 struct fc_internal *i = to_fc_internal(shost->transportt); \ 708 708 char *cp; \ ··· 720 718 721 719 #define fc_rport_rd_attr(field, format_string, sz) \ 722 720 fc_rport_show_function(field, format_string, sz, ) \ 723 - static FC_CLASS_DEVICE_ATTR(rport, field, S_IRUGO, \ 721 + static FC_DEVICE_ATTR(rport, field, S_IRUGO, \ 724 722 show_fc_rport_##field, NULL) 725 723 726 724 #define fc_rport_rd_attr_cast(field, format_string, sz, cast) \ 727 725 fc_rport_show_function(field, format_string, sz, (cast)) \ 728 - static FC_CLASS_DEVICE_ATTR(rport, field, S_IRUGO, \ 726 + static FC_DEVICE_ATTR(rport, field, S_IRUGO, \ 729 727 show_fc_rport_##field, NULL) 730 728 731 729 #define fc_rport_rw_attr(field, format_string, sz) \ 732 730 fc_rport_show_function(field, format_string, sz, ) \ 733 731 fc_rport_store_function(field) \ 734 - static FC_CLASS_DEVICE_ATTR(rport, field, S_IRUGO | S_IWUSR, \ 732 + static FC_DEVICE_ATTR(rport, field, S_IRUGO | S_IWUSR, \ 735 733 show_fc_rport_##field, \ 736 734 store_fc_rport_##field) 737 735 738 736 739 737 #define fc_private_rport_show_function(field, format_string, sz, cast) \ 740 738 static ssize_t \ 741 - show_fc_rport_##field (struct class_device *cdev, char *buf) \ 739 + show_fc_rport_##field (struct device *dev, \ 740 + struct device_attribute *attr, char *buf) \ 742 741 { \ 743 - struct fc_rport *rport = transport_class_to_rport(cdev); \ 742 + struct fc_rport *rport = transport_class_to_rport(dev); \ 744 743 return snprintf(buf, sz, format_string, cast rport->field); \ 745 744 } 746 745 747 746 #define fc_private_rport_rd_attr(field, format_string, sz) \ 748 747 fc_private_rport_show_function(field, format_string, sz, ) \ 749 - static FC_CLASS_DEVICE_ATTR(rport, field, S_IRUGO, \ 748 + static FC_DEVICE_ATTR(rport, field, S_IRUGO, \ 750 749 show_fc_rport_##field, NULL) 751 750 752 751 #define fc_private_rport_rd_attr_cast(field, format_string, sz, cast) \ 753 752 fc_private_rport_show_function(field, format_string, sz, (cast)) \ 754 - static FC_CLASS_DEVICE_ATTR(rport, field, S_IRUGO, \ 753 + static FC_DEVICE_ATTR(rport, field, S_IRUGO, \ 755 754 show_fc_rport_##field, NULL) 756 755 757 756 758 757 #define fc_private_rport_rd_enum_attr(title, maxlen) \ 759 758 static ssize_t \ 760 - show_fc_rport_##title (struct class_device *cdev, char *buf) \ 759 + show_fc_rport_##title (struct device *dev, \ 760 + struct device_attribute *attr, char *buf) \ 761 761 { \ 762 - struct fc_rport *rport = transport_class_to_rport(cdev); \ 762 + struct fc_rport *rport = transport_class_to_rport(dev); \ 763 763 const char *name; \ 764 764 name = get_fc_##title##_name(rport->title); \ 765 765 if (!name) \ 766 766 return -EINVAL; \ 767 767 return snprintf(buf, maxlen, "%s\n", name); \ 768 768 } \ 769 - static FC_CLASS_DEVICE_ATTR(rport, title, S_IRUGO, \ 769 + static FC_DEVICE_ATTR(rport, title, S_IRUGO, \ 770 770 show_fc_rport_##title, NULL) 771 771 772 772 773 773 #define SETUP_RPORT_ATTRIBUTE_RD(field) \ 774 - i->private_rport_attrs[count] = class_device_attr_rport_##field; \ 774 + i->private_rport_attrs[count] = device_attr_rport_##field; \ 775 775 i->private_rport_attrs[count].attr.mode = S_IRUGO; \ 776 776 i->private_rport_attrs[count].store = NULL; \ 777 777 i->rport_attrs[count] = &i->private_rport_attrs[count]; \ ··· 781 777 count++ 782 778 783 779 #define SETUP_PRIVATE_RPORT_ATTRIBUTE_RD(field) \ 784 - i->private_rport_attrs[count] = class_device_attr_rport_##field; \ 780 + i->private_rport_attrs[count] = device_attr_rport_##field; \ 785 781 i->private_rport_attrs[count].attr.mode = S_IRUGO; \ 786 782 i->private_rport_attrs[count].store = NULL; \ 787 783 i->rport_attrs[count] = &i->private_rport_attrs[count]; \ 788 784 count++ 789 785 790 786 #define SETUP_RPORT_ATTRIBUTE_RW(field) \ 791 - i->private_rport_attrs[count] = class_device_attr_rport_##field; \ 787 + i->private_rport_attrs[count] = device_attr_rport_##field; \ 792 788 if (!i->f->set_rport_##field) { \ 793 789 i->private_rport_attrs[count].attr.mode = S_IRUGO; \ 794 790 i->private_rport_attrs[count].store = NULL; \ ··· 799 795 800 796 #define SETUP_PRIVATE_RPORT_ATTRIBUTE_RW(field) \ 801 797 { \ 802 - i->private_rport_attrs[count] = class_device_attr_rport_##field; \ 798 + i->private_rport_attrs[count] = device_attr_rport_##field; \ 803 799 i->rport_attrs[count] = &i->private_rport_attrs[count]; \ 804 800 count++; \ 805 801 } ··· 812 808 fc_private_rport_rd_attr(maxframe_size, "%u bytes\n", 20); 813 809 814 810 static ssize_t 815 - show_fc_rport_supported_classes (struct class_device *cdev, char *buf) 811 + show_fc_rport_supported_classes (struct device *dev, 812 + struct device_attribute *attr, char *buf) 816 813 { 817 - struct fc_rport *rport = transport_class_to_rport(cdev); 814 + struct fc_rport *rport = transport_class_to_rport(dev); 818 815 if (rport->supported_classes == FC_COS_UNSPECIFIED) 819 816 return snprintf(buf, 20, "unspecified\n"); 820 817 return get_fc_cos_names(rport->supported_classes, buf); 821 818 } 822 - static FC_CLASS_DEVICE_ATTR(rport, supported_classes, S_IRUGO, 819 + static FC_DEVICE_ATTR(rport, supported_classes, S_IRUGO, 823 820 show_fc_rport_supported_classes, NULL); 824 821 825 822 /* Dynamic Remote Port Attributes */ ··· 830 825 */ 831 826 fc_rport_show_function(dev_loss_tmo, "%d\n", 20, ) 832 827 static ssize_t 833 - store_fc_rport_dev_loss_tmo(struct class_device *cdev, const char *buf, 834 - size_t count) 828 + store_fc_rport_dev_loss_tmo(struct device *dev, struct device_attribute *attr, 829 + const char *buf, size_t count) 835 830 { 836 831 int val; 837 - struct fc_rport *rport = transport_class_to_rport(cdev); 832 + struct fc_rport *rport = transport_class_to_rport(dev); 838 833 struct Scsi_Host *shost = rport_to_shost(rport); 839 834 struct fc_internal *i = to_fc_internal(shost->transportt); 840 835 char *cp; ··· 849 844 i->f->set_rport_dev_loss_tmo(rport, val); 850 845 return count; 851 846 } 852 - static FC_CLASS_DEVICE_ATTR(rport, dev_loss_tmo, S_IRUGO | S_IWUSR, 847 + static FC_DEVICE_ATTR(rport, dev_loss_tmo, S_IRUGO | S_IWUSR, 853 848 show_fc_rport_dev_loss_tmo, store_fc_rport_dev_loss_tmo); 854 849 855 850 ··· 860 855 fc_private_rport_rd_attr(port_id, "0x%06x\n", 20); 861 856 862 857 static ssize_t 863 - show_fc_rport_roles (struct class_device *cdev, char *buf) 858 + show_fc_rport_roles (struct device *dev, struct device_attribute *attr, 859 + char *buf) 864 860 { 865 - struct fc_rport *rport = transport_class_to_rport(cdev); 861 + struct fc_rport *rport = transport_class_to_rport(dev); 866 862 867 863 /* identify any roles that are port_id specific */ 868 864 if ((rport->port_id != -1) && ··· 889 883 return get_fc_port_roles_names(rport->roles, buf); 890 884 } 891 885 } 892 - static FC_CLASS_DEVICE_ATTR(rport, roles, S_IRUGO, 886 + static FC_DEVICE_ATTR(rport, roles, S_IRUGO, 893 887 show_fc_rport_roles, NULL); 894 888 895 889 fc_private_rport_rd_enum_attr(port_state, FC_PORTSTATE_MAX_NAMELEN); ··· 899 893 * fast_io_fail_tmo attribute 900 894 */ 901 895 static ssize_t 902 - show_fc_rport_fast_io_fail_tmo (struct class_device *cdev, char *buf) 896 + show_fc_rport_fast_io_fail_tmo (struct device *dev, 897 + struct device_attribute *attr, char *buf) 903 898 { 904 - struct fc_rport *rport = transport_class_to_rport(cdev); 899 + struct fc_rport *rport = transport_class_to_rport(dev); 905 900 906 901 if (rport->fast_io_fail_tmo == -1) 907 902 return snprintf(buf, 5, "off\n"); ··· 910 903 } 911 904 912 905 static ssize_t 913 - store_fc_rport_fast_io_fail_tmo(struct class_device *cdev, const char *buf, 914 - size_t count) 906 + store_fc_rport_fast_io_fail_tmo(struct device *dev, 907 + struct device_attribute *attr, const char *buf, 908 + size_t count) 915 909 { 916 910 int val; 917 911 char *cp; 918 - struct fc_rport *rport = transport_class_to_rport(cdev); 912 + struct fc_rport *rport = transport_class_to_rport(dev); 919 913 920 914 if ((rport->port_state == FC_PORTSTATE_BLOCKED) || 921 915 (rport->port_state == FC_PORTSTATE_DELETED) || ··· 933 925 } 934 926 return count; 935 927 } 936 - static FC_CLASS_DEVICE_ATTR(rport, fast_io_fail_tmo, S_IRUGO | S_IWUSR, 928 + static FC_DEVICE_ATTR(rport, fast_io_fail_tmo, S_IRUGO | S_IWUSR, 937 929 show_fc_rport_fast_io_fail_tmo, store_fc_rport_fast_io_fail_tmo); 938 930 939 931 ··· 949 941 */ 950 942 #define fc_starget_show_function(field, format_string, sz, cast) \ 951 943 static ssize_t \ 952 - show_fc_starget_##field (struct class_device *cdev, char *buf) \ 944 + show_fc_starget_##field (struct device *dev, \ 945 + struct device_attribute *attr, char *buf) \ 953 946 { \ 954 - struct scsi_target *starget = transport_class_to_starget(cdev); \ 947 + struct scsi_target *starget = transport_class_to_starget(dev); \ 955 948 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); \ 956 949 struct fc_internal *i = to_fc_internal(shost->transportt); \ 957 950 struct fc_rport *rport = starget_to_rport(starget); \ ··· 966 957 967 958 #define fc_starget_rd_attr(field, format_string, sz) \ 968 959 fc_starget_show_function(field, format_string, sz, ) \ 969 - static FC_CLASS_DEVICE_ATTR(starget, field, S_IRUGO, \ 960 + static FC_DEVICE_ATTR(starget, field, S_IRUGO, \ 970 961 show_fc_starget_##field, NULL) 971 962 972 963 #define fc_starget_rd_attr_cast(field, format_string, sz, cast) \ 973 964 fc_starget_show_function(field, format_string, sz, (cast)) \ 974 - static FC_CLASS_DEVICE_ATTR(starget, field, S_IRUGO, \ 965 + static FC_DEVICE_ATTR(starget, field, S_IRUGO, \ 975 966 show_fc_starget_##field, NULL) 976 967 977 968 #define SETUP_STARGET_ATTRIBUTE_RD(field) \ 978 - i->private_starget_attrs[count] = class_device_attr_starget_##field; \ 969 + i->private_starget_attrs[count] = device_attr_starget_##field; \ 979 970 i->private_starget_attrs[count].attr.mode = S_IRUGO; \ 980 971 i->private_starget_attrs[count].store = NULL; \ 981 972 i->starget_attrs[count] = &i->private_starget_attrs[count]; \ ··· 983 974 count++ 984 975 985 976 #define SETUP_STARGET_ATTRIBUTE_RW(field) \ 986 - i->private_starget_attrs[count] = class_device_attr_starget_##field; \ 977 + i->private_starget_attrs[count] = device_attr_starget_##field; \ 987 978 if (!i->f->set_starget_##field) { \ 988 979 i->private_starget_attrs[count].attr.mode = S_IRUGO; \ 989 980 i->private_starget_attrs[count].store = NULL; \ ··· 1004 995 1005 996 #define fc_vport_show_function(field, format_string, sz, cast) \ 1006 997 static ssize_t \ 1007 - show_fc_vport_##field (struct class_device *cdev, char *buf) \ 998 + show_fc_vport_##field (struct device *dev, \ 999 + struct device_attribute *attr, char *buf) \ 1008 1000 { \ 1009 - struct fc_vport *vport = transport_class_to_vport(cdev); \ 1001 + struct fc_vport *vport = transport_class_to_vport(dev); \ 1010 1002 struct Scsi_Host *shost = vport_to_shost(vport); \ 1011 1003 struct fc_internal *i = to_fc_internal(shost->transportt); \ 1012 1004 if ((i->f->get_vport_##field) && \ ··· 1018 1008 1019 1009 #define fc_vport_store_function(field) \ 1020 1010 static ssize_t \ 1021 - store_fc_vport_##field(struct class_device *cdev, const char *buf, \ 1022 - size_t count) \ 1011 + store_fc_vport_##field(struct device *dev, \ 1012 + struct device_attribute *attr, \ 1013 + const char *buf, size_t count) \ 1023 1014 { \ 1024 1015 int val; \ 1025 - struct fc_vport *vport = transport_class_to_vport(cdev); \ 1016 + struct fc_vport *vport = transport_class_to_vport(dev); \ 1026 1017 struct Scsi_Host *shost = vport_to_shost(vport); \ 1027 1018 struct fc_internal *i = to_fc_internal(shost->transportt); \ 1028 1019 char *cp; \ ··· 1038 1027 1039 1028 #define fc_vport_store_str_function(field, slen) \ 1040 1029 static ssize_t \ 1041 - store_fc_vport_##field(struct class_device *cdev, const char *buf, \ 1042 - size_t count) \ 1030 + store_fc_vport_##field(struct device *dev, \ 1031 + struct device_attribute *attr, \ 1032 + const char *buf, size_t count) \ 1043 1033 { \ 1044 - struct fc_vport *vport = transport_class_to_vport(cdev); \ 1034 + struct fc_vport *vport = transport_class_to_vport(dev); \ 1045 1035 struct Scsi_Host *shost = vport_to_shost(vport); \ 1046 1036 struct fc_internal *i = to_fc_internal(shost->transportt); \ 1047 1037 unsigned int cnt=count; \ ··· 1059 1047 1060 1048 #define fc_vport_rd_attr(field, format_string, sz) \ 1061 1049 fc_vport_show_function(field, format_string, sz, ) \ 1062 - static FC_CLASS_DEVICE_ATTR(vport, field, S_IRUGO, \ 1050 + static FC_DEVICE_ATTR(vport, field, S_IRUGO, \ 1063 1051 show_fc_vport_##field, NULL) 1064 1052 1065 1053 #define fc_vport_rd_attr_cast(field, format_string, sz, cast) \ 1066 1054 fc_vport_show_function(field, format_string, sz, (cast)) \ 1067 - static FC_CLASS_DEVICE_ATTR(vport, field, S_IRUGO, \ 1055 + static FC_DEVICE_ATTR(vport, field, S_IRUGO, \ 1068 1056 show_fc_vport_##field, NULL) 1069 1057 1070 1058 #define fc_vport_rw_attr(field, format_string, sz) \ 1071 1059 fc_vport_show_function(field, format_string, sz, ) \ 1072 1060 fc_vport_store_function(field) \ 1073 - static FC_CLASS_DEVICE_ATTR(vport, field, S_IRUGO | S_IWUSR, \ 1061 + static FC_DEVICE_ATTR(vport, field, S_IRUGO | S_IWUSR, \ 1074 1062 show_fc_vport_##field, \ 1075 1063 store_fc_vport_##field) 1076 1064 1077 1065 #define fc_private_vport_show_function(field, format_string, sz, cast) \ 1078 1066 static ssize_t \ 1079 - show_fc_vport_##field (struct class_device *cdev, char *buf) \ 1067 + show_fc_vport_##field (struct device *dev, \ 1068 + struct device_attribute *attr, char *buf) \ 1080 1069 { \ 1081 - struct fc_vport *vport = transport_class_to_vport(cdev); \ 1070 + struct fc_vport *vport = transport_class_to_vport(dev); \ 1082 1071 return snprintf(buf, sz, format_string, cast vport->field); \ 1083 1072 } 1084 1073 1085 1074 #define fc_private_vport_store_u32_function(field) \ 1086 1075 static ssize_t \ 1087 - store_fc_vport_##field(struct class_device *cdev, const char *buf, \ 1088 - size_t count) \ 1076 + store_fc_vport_##field(struct device *dev, \ 1077 + struct device_attribute *attr, \ 1078 + const char *buf, size_t count) \ 1089 1079 { \ 1090 1080 u32 val; \ 1091 - struct fc_vport *vport = transport_class_to_vport(cdev); \ 1081 + struct fc_vport *vport = transport_class_to_vport(dev); \ 1092 1082 char *cp; \ 1093 1083 if (vport->flags & (FC_VPORT_DEL | FC_VPORT_CREATING)) \ 1094 1084 return -EBUSY; \ ··· 1104 1090 1105 1091 #define fc_private_vport_rd_attr(field, format_string, sz) \ 1106 1092 fc_private_vport_show_function(field, format_string, sz, ) \ 1107 - static FC_CLASS_DEVICE_ATTR(vport, field, S_IRUGO, \ 1093 + static FC_DEVICE_ATTR(vport, field, S_IRUGO, \ 1108 1094 show_fc_vport_##field, NULL) 1109 1095 1110 1096 #define fc_private_vport_rd_attr_cast(field, format_string, sz, cast) \ 1111 1097 fc_private_vport_show_function(field, format_string, sz, (cast)) \ 1112 - static FC_CLASS_DEVICE_ATTR(vport, field, S_IRUGO, \ 1098 + static FC_DEVICE_ATTR(vport, field, S_IRUGO, \ 1113 1099 show_fc_vport_##field, NULL) 1114 1100 1115 1101 #define fc_private_vport_rw_u32_attr(field, format_string, sz) \ 1116 1102 fc_private_vport_show_function(field, format_string, sz, ) \ 1117 1103 fc_private_vport_store_u32_function(field) \ 1118 - static FC_CLASS_DEVICE_ATTR(vport, field, S_IRUGO | S_IWUSR, \ 1104 + static FC_DEVICE_ATTR(vport, field, S_IRUGO | S_IWUSR, \ 1119 1105 show_fc_vport_##field, \ 1120 1106 store_fc_vport_##field) 1121 1107 1122 1108 1123 1109 #define fc_private_vport_rd_enum_attr(title, maxlen) \ 1124 1110 static ssize_t \ 1125 - show_fc_vport_##title (struct class_device *cdev, char *buf) \ 1111 + show_fc_vport_##title (struct device *dev, \ 1112 + struct device_attribute *attr, \ 1113 + char *buf) \ 1126 1114 { \ 1127 - struct fc_vport *vport = transport_class_to_vport(cdev); \ 1115 + struct fc_vport *vport = transport_class_to_vport(dev); \ 1128 1116 const char *name; \ 1129 1117 name = get_fc_##title##_name(vport->title); \ 1130 1118 if (!name) \ 1131 1119 return -EINVAL; \ 1132 1120 return snprintf(buf, maxlen, "%s\n", name); \ 1133 1121 } \ 1134 - static FC_CLASS_DEVICE_ATTR(vport, title, S_IRUGO, \ 1122 + static FC_DEVICE_ATTR(vport, title, S_IRUGO, \ 1135 1123 show_fc_vport_##title, NULL) 1136 1124 1137 1125 1138 1126 #define SETUP_VPORT_ATTRIBUTE_RD(field) \ 1139 - i->private_vport_attrs[count] = class_device_attr_vport_##field; \ 1127 + i->private_vport_attrs[count] = device_attr_vport_##field; \ 1140 1128 i->private_vport_attrs[count].attr.mode = S_IRUGO; \ 1141 1129 i->private_vport_attrs[count].store = NULL; \ 1142 1130 i->vport_attrs[count] = &i->private_vport_attrs[count]; \ ··· 1147 1131 /* NOTE: Above MACRO differs: checks function not show bit */ 1148 1132 1149 1133 #define SETUP_PRIVATE_VPORT_ATTRIBUTE_RD(field) \ 1150 - i->private_vport_attrs[count] = class_device_attr_vport_##field; \ 1134 + i->private_vport_attrs[count] = device_attr_vport_##field; \ 1151 1135 i->private_vport_attrs[count].attr.mode = S_IRUGO; \ 1152 1136 i->private_vport_attrs[count].store = NULL; \ 1153 1137 i->vport_attrs[count] = &i->private_vport_attrs[count]; \ 1154 1138 count++ 1155 1139 1156 1140 #define SETUP_VPORT_ATTRIBUTE_WR(field) \ 1157 - i->private_vport_attrs[count] = class_device_attr_vport_##field; \ 1141 + i->private_vport_attrs[count] = device_attr_vport_##field; \ 1158 1142 i->vport_attrs[count] = &i->private_vport_attrs[count]; \ 1159 1143 if (i->f->field) \ 1160 1144 count++ 1161 1145 /* NOTE: Above MACRO differs: checks function */ 1162 1146 1163 1147 #define SETUP_VPORT_ATTRIBUTE_RW(field) \ 1164 - i->private_vport_attrs[count] = class_device_attr_vport_##field; \ 1148 + i->private_vport_attrs[count] = device_attr_vport_##field; \ 1165 1149 if (!i->f->set_vport_##field) { \ 1166 1150 i->private_vport_attrs[count].attr.mode = S_IRUGO; \ 1167 1151 i->private_vport_attrs[count].store = NULL; \ ··· 1172 1156 1173 1157 #define SETUP_PRIVATE_VPORT_ATTRIBUTE_RW(field) \ 1174 1158 { \ 1175 - i->private_vport_attrs[count] = class_device_attr_vport_##field; \ 1159 + i->private_vport_attrs[count] = device_attr_vport_##field; \ 1176 1160 i->vport_attrs[count] = &i->private_vport_attrs[count]; \ 1177 1161 count++; \ 1178 1162 } ··· 1192 1176 fc_private_vport_rd_attr_cast(port_name, "0x%llx\n", 20, unsigned long long); 1193 1177 1194 1178 static ssize_t 1195 - show_fc_vport_roles (struct class_device *cdev, char *buf) 1179 + show_fc_vport_roles (struct device *dev, struct device_attribute *attr, 1180 + char *buf) 1196 1181 { 1197 - struct fc_vport *vport = transport_class_to_vport(cdev); 1182 + struct fc_vport *vport = transport_class_to_vport(dev); 1198 1183 1199 1184 if (vport->roles == FC_PORT_ROLE_UNKNOWN) 1200 1185 return snprintf(buf, 20, "unknown\n"); 1201 1186 return get_fc_port_roles_names(vport->roles, buf); 1202 1187 } 1203 - static FC_CLASS_DEVICE_ATTR(vport, roles, S_IRUGO, show_fc_vport_roles, NULL); 1188 + static FC_DEVICE_ATTR(vport, roles, S_IRUGO, show_fc_vport_roles, NULL); 1204 1189 1205 1190 fc_private_vport_rd_enum_attr(vport_type, FC_PORTTYPE_MAX_NAMELEN); 1206 1191 1207 1192 fc_private_vport_show_function(symbolic_name, "%s\n", 1208 1193 FC_VPORT_SYMBOLIC_NAMELEN + 1, ) 1209 1194 fc_vport_store_str_function(symbolic_name, FC_VPORT_SYMBOLIC_NAMELEN) 1210 - static FC_CLASS_DEVICE_ATTR(vport, symbolic_name, S_IRUGO | S_IWUSR, 1195 + static FC_DEVICE_ATTR(vport, symbolic_name, S_IRUGO | S_IWUSR, 1211 1196 show_fc_vport_symbolic_name, store_fc_vport_symbolic_name); 1212 1197 1213 1198 static ssize_t 1214 - store_fc_vport_delete(struct class_device *cdev, const char *buf, 1215 - size_t count) 1199 + store_fc_vport_delete(struct device *dev, struct device_attribute *attr, 1200 + const char *buf, size_t count) 1216 1201 { 1217 - struct fc_vport *vport = transport_class_to_vport(cdev); 1202 + struct fc_vport *vport = transport_class_to_vport(dev); 1218 1203 struct Scsi_Host *shost = vport_to_shost(vport); 1219 1204 1220 1205 fc_queue_work(shost, &vport->vport_delete_work); 1221 1206 return count; 1222 1207 } 1223 - static FC_CLASS_DEVICE_ATTR(vport, vport_delete, S_IWUSR, 1208 + static FC_DEVICE_ATTR(vport, vport_delete, S_IWUSR, 1224 1209 NULL, store_fc_vport_delete); 1225 1210 1226 1211 ··· 1230 1213 * Write "1" to disable, write "0" to enable 1231 1214 */ 1232 1215 static ssize_t 1233 - store_fc_vport_disable(struct class_device *cdev, const char *buf, 1216 + store_fc_vport_disable(struct device *dev, struct device_attribute *attr, 1217 + const char *buf, 1234 1218 size_t count) 1235 1219 { 1236 - struct fc_vport *vport = transport_class_to_vport(cdev); 1220 + struct fc_vport *vport = transport_class_to_vport(dev); 1237 1221 struct Scsi_Host *shost = vport_to_shost(vport); 1238 1222 struct fc_internal *i = to_fc_internal(shost->transportt); 1239 1223 int stat; ··· 1254 1236 stat = i->f->vport_disable(vport, ((*buf == '0') ? false : true)); 1255 1237 return stat ? stat : count; 1256 1238 } 1257 - static FC_CLASS_DEVICE_ATTR(vport, vport_disable, S_IWUSR, 1239 + static FC_DEVICE_ATTR(vport, vport_disable, S_IWUSR, 1258 1240 NULL, store_fc_vport_disable); 1259 1241 1260 1242 ··· 1264 1246 1265 1247 #define fc_host_show_function(field, format_string, sz, cast) \ 1266 1248 static ssize_t \ 1267 - show_fc_host_##field (struct class_device *cdev, char *buf) \ 1249 + show_fc_host_##field (struct device *dev, \ 1250 + struct device_attribute *attr, char *buf) \ 1268 1251 { \ 1269 - struct Scsi_Host *shost = transport_class_to_shost(cdev); \ 1252 + struct Scsi_Host *shost = transport_class_to_shost(dev); \ 1270 1253 struct fc_internal *i = to_fc_internal(shost->transportt); \ 1271 1254 if (i->f->get_host_##field) \ 1272 1255 i->f->get_host_##field(shost); \ ··· 1276 1257 1277 1258 #define fc_host_store_function(field) \ 1278 1259 static ssize_t \ 1279 - store_fc_host_##field(struct class_device *cdev, const char *buf, \ 1280 - size_t count) \ 1260 + store_fc_host_##field(struct device *dev, \ 1261 + struct device_attribute *attr, \ 1262 + const char *buf, size_t count) \ 1281 1263 { \ 1282 1264 int val; \ 1283 - struct Scsi_Host *shost = transport_class_to_shost(cdev); \ 1265 + struct Scsi_Host *shost = transport_class_to_shost(dev); \ 1284 1266 struct fc_internal *i = to_fc_internal(shost->transportt); \ 1285 1267 char *cp; \ 1286 1268 \ ··· 1294 1274 1295 1275 #define fc_host_store_str_function(field, slen) \ 1296 1276 static ssize_t \ 1297 - store_fc_host_##field(struct class_device *cdev, const char *buf, \ 1298 - size_t count) \ 1277 + store_fc_host_##field(struct device *dev, \ 1278 + struct device_attribute *attr, \ 1279 + const char *buf, size_t count) \ 1299 1280 { \ 1300 - struct Scsi_Host *shost = transport_class_to_shost(cdev); \ 1281 + struct Scsi_Host *shost = transport_class_to_shost(dev); \ 1301 1282 struct fc_internal *i = to_fc_internal(shost->transportt); \ 1302 1283 unsigned int cnt=count; \ 1303 1284 \ ··· 1314 1293 1315 1294 #define fc_host_rd_attr(field, format_string, sz) \ 1316 1295 fc_host_show_function(field, format_string, sz, ) \ 1317 - static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO, \ 1296 + static FC_DEVICE_ATTR(host, field, S_IRUGO, \ 1318 1297 show_fc_host_##field, NULL) 1319 1298 1320 1299 #define fc_host_rd_attr_cast(field, format_string, sz, cast) \ 1321 1300 fc_host_show_function(field, format_string, sz, (cast)) \ 1322 - static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO, \ 1301 + static FC_DEVICE_ATTR(host, field, S_IRUGO, \ 1323 1302 show_fc_host_##field, NULL) 1324 1303 1325 1304 #define fc_host_rw_attr(field, format_string, sz) \ 1326 1305 fc_host_show_function(field, format_string, sz, ) \ 1327 1306 fc_host_store_function(field) \ 1328 - static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO | S_IWUSR, \ 1307 + static FC_DEVICE_ATTR(host, field, S_IRUGO | S_IWUSR, \ 1329 1308 show_fc_host_##field, \ 1330 1309 store_fc_host_##field) 1331 1310 1332 1311 #define fc_host_rd_enum_attr(title, maxlen) \ 1333 1312 static ssize_t \ 1334 - show_fc_host_##title (struct class_device *cdev, char *buf) \ 1313 + show_fc_host_##title (struct device *dev, \ 1314 + struct device_attribute *attr, char *buf) \ 1335 1315 { \ 1336 - struct Scsi_Host *shost = transport_class_to_shost(cdev); \ 1316 + struct Scsi_Host *shost = transport_class_to_shost(dev); \ 1337 1317 struct fc_internal *i = to_fc_internal(shost->transportt); \ 1338 1318 const char *name; \ 1339 1319 if (i->f->get_host_##title) \ ··· 1344 1322 return -EINVAL; \ 1345 1323 return snprintf(buf, maxlen, "%s\n", name); \ 1346 1324 } \ 1347 - static FC_CLASS_DEVICE_ATTR(host, title, S_IRUGO, show_fc_host_##title, NULL) 1325 + static FC_DEVICE_ATTR(host, title, S_IRUGO, show_fc_host_##title, NULL) 1348 1326 1349 1327 #define SETUP_HOST_ATTRIBUTE_RD(field) \ 1350 - i->private_host_attrs[count] = class_device_attr_host_##field; \ 1328 + i->private_host_attrs[count] = device_attr_host_##field; \ 1351 1329 i->private_host_attrs[count].attr.mode = S_IRUGO; \ 1352 1330 i->private_host_attrs[count].store = NULL; \ 1353 1331 i->host_attrs[count] = &i->private_host_attrs[count]; \ ··· 1355 1333 count++ 1356 1334 1357 1335 #define SETUP_HOST_ATTRIBUTE_RD_NS(field) \ 1358 - i->private_host_attrs[count] = class_device_attr_host_##field; \ 1336 + i->private_host_attrs[count] = device_attr_host_##field; \ 1359 1337 i->private_host_attrs[count].attr.mode = S_IRUGO; \ 1360 1338 i->private_host_attrs[count].store = NULL; \ 1361 1339 i->host_attrs[count] = &i->private_host_attrs[count]; \ 1362 1340 count++ 1363 1341 1364 1342 #define SETUP_HOST_ATTRIBUTE_RW(field) \ 1365 - i->private_host_attrs[count] = class_device_attr_host_##field; \ 1343 + i->private_host_attrs[count] = device_attr_host_##field; \ 1366 1344 if (!i->f->set_host_##field) { \ 1367 1345 i->private_host_attrs[count].attr.mode = S_IRUGO; \ 1368 1346 i->private_host_attrs[count].store = NULL; \ ··· 1374 1352 1375 1353 #define fc_private_host_show_function(field, format_string, sz, cast) \ 1376 1354 static ssize_t \ 1377 - show_fc_host_##field (struct class_device *cdev, char *buf) \ 1355 + show_fc_host_##field (struct device *dev, \ 1356 + struct device_attribute *attr, char *buf) \ 1378 1357 { \ 1379 - struct Scsi_Host *shost = transport_class_to_shost(cdev); \ 1358 + struct Scsi_Host *shost = transport_class_to_shost(dev); \ 1380 1359 return snprintf(buf, sz, format_string, cast fc_host_##field(shost)); \ 1381 1360 } 1382 1361 1383 1362 #define fc_private_host_rd_attr(field, format_string, sz) \ 1384 1363 fc_private_host_show_function(field, format_string, sz, ) \ 1385 - static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO, \ 1364 + static FC_DEVICE_ATTR(host, field, S_IRUGO, \ 1386 1365 show_fc_host_##field, NULL) 1387 1366 1388 1367 #define fc_private_host_rd_attr_cast(field, format_string, sz, cast) \ 1389 1368 fc_private_host_show_function(field, format_string, sz, (cast)) \ 1390 - static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO, \ 1369 + static FC_DEVICE_ATTR(host, field, S_IRUGO, \ 1391 1370 show_fc_host_##field, NULL) 1392 1371 1393 1372 #define SETUP_PRIVATE_HOST_ATTRIBUTE_RD(field) \ 1394 - i->private_host_attrs[count] = class_device_attr_host_##field; \ 1373 + i->private_host_attrs[count] = device_attr_host_##field; \ 1395 1374 i->private_host_attrs[count].attr.mode = S_IRUGO; \ 1396 1375 i->private_host_attrs[count].store = NULL; \ 1397 1376 i->host_attrs[count] = &i->private_host_attrs[count]; \ ··· 1400 1377 1401 1378 #define SETUP_PRIVATE_HOST_ATTRIBUTE_RW(field) \ 1402 1379 { \ 1403 - i->private_host_attrs[count] = class_device_attr_host_##field; \ 1380 + i->private_host_attrs[count] = device_attr_host_##field; \ 1404 1381 i->host_attrs[count] = &i->private_host_attrs[count]; \ 1405 1382 count++; \ 1406 1383 } ··· 1409 1386 /* Fixed Host Attributes */ 1410 1387 1411 1388 static ssize_t 1412 - show_fc_host_supported_classes (struct class_device *cdev, char *buf) 1389 + show_fc_host_supported_classes (struct device *dev, 1390 + struct device_attribute *attr, char *buf) 1413 1391 { 1414 - struct Scsi_Host *shost = transport_class_to_shost(cdev); 1392 + struct Scsi_Host *shost = transport_class_to_shost(dev); 1415 1393 1416 1394 if (fc_host_supported_classes(shost) == FC_COS_UNSPECIFIED) 1417 1395 return snprintf(buf, 20, "unspecified\n"); 1418 1396 1419 1397 return get_fc_cos_names(fc_host_supported_classes(shost), buf); 1420 1398 } 1421 - static FC_CLASS_DEVICE_ATTR(host, supported_classes, S_IRUGO, 1399 + static FC_DEVICE_ATTR(host, supported_classes, S_IRUGO, 1422 1400 show_fc_host_supported_classes, NULL); 1423 1401 1424 1402 static ssize_t 1425 - show_fc_host_supported_fc4s (struct class_device *cdev, char *buf) 1403 + show_fc_host_supported_fc4s (struct device *dev, 1404 + struct device_attribute *attr, char *buf) 1426 1405 { 1427 - struct Scsi_Host *shost = transport_class_to_shost(cdev); 1406 + struct Scsi_Host *shost = transport_class_to_shost(dev); 1428 1407 return (ssize_t)show_fc_fc4s(buf, fc_host_supported_fc4s(shost)); 1429 1408 } 1430 - static FC_CLASS_DEVICE_ATTR(host, supported_fc4s, S_IRUGO, 1409 + static FC_DEVICE_ATTR(host, supported_fc4s, S_IRUGO, 1431 1410 show_fc_host_supported_fc4s, NULL); 1432 1411 1433 1412 static ssize_t 1434 - show_fc_host_supported_speeds (struct class_device *cdev, char *buf) 1413 + show_fc_host_supported_speeds (struct device *dev, 1414 + struct device_attribute *attr, char *buf) 1435 1415 { 1436 - struct Scsi_Host *shost = transport_class_to_shost(cdev); 1416 + struct Scsi_Host *shost = transport_class_to_shost(dev); 1437 1417 1438 1418 if (fc_host_supported_speeds(shost) == FC_PORTSPEED_UNKNOWN) 1439 1419 return snprintf(buf, 20, "unknown\n"); 1440 1420 1441 1421 return get_fc_port_speed_names(fc_host_supported_speeds(shost), buf); 1442 1422 } 1443 - static FC_CLASS_DEVICE_ATTR(host, supported_speeds, S_IRUGO, 1423 + static FC_DEVICE_ATTR(host, supported_speeds, S_IRUGO, 1444 1424 show_fc_host_supported_speeds, NULL); 1445 1425 1446 1426 ··· 1459 1433 /* Dynamic Host Attributes */ 1460 1434 1461 1435 static ssize_t 1462 - show_fc_host_active_fc4s (struct class_device *cdev, char *buf) 1436 + show_fc_host_active_fc4s (struct device *dev, 1437 + struct device_attribute *attr, char *buf) 1463 1438 { 1464 - struct Scsi_Host *shost = transport_class_to_shost(cdev); 1439 + struct Scsi_Host *shost = transport_class_to_shost(dev); 1465 1440 struct fc_internal *i = to_fc_internal(shost->transportt); 1466 1441 1467 1442 if (i->f->get_host_active_fc4s) ··· 1470 1443 1471 1444 return (ssize_t)show_fc_fc4s(buf, fc_host_active_fc4s(shost)); 1472 1445 } 1473 - static FC_CLASS_DEVICE_ATTR(host, active_fc4s, S_IRUGO, 1446 + static FC_DEVICE_ATTR(host, active_fc4s, S_IRUGO, 1474 1447 show_fc_host_active_fc4s, NULL); 1475 1448 1476 1449 static ssize_t 1477 - show_fc_host_speed (struct class_device *cdev, char *buf) 1450 + show_fc_host_speed (struct device *dev, 1451 + struct device_attribute *attr, char *buf) 1478 1452 { 1479 - struct Scsi_Host *shost = transport_class_to_shost(cdev); 1453 + struct Scsi_Host *shost = transport_class_to_shost(dev); 1480 1454 struct fc_internal *i = to_fc_internal(shost->transportt); 1481 1455 1482 1456 if (i->f->get_host_speed) ··· 1488 1460 1489 1461 return get_fc_port_speed_names(fc_host_speed(shost), buf); 1490 1462 } 1491 - static FC_CLASS_DEVICE_ATTR(host, speed, S_IRUGO, 1463 + static FC_DEVICE_ATTR(host, speed, S_IRUGO, 1492 1464 show_fc_host_speed, NULL); 1493 1465 1494 1466 ··· 1501 1473 fc_private_host_show_function(system_hostname, "%s\n", 1502 1474 FC_SYMBOLIC_NAME_SIZE + 1, ) 1503 1475 fc_host_store_str_function(system_hostname, FC_SYMBOLIC_NAME_SIZE) 1504 - static FC_CLASS_DEVICE_ATTR(host, system_hostname, S_IRUGO | S_IWUSR, 1476 + static FC_DEVICE_ATTR(host, system_hostname, S_IRUGO | S_IWUSR, 1505 1477 show_fc_host_system_hostname, store_fc_host_system_hostname); 1506 1478 1507 1479 1508 1480 /* Private Host Attributes */ 1509 1481 1510 1482 static ssize_t 1511 - show_fc_private_host_tgtid_bind_type(struct class_device *cdev, char *buf) 1483 + show_fc_private_host_tgtid_bind_type(struct device *dev, 1484 + struct device_attribute *attr, char *buf) 1512 1485 { 1513 - struct Scsi_Host *shost = transport_class_to_shost(cdev); 1486 + struct Scsi_Host *shost = transport_class_to_shost(dev); 1514 1487 const char *name; 1515 1488 1516 1489 name = get_fc_tgtid_bind_type_name(fc_host_tgtid_bind_type(shost)); ··· 1524 1495 pos = list_entry((head)->next, typeof(*pos), member) 1525 1496 1526 1497 static ssize_t 1527 - store_fc_private_host_tgtid_bind_type(struct class_device *cdev, 1528 - const char *buf, size_t count) 1498 + store_fc_private_host_tgtid_bind_type(struct device *dev, 1499 + struct device_attribute *attr, const char *buf, size_t count) 1529 1500 { 1530 - struct Scsi_Host *shost = transport_class_to_shost(cdev); 1501 + struct Scsi_Host *shost = transport_class_to_shost(dev); 1531 1502 struct fc_rport *rport; 1532 1503 enum fc_tgtid_binding_type val; 1533 1504 unsigned long flags; ··· 1552 1523 return count; 1553 1524 } 1554 1525 1555 - static FC_CLASS_DEVICE_ATTR(host, tgtid_bind_type, S_IRUGO | S_IWUSR, 1526 + static FC_DEVICE_ATTR(host, tgtid_bind_type, S_IRUGO | S_IWUSR, 1556 1527 show_fc_private_host_tgtid_bind_type, 1557 1528 store_fc_private_host_tgtid_bind_type); 1558 1529 1559 1530 static ssize_t 1560 - store_fc_private_host_issue_lip(struct class_device *cdev, 1561 - const char *buf, size_t count) 1531 + store_fc_private_host_issue_lip(struct device *dev, 1532 + struct device_attribute *attr, const char *buf, size_t count) 1562 1533 { 1563 - struct Scsi_Host *shost = transport_class_to_shost(cdev); 1534 + struct Scsi_Host *shost = transport_class_to_shost(dev); 1564 1535 struct fc_internal *i = to_fc_internal(shost->transportt); 1565 1536 int ret; 1566 1537 ··· 1573 1544 return -ENOENT; 1574 1545 } 1575 1546 1576 - static FC_CLASS_DEVICE_ATTR(host, issue_lip, S_IWUSR, NULL, 1547 + static FC_DEVICE_ATTR(host, issue_lip, S_IWUSR, NULL, 1577 1548 store_fc_private_host_issue_lip); 1578 1549 1579 1550 fc_private_host_rd_attr(npiv_vports_inuse, "%u\n", 20); ··· 1585 1556 1586 1557 /* Show a given an attribute in the statistics group */ 1587 1558 static ssize_t 1588 - fc_stat_show(const struct class_device *cdev, char *buf, unsigned long offset) 1559 + fc_stat_show(const struct device *dev, char *buf, unsigned long offset) 1589 1560 { 1590 - struct Scsi_Host *shost = transport_class_to_shost(cdev); 1561 + struct Scsi_Host *shost = transport_class_to_shost(dev); 1591 1562 struct fc_internal *i = to_fc_internal(shost->transportt); 1592 1563 struct fc_host_statistics *stats; 1593 1564 ssize_t ret = -ENOENT; ··· 1608 1579 1609 1580 /* generate a read-only statistics attribute */ 1610 1581 #define fc_host_statistic(name) \ 1611 - static ssize_t show_fcstat_##name(struct class_device *cd, char *buf) \ 1582 + static ssize_t show_fcstat_##name(struct device *cd, \ 1583 + struct device_attribute *attr, \ 1584 + char *buf) \ 1612 1585 { \ 1613 1586 return fc_stat_show(cd, buf, \ 1614 1587 offsetof(struct fc_host_statistics, name)); \ 1615 1588 } \ 1616 - static FC_CLASS_DEVICE_ATTR(host, name, S_IRUGO, show_fcstat_##name, NULL) 1589 + static FC_DEVICE_ATTR(host, name, S_IRUGO, show_fcstat_##name, NULL) 1617 1590 1618 1591 fc_host_statistic(seconds_since_last_reset); 1619 1592 fc_host_statistic(tx_frames); ··· 1639 1608 fc_host_statistic(fcp_output_megabytes); 1640 1609 1641 1610 static ssize_t 1642 - fc_reset_statistics(struct class_device *cdev, const char *buf, 1643 - size_t count) 1611 + fc_reset_statistics(struct device *dev, struct device_attribute *attr, 1612 + const char *buf, size_t count) 1644 1613 { 1645 - struct Scsi_Host *shost = transport_class_to_shost(cdev); 1614 + struct Scsi_Host *shost = transport_class_to_shost(dev); 1646 1615 struct fc_internal *i = to_fc_internal(shost->transportt); 1647 1616 1648 1617 /* ignore any data value written to the attribute */ ··· 1653 1622 1654 1623 return -ENOENT; 1655 1624 } 1656 - static FC_CLASS_DEVICE_ATTR(host, reset_statistics, S_IWUSR, NULL, 1625 + static FC_DEVICE_ATTR(host, reset_statistics, S_IWUSR, NULL, 1657 1626 fc_reset_statistics); 1658 1627 1659 1628 static struct attribute *fc_statistics_attrs[] = { 1660 - &class_device_attr_host_seconds_since_last_reset.attr, 1661 - &class_device_attr_host_tx_frames.attr, 1662 - &class_device_attr_host_tx_words.attr, 1663 - &class_device_attr_host_rx_frames.attr, 1664 - &class_device_attr_host_rx_words.attr, 1665 - &class_device_attr_host_lip_count.attr, 1666 - &class_device_attr_host_nos_count.attr, 1667 - &class_device_attr_host_error_frames.attr, 1668 - &class_device_attr_host_dumped_frames.attr, 1669 - &class_device_attr_host_link_failure_count.attr, 1670 - &class_device_attr_host_loss_of_sync_count.attr, 1671 - &class_device_attr_host_loss_of_signal_count.attr, 1672 - &class_device_attr_host_prim_seq_protocol_err_count.attr, 1673 - &class_device_attr_host_invalid_tx_word_count.attr, 1674 - &class_device_attr_host_invalid_crc_count.attr, 1675 - &class_device_attr_host_fcp_input_requests.attr, 1676 - &class_device_attr_host_fcp_output_requests.attr, 1677 - &class_device_attr_host_fcp_control_requests.attr, 1678 - &class_device_attr_host_fcp_input_megabytes.attr, 1679 - &class_device_attr_host_fcp_output_megabytes.attr, 1680 - &class_device_attr_host_reset_statistics.attr, 1629 + &device_attr_host_seconds_since_last_reset.attr, 1630 + &device_attr_host_tx_frames.attr, 1631 + &device_attr_host_tx_words.attr, 1632 + &device_attr_host_rx_frames.attr, 1633 + &device_attr_host_rx_words.attr, 1634 + &device_attr_host_lip_count.attr, 1635 + &device_attr_host_nos_count.attr, 1636 + &device_attr_host_error_frames.attr, 1637 + &device_attr_host_dumped_frames.attr, 1638 + &device_attr_host_link_failure_count.attr, 1639 + &device_attr_host_loss_of_sync_count.attr, 1640 + &device_attr_host_loss_of_signal_count.attr, 1641 + &device_attr_host_prim_seq_protocol_err_count.attr, 1642 + &device_attr_host_invalid_tx_word_count.attr, 1643 + &device_attr_host_invalid_crc_count.attr, 1644 + &device_attr_host_fcp_input_requests.attr, 1645 + &device_attr_host_fcp_output_requests.attr, 1646 + &device_attr_host_fcp_control_requests.attr, 1647 + &device_attr_host_fcp_input_megabytes.attr, 1648 + &device_attr_host_fcp_output_megabytes.attr, 1649 + &device_attr_host_reset_statistics.attr, 1681 1650 NULL 1682 1651 }; 1683 1652 ··· 1726 1695 * as hex characters, and may *not* contain any prefixes (e.g. 0x, x, etc) 1727 1696 */ 1728 1697 static ssize_t 1729 - store_fc_host_vport_create(struct class_device *cdev, const char *buf, 1730 - size_t count) 1698 + store_fc_host_vport_create(struct device *dev, struct device_attribute *attr, 1699 + const char *buf, size_t count) 1731 1700 { 1732 - struct Scsi_Host *shost = transport_class_to_shost(cdev); 1701 + struct Scsi_Host *shost = transport_class_to_shost(dev); 1733 1702 struct fc_vport_identifiers vid; 1734 1703 struct fc_vport *vport; 1735 1704 unsigned int cnt=count; ··· 1762 1731 stat = fc_vport_create(shost, 0, &shost->shost_gendev, &vid, &vport); 1763 1732 return stat ? stat : count; 1764 1733 } 1765 - static FC_CLASS_DEVICE_ATTR(host, vport_create, S_IWUSR, NULL, 1734 + static FC_DEVICE_ATTR(host, vport_create, S_IWUSR, NULL, 1766 1735 store_fc_host_vport_create); 1767 1736 1768 1737 ··· 1773 1742 * any prefixes (e.g. 0x, x, etc) 1774 1743 */ 1775 1744 static ssize_t 1776 - store_fc_host_vport_delete(struct class_device *cdev, const char *buf, 1777 - size_t count) 1745 + store_fc_host_vport_delete(struct device *dev, struct device_attribute *attr, 1746 + const char *buf, size_t count) 1778 1747 { 1779 - struct Scsi_Host *shost = transport_class_to_shost(cdev); 1748 + struct Scsi_Host *shost = transport_class_to_shost(dev); 1780 1749 struct fc_host_attrs *fc_host = shost_to_fc_host(shost); 1781 1750 struct fc_vport *vport; 1782 1751 u64 wwpn, wwnn; ··· 1818 1787 stat = fc_vport_terminate(vport); 1819 1788 return stat ? stat : count; 1820 1789 } 1821 - static FC_CLASS_DEVICE_ATTR(host, vport_delete, S_IWUSR, NULL, 1790 + static FC_DEVICE_ATTR(host, vport_delete, S_IWUSR, NULL, 1822 1791 store_fc_host_vport_delete); 1823 1792 1824 1793
+55 -52
drivers/scsi/scsi_transport_iscsi.c
··· 40 40 struct scsi_transport_template t; 41 41 struct iscsi_transport *iscsi_transport; 42 42 struct list_head list; 43 - struct class_device cdev; 43 + struct device dev; 44 44 45 - struct class_device_attribute *host_attrs[ISCSI_HOST_ATTRS + 1]; 45 + struct device_attribute *host_attrs[ISCSI_HOST_ATTRS + 1]; 46 46 struct transport_container conn_cont; 47 - struct class_device_attribute *conn_attrs[ISCSI_CONN_ATTRS + 1]; 47 + struct device_attribute *conn_attrs[ISCSI_CONN_ATTRS + 1]; 48 48 struct transport_container session_cont; 49 - struct class_device_attribute *session_attrs[ISCSI_SESSION_ATTRS + 1]; 49 + struct device_attribute *session_attrs[ISCSI_SESSION_ATTRS + 1]; 50 50 }; 51 51 52 52 static atomic_t iscsi_session_nr; /* sysfs session id for next new session */ ··· 63 63 #define to_iscsi_internal(tmpl) \ 64 64 container_of(tmpl, struct iscsi_internal, t) 65 65 66 - #define cdev_to_iscsi_internal(_cdev) \ 67 - container_of(_cdev, struct iscsi_internal, cdev) 66 + #define dev_to_iscsi_internal(_dev) \ 67 + container_of(_dev, struct iscsi_internal, dev) 68 68 69 - static void iscsi_transport_release(struct class_device *cdev) 69 + static void iscsi_transport_release(struct device *dev) 70 70 { 71 - struct iscsi_internal *priv = cdev_to_iscsi_internal(cdev); 71 + struct iscsi_internal *priv = dev_to_iscsi_internal(dev); 72 72 kfree(priv); 73 73 } 74 74 ··· 78 78 */ 79 79 static struct class iscsi_transport_class = { 80 80 .name = "iscsi_transport", 81 - .release = iscsi_transport_release, 81 + .dev_release = iscsi_transport_release, 82 82 }; 83 83 84 84 static ssize_t 85 - show_transport_handle(struct class_device *cdev, char *buf) 85 + show_transport_handle(struct device *dev, struct device_attribute *attr, 86 + char *buf) 86 87 { 87 - struct iscsi_internal *priv = cdev_to_iscsi_internal(cdev); 88 + struct iscsi_internal *priv = dev_to_iscsi_internal(dev); 88 89 return sprintf(buf, "%llu\n", (unsigned long long)iscsi_handle(priv->iscsi_transport)); 89 90 } 90 - static CLASS_DEVICE_ATTR(handle, S_IRUGO, show_transport_handle, NULL); 91 + static DEVICE_ATTR(handle, S_IRUGO, show_transport_handle, NULL); 91 92 92 93 #define show_transport_attr(name, format) \ 93 94 static ssize_t \ 94 - show_transport_##name(struct class_device *cdev, char *buf) \ 95 + show_transport_##name(struct device *dev, \ 96 + struct device_attribute *attr,char *buf) \ 95 97 { \ 96 - struct iscsi_internal *priv = cdev_to_iscsi_internal(cdev); \ 98 + struct iscsi_internal *priv = dev_to_iscsi_internal(dev); \ 97 99 return sprintf(buf, format"\n", priv->iscsi_transport->name); \ 98 100 } \ 99 - static CLASS_DEVICE_ATTR(name, S_IRUGO, show_transport_##name, NULL); 101 + static DEVICE_ATTR(name, S_IRUGO, show_transport_##name, NULL); 100 102 101 103 show_transport_attr(caps, "0x%x"); 102 104 show_transport_attr(max_lun, "%d"); ··· 106 104 show_transport_attr(max_cmd_len, "%d"); 107 105 108 106 static struct attribute *iscsi_transport_attrs[] = { 109 - &class_device_attr_handle.attr, 110 - &class_device_attr_caps.attr, 111 - &class_device_attr_max_lun.attr, 112 - &class_device_attr_max_conn.attr, 113 - &class_device_attr_max_cmd_len.attr, 107 + &dev_attr_handle.attr, 108 + &dev_attr_caps.attr, 109 + &dev_attr_max_lun.attr, 110 + &dev_attr_max_conn.attr, 111 + &dev_attr_max_cmd_len.attr, 114 112 NULL, 115 113 }; 116 114 ··· 121 119 122 120 123 121 static int iscsi_setup_host(struct transport_container *tc, struct device *dev, 124 - struct class_device *cdev) 122 + struct device *cdev) 125 123 { 126 124 struct Scsi_Host *shost = dev_to_shost(dev); 127 125 struct iscsi_host *ihost = shost->shost_data; ··· 141 139 } 142 140 143 141 static int iscsi_remove_host(struct transport_container *tc, struct device *dev, 144 - struct class_device *cdev) 142 + struct device *cdev) 145 143 { 146 144 struct Scsi_Host *shost = dev_to_shost(dev); 147 145 struct iscsi_host *ihost = shost->shost_data; ··· 1339 1337 mutex_unlock(&rx_queue_mutex); 1340 1338 } 1341 1339 1342 - #define iscsi_cdev_to_conn(_cdev) \ 1343 - iscsi_dev_to_conn(_cdev->dev) 1344 - 1345 1340 #define ISCSI_CLASS_ATTR(_prefix,_name,_mode,_show,_store) \ 1346 - struct class_device_attribute class_device_attr_##_prefix##_##_name = \ 1341 + struct device_attribute dev_attr_##_prefix##_##_name = \ 1347 1342 __ATTR(_name,_mode,_show,_store) 1348 1343 1349 1344 /* ··· 1348 1349 */ 1349 1350 #define iscsi_conn_attr_show(param) \ 1350 1351 static ssize_t \ 1351 - show_conn_param_##param(struct class_device *cdev, char *buf) \ 1352 + show_conn_param_##param(struct device *dev, \ 1353 + struct device_attribute *attr, char *buf) \ 1352 1354 { \ 1353 - struct iscsi_cls_conn *conn = iscsi_cdev_to_conn(cdev); \ 1355 + struct iscsi_cls_conn *conn = iscsi_dev_to_conn(dev->parent); \ 1354 1356 struct iscsi_transport *t = conn->transport; \ 1355 1357 return t->get_conn_param(conn, param, buf); \ 1356 1358 } ··· 1375 1375 iscsi_conn_attr(ping_tmo, ISCSI_PARAM_PING_TMO); 1376 1376 iscsi_conn_attr(recv_tmo, ISCSI_PARAM_RECV_TMO); 1377 1377 1378 - #define iscsi_cdev_to_session(_cdev) \ 1379 - iscsi_dev_to_session(_cdev->dev) 1380 - 1381 1378 /* 1382 1379 * iSCSI session attrs 1383 1380 */ 1384 1381 #define iscsi_session_attr_show(param, perm) \ 1385 1382 static ssize_t \ 1386 - show_session_param_##param(struct class_device *cdev, char *buf) \ 1383 + show_session_param_##param(struct device *dev, \ 1384 + struct device_attribute *attr, char *buf) \ 1387 1385 { \ 1388 - struct iscsi_cls_session *session = iscsi_cdev_to_session(cdev); \ 1386 + struct iscsi_cls_session *session = \ 1387 + iscsi_dev_to_session(dev->parent); \ 1389 1388 struct iscsi_transport *t = session->transport; \ 1390 1389 \ 1391 1390 if (perm && !capable(CAP_SYS_ADMIN)) \ ··· 1416 1417 iscsi_session_attr(lu_reset_tmo, ISCSI_PARAM_LU_RESET_TMO, 0); 1417 1418 1418 1419 static ssize_t 1419 - show_priv_session_state(struct class_device *cdev, char *buf) 1420 + show_priv_session_state(struct device *dev, struct device_attribute *attr, 1421 + char *buf) 1420 1422 { 1421 - struct iscsi_cls_session *session = iscsi_cdev_to_session(cdev); 1423 + struct iscsi_cls_session *session = iscsi_dev_to_session(dev->parent); 1422 1424 return sprintf(buf, "%s\n", iscsi_session_state_name(session->state)); 1423 1425 } 1424 1426 static ISCSI_CLASS_ATTR(priv_sess, state, S_IRUGO, show_priv_session_state, ··· 1427 1427 1428 1428 #define iscsi_priv_session_attr_show(field, format) \ 1429 1429 static ssize_t \ 1430 - show_priv_session_##field(struct class_device *cdev, char *buf) \ 1430 + show_priv_session_##field(struct device *dev, \ 1431 + struct device_attribute *attr, char *buf) \ 1431 1432 { \ 1432 - struct iscsi_cls_session *session = iscsi_cdev_to_session(cdev);\ 1433 + struct iscsi_cls_session *session = \ 1434 + iscsi_dev_to_session(dev->parent); \ 1433 1435 return sprintf(buf, format"\n", session->field); \ 1434 1436 } 1435 1437 ··· 1446 1444 */ 1447 1445 #define iscsi_host_attr_show(param) \ 1448 1446 static ssize_t \ 1449 - show_host_param_##param(struct class_device *cdev, char *buf) \ 1447 + show_host_param_##param(struct device *dev, \ 1448 + struct device_attribute *attr, char *buf) \ 1450 1449 { \ 1451 - struct Scsi_Host *shost = transport_class_to_shost(cdev); \ 1450 + struct Scsi_Host *shost = transport_class_to_shost(dev); \ 1452 1451 struct iscsi_internal *priv = to_iscsi_internal(shost->transportt); \ 1453 1452 return priv->iscsi_transport->get_host_param(shost, param, buf); \ 1454 1453 } ··· 1466 1463 1467 1464 #define SETUP_PRIV_SESSION_RD_ATTR(field) \ 1468 1465 do { \ 1469 - priv->session_attrs[count] = &class_device_attr_priv_sess_##field; \ 1466 + priv->session_attrs[count] = &dev_attr_priv_sess_##field; \ 1470 1467 count++; \ 1471 1468 } while (0) 1472 1469 ··· 1474 1471 #define SETUP_SESSION_RD_ATTR(field, param_flag) \ 1475 1472 do { \ 1476 1473 if (tt->param_mask & param_flag) { \ 1477 - priv->session_attrs[count] = &class_device_attr_sess_##field; \ 1474 + priv->session_attrs[count] = &dev_attr_sess_##field; \ 1478 1475 count++; \ 1479 1476 } \ 1480 1477 } while (0) ··· 1482 1479 #define SETUP_CONN_RD_ATTR(field, param_flag) \ 1483 1480 do { \ 1484 1481 if (tt->param_mask & param_flag) { \ 1485 - priv->conn_attrs[count] = &class_device_attr_conn_##field; \ 1482 + priv->conn_attrs[count] = &dev_attr_conn_##field; \ 1486 1483 count++; \ 1487 1484 } \ 1488 1485 } while (0) ··· 1490 1487 #define SETUP_HOST_RD_ATTR(field, param_flag) \ 1491 1488 do { \ 1492 1489 if (tt->host_param_mask & param_flag) { \ 1493 - priv->host_attrs[count] = &class_device_attr_host_##field; \ 1490 + priv->host_attrs[count] = &dev_attr_host_##field; \ 1494 1491 count++; \ 1495 1492 } \ 1496 1493 } while (0) ··· 1581 1578 priv->iscsi_transport = tt; 1582 1579 priv->t.user_scan = iscsi_user_scan; 1583 1580 1584 - priv->cdev.class = &iscsi_transport_class; 1585 - snprintf(priv->cdev.class_id, BUS_ID_SIZE, "%s", tt->name); 1586 - err = class_device_register(&priv->cdev); 1581 + priv->dev.class = &iscsi_transport_class; 1582 + snprintf(priv->dev.bus_id, BUS_ID_SIZE, "%s", tt->name); 1583 + err = device_register(&priv->dev); 1587 1584 if (err) 1588 1585 goto free_priv; 1589 1586 1590 - err = sysfs_create_group(&priv->cdev.kobj, &iscsi_transport_group); 1587 + err = sysfs_create_group(&priv->dev.kobj, &iscsi_transport_group); 1591 1588 if (err) 1592 - goto unregister_cdev; 1589 + goto unregister_dev; 1593 1590 1594 1591 /* host parameters */ 1595 1592 priv->t.host_attrs.ac.attrs = &priv->host_attrs[0]; ··· 1666 1663 printk(KERN_NOTICE "iscsi: registered transport (%s)\n", tt->name); 1667 1664 return &priv->t; 1668 1665 1669 - unregister_cdev: 1670 - class_device_unregister(&priv->cdev); 1666 + unregister_dev: 1667 + device_unregister(&priv->dev); 1671 1668 free_priv: 1672 1669 kfree(priv); 1673 1670 return NULL; ··· 1694 1691 transport_container_unregister(&priv->session_cont); 1695 1692 transport_container_unregister(&priv->t.host_attrs); 1696 1693 1697 - sysfs_remove_group(&priv->cdev.kobj, &iscsi_transport_group); 1698 - class_device_unregister(&priv->cdev); 1694 + sysfs_remove_group(&priv->dev.kobj, &iscsi_transport_group); 1695 + device_unregister(&priv->dev); 1699 1696 mutex_unlock(&rx_queue_mutex); 1700 1697 1701 1698 return 0;
+88 -69
drivers/scsi/scsi_transport_sas.c
··· 53 53 /* 54 54 * Hack to allow attributes of the same name in different objects. 55 55 */ 56 - #define SAS_CLASS_DEVICE_ATTR(_prefix,_name,_mode,_show,_store) \ 57 - struct class_device_attribute class_device_attr_##_prefix##_##_name = \ 56 + #define SAS_DEVICE_ATTR(_prefix,_name,_mode,_show,_store) \ 57 + struct device_attribute dev_attr_##_prefix##_##_name = \ 58 58 __ATTR(_name,_mode,_show,_store) 59 59 60 60 ··· 261 261 */ 262 262 263 263 static int sas_host_setup(struct transport_container *tc, struct device *dev, 264 - struct class_device *cdev) 264 + struct device *cdev) 265 265 { 266 266 struct Scsi_Host *shost = dev_to_shost(dev); 267 267 struct sas_host_attrs *sas_host = to_sas_host_attrs(shost); ··· 280 280 } 281 281 282 282 static int sas_host_remove(struct transport_container *tc, struct device *dev, 283 - struct class_device *cdev) 283 + struct device *cdev) 284 284 { 285 285 struct Scsi_Host *shost = dev_to_shost(dev); 286 286 ··· 356 356 357 357 #define sas_phy_show_simple(field, name, format_string, cast) \ 358 358 static ssize_t \ 359 - show_sas_phy_##name(struct class_device *cdev, char *buf) \ 359 + show_sas_phy_##name(struct device *dev, \ 360 + struct device_attribute *attr, char *buf) \ 360 361 { \ 361 - struct sas_phy *phy = transport_class_to_phy(cdev); \ 362 + struct sas_phy *phy = transport_class_to_phy(dev); \ 362 363 \ 363 364 return snprintf(buf, 20, format_string, cast phy->field); \ 364 365 } 365 366 366 367 #define sas_phy_simple_attr(field, name, format_string, type) \ 367 368 sas_phy_show_simple(field, name, format_string, (type)) \ 368 - static CLASS_DEVICE_ATTR(name, S_IRUGO, show_sas_phy_##name, NULL) 369 + static DEVICE_ATTR(name, S_IRUGO, show_sas_phy_##name, NULL) 369 370 370 371 #define sas_phy_show_protocol(field, name) \ 371 372 static ssize_t \ 372 - show_sas_phy_##name(struct class_device *cdev, char *buf) \ 373 + show_sas_phy_##name(struct device *dev, \ 374 + struct device_attribute *attr, char *buf) \ 373 375 { \ 374 - struct sas_phy *phy = transport_class_to_phy(cdev); \ 376 + struct sas_phy *phy = transport_class_to_phy(dev); \ 375 377 \ 376 378 if (!phy->field) \ 377 379 return snprintf(buf, 20, "none\n"); \ ··· 382 380 383 381 #define sas_phy_protocol_attr(field, name) \ 384 382 sas_phy_show_protocol(field, name) \ 385 - static CLASS_DEVICE_ATTR(name, S_IRUGO, show_sas_phy_##name, NULL) 383 + static DEVICE_ATTR(name, S_IRUGO, show_sas_phy_##name, NULL) 386 384 387 385 #define sas_phy_show_linkspeed(field) \ 388 386 static ssize_t \ 389 - show_sas_phy_##field(struct class_device *cdev, char *buf) \ 387 + show_sas_phy_##field(struct device *dev, \ 388 + struct device_attribute *attr, char *buf) \ 390 389 { \ 391 - struct sas_phy *phy = transport_class_to_phy(cdev); \ 390 + struct sas_phy *phy = transport_class_to_phy(dev); \ 392 391 \ 393 392 return get_sas_linkspeed_names(phy->field, buf); \ 394 393 } ··· 397 394 /* Fudge to tell if we're minimum or maximum */ 398 395 #define sas_phy_store_linkspeed(field) \ 399 396 static ssize_t \ 400 - store_sas_phy_##field(struct class_device *cdev, const char *buf, \ 401 - size_t count) \ 397 + store_sas_phy_##field(struct device *dev, \ 398 + struct device_attribute *attr, \ 399 + const char *buf, size_t count) \ 402 400 { \ 403 - struct sas_phy *phy = transport_class_to_phy(cdev); \ 401 + struct sas_phy *phy = transport_class_to_phy(dev); \ 404 402 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); \ 405 403 struct sas_internal *i = to_sas_internal(shost->transportt); \ 406 404 u32 value; \ ··· 420 416 #define sas_phy_linkspeed_rw_attr(field) \ 421 417 sas_phy_show_linkspeed(field) \ 422 418 sas_phy_store_linkspeed(field) \ 423 - static CLASS_DEVICE_ATTR(field, S_IRUGO, show_sas_phy_##field, \ 419 + static DEVICE_ATTR(field, S_IRUGO, show_sas_phy_##field, \ 424 420 store_sas_phy_##field) 425 421 426 422 #define sas_phy_linkspeed_attr(field) \ 427 423 sas_phy_show_linkspeed(field) \ 428 - static CLASS_DEVICE_ATTR(field, S_IRUGO, show_sas_phy_##field, NULL) 424 + static DEVICE_ATTR(field, S_IRUGO, show_sas_phy_##field, NULL) 429 425 430 426 431 427 #define sas_phy_show_linkerror(field) \ 432 428 static ssize_t \ 433 - show_sas_phy_##field(struct class_device *cdev, char *buf) \ 429 + show_sas_phy_##field(struct device *dev, \ 430 + struct device_attribute *attr, char *buf) \ 434 431 { \ 435 - struct sas_phy *phy = transport_class_to_phy(cdev); \ 432 + struct sas_phy *phy = transport_class_to_phy(dev); \ 436 433 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); \ 437 434 struct sas_internal *i = to_sas_internal(shost->transportt); \ 438 435 int error; \ ··· 446 441 447 442 #define sas_phy_linkerror_attr(field) \ 448 443 sas_phy_show_linkerror(field) \ 449 - static CLASS_DEVICE_ATTR(field, S_IRUGO, show_sas_phy_##field, NULL) 444 + static DEVICE_ATTR(field, S_IRUGO, show_sas_phy_##field, NULL) 450 445 451 446 452 447 static ssize_t 453 - show_sas_device_type(struct class_device *cdev, char *buf) 448 + show_sas_device_type(struct device *dev, 449 + struct device_attribute *attr, char *buf) 454 450 { 455 - struct sas_phy *phy = transport_class_to_phy(cdev); 451 + struct sas_phy *phy = transport_class_to_phy(dev); 456 452 457 453 if (!phy->identify.device_type) 458 454 return snprintf(buf, 20, "none\n"); 459 455 return get_sas_device_type_names(phy->identify.device_type, buf); 460 456 } 461 - static CLASS_DEVICE_ATTR(device_type, S_IRUGO, show_sas_device_type, NULL); 457 + static DEVICE_ATTR(device_type, S_IRUGO, show_sas_device_type, NULL); 462 458 463 - static ssize_t do_sas_phy_enable(struct class_device *cdev, 459 + static ssize_t do_sas_phy_enable(struct device *dev, 464 460 size_t count, int enable) 465 461 { 466 - struct sas_phy *phy = transport_class_to_phy(cdev); 462 + struct sas_phy *phy = transport_class_to_phy(dev); 467 463 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); 468 464 struct sas_internal *i = to_sas_internal(shost->transportt); 469 465 int error; ··· 476 470 return count; 477 471 }; 478 472 479 - static ssize_t store_sas_phy_enable(struct class_device *cdev, 480 - const char *buf, size_t count) 473 + static ssize_t 474 + store_sas_phy_enable(struct device *dev, struct device_attribute *attr, 475 + const char *buf, size_t count) 481 476 { 482 477 if (count < 1) 483 478 return -EINVAL; 484 479 485 480 switch (buf[0]) { 486 481 case '0': 487 - do_sas_phy_enable(cdev, count, 0); 482 + do_sas_phy_enable(dev, count, 0); 488 483 break; 489 484 case '1': 490 - do_sas_phy_enable(cdev, count, 1); 485 + do_sas_phy_enable(dev, count, 1); 491 486 break; 492 487 default: 493 488 return -EINVAL; ··· 497 490 return count; 498 491 } 499 492 500 - static ssize_t show_sas_phy_enable(struct class_device *cdev, char *buf) 493 + static ssize_t 494 + show_sas_phy_enable(struct device *dev, struct device_attribute *attr, 495 + char *buf) 501 496 { 502 - struct sas_phy *phy = transport_class_to_phy(cdev); 497 + struct sas_phy *phy = transport_class_to_phy(dev); 503 498 504 499 return snprintf(buf, 20, "%d", phy->enabled); 505 500 } 506 501 507 - static CLASS_DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, show_sas_phy_enable, 502 + static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, show_sas_phy_enable, 508 503 store_sas_phy_enable); 509 504 510 - static ssize_t do_sas_phy_reset(struct class_device *cdev, 511 - size_t count, int hard_reset) 505 + static ssize_t 506 + do_sas_phy_reset(struct device *dev, size_t count, int hard_reset) 512 507 { 513 - struct sas_phy *phy = transport_class_to_phy(cdev); 508 + struct sas_phy *phy = transport_class_to_phy(dev); 514 509 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); 515 510 struct sas_internal *i = to_sas_internal(shost->transportt); 516 511 int error; ··· 523 514 return count; 524 515 }; 525 516 526 - static ssize_t store_sas_link_reset(struct class_device *cdev, 527 - const char *buf, size_t count) 517 + static ssize_t 518 + store_sas_link_reset(struct device *dev, struct device_attribute *attr, 519 + const char *buf, size_t count) 528 520 { 529 - return do_sas_phy_reset(cdev, count, 0); 521 + return do_sas_phy_reset(dev, count, 0); 530 522 } 531 - static CLASS_DEVICE_ATTR(link_reset, S_IWUSR, NULL, store_sas_link_reset); 523 + static DEVICE_ATTR(link_reset, S_IWUSR, NULL, store_sas_link_reset); 532 524 533 - static ssize_t store_sas_hard_reset(struct class_device *cdev, 534 - const char *buf, size_t count) 525 + static ssize_t 526 + store_sas_hard_reset(struct device *dev, struct device_attribute *attr, 527 + const char *buf, size_t count) 535 528 { 536 - return do_sas_phy_reset(cdev, count, 1); 529 + return do_sas_phy_reset(dev, count, 1); 537 530 } 538 - static CLASS_DEVICE_ATTR(hard_reset, S_IWUSR, NULL, store_sas_hard_reset); 531 + static DEVICE_ATTR(hard_reset, S_IWUSR, NULL, store_sas_hard_reset); 539 532 540 533 sas_phy_protocol_attr(identify.initiator_port_protocols, 541 534 initiator_port_protocols); ··· 706 695 */ 707 696 #define sas_port_show_simple(field, name, format_string, cast) \ 708 697 static ssize_t \ 709 - show_sas_port_##name(struct class_device *cdev, char *buf) \ 698 + show_sas_port_##name(struct device *dev, \ 699 + struct device_attribute *attr, char *buf) \ 710 700 { \ 711 - struct sas_port *port = transport_class_to_sas_port(cdev); \ 701 + struct sas_port *port = transport_class_to_sas_port(dev); \ 712 702 \ 713 703 return snprintf(buf, 20, format_string, cast port->field); \ 714 704 } 715 705 716 706 #define sas_port_simple_attr(field, name, format_string, type) \ 717 707 sas_port_show_simple(field, name, format_string, (type)) \ 718 - static CLASS_DEVICE_ATTR(name, S_IRUGO, show_sas_port_##name, NULL) 708 + static DEVICE_ATTR(name, S_IRUGO, show_sas_port_##name, NULL) 719 709 720 710 sas_port_simple_attr(num_phys, num_phys, "%d\n", int); 721 711 ··· 1029 1017 1030 1018 #define sas_rphy_show_simple(field, name, format_string, cast) \ 1031 1019 static ssize_t \ 1032 - show_sas_rphy_##name(struct class_device *cdev, char *buf) \ 1020 + show_sas_rphy_##name(struct device *dev, \ 1021 + struct device_attribute *attr, char *buf) \ 1033 1022 { \ 1034 - struct sas_rphy *rphy = transport_class_to_rphy(cdev); \ 1023 + struct sas_rphy *rphy = transport_class_to_rphy(dev); \ 1035 1024 \ 1036 1025 return snprintf(buf, 20, format_string, cast rphy->field); \ 1037 1026 } 1038 1027 1039 1028 #define sas_rphy_simple_attr(field, name, format_string, type) \ 1040 1029 sas_rphy_show_simple(field, name, format_string, (type)) \ 1041 - static SAS_CLASS_DEVICE_ATTR(rphy, name, S_IRUGO, \ 1030 + static SAS_DEVICE_ATTR(rphy, name, S_IRUGO, \ 1042 1031 show_sas_rphy_##name, NULL) 1043 1032 1044 1033 #define sas_rphy_show_protocol(field, name) \ 1045 1034 static ssize_t \ 1046 - show_sas_rphy_##name(struct class_device *cdev, char *buf) \ 1035 + show_sas_rphy_##name(struct device *dev, \ 1036 + struct device_attribute *attr, char *buf) \ 1047 1037 { \ 1048 - struct sas_rphy *rphy = transport_class_to_rphy(cdev); \ 1038 + struct sas_rphy *rphy = transport_class_to_rphy(dev); \ 1049 1039 \ 1050 1040 if (!rphy->field) \ 1051 1041 return snprintf(buf, 20, "none\n"); \ ··· 1056 1042 1057 1043 #define sas_rphy_protocol_attr(field, name) \ 1058 1044 sas_rphy_show_protocol(field, name) \ 1059 - static SAS_CLASS_DEVICE_ATTR(rphy, name, S_IRUGO, \ 1045 + static SAS_DEVICE_ATTR(rphy, name, S_IRUGO, \ 1060 1046 show_sas_rphy_##name, NULL) 1061 1047 1062 1048 static ssize_t 1063 - show_sas_rphy_device_type(struct class_device *cdev, char *buf) 1049 + show_sas_rphy_device_type(struct device *dev, 1050 + struct device_attribute *attr, char *buf) 1064 1051 { 1065 - struct sas_rphy *rphy = transport_class_to_rphy(cdev); 1052 + struct sas_rphy *rphy = transport_class_to_rphy(dev); 1066 1053 1067 1054 if (!rphy->identify.device_type) 1068 1055 return snprintf(buf, 20, "none\n"); ··· 1071 1056 rphy->identify.device_type, buf); 1072 1057 } 1073 1058 1074 - static SAS_CLASS_DEVICE_ATTR(rphy, device_type, S_IRUGO, 1059 + static SAS_DEVICE_ATTR(rphy, device_type, S_IRUGO, 1075 1060 show_sas_rphy_device_type, NULL); 1076 1061 1077 1062 static ssize_t 1078 - show_sas_rphy_enclosure_identifier(struct class_device *cdev, char *buf) 1063 + show_sas_rphy_enclosure_identifier(struct device *dev, 1064 + struct device_attribute *attr, char *buf) 1079 1065 { 1080 - struct sas_rphy *rphy = transport_class_to_rphy(cdev); 1066 + struct sas_rphy *rphy = transport_class_to_rphy(dev); 1081 1067 struct sas_phy *phy = dev_to_phy(rphy->dev.parent); 1082 1068 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); 1083 1069 struct sas_internal *i = to_sas_internal(shost->transportt); ··· 1098 1082 return sprintf(buf, "0x%llx\n", (unsigned long long)identifier); 1099 1083 } 1100 1084 1101 - static SAS_CLASS_DEVICE_ATTR(rphy, enclosure_identifier, S_IRUGO, 1085 + static SAS_DEVICE_ATTR(rphy, enclosure_identifier, S_IRUGO, 1102 1086 show_sas_rphy_enclosure_identifier, NULL); 1103 1087 1104 1088 static ssize_t 1105 - show_sas_rphy_bay_identifier(struct class_device *cdev, char *buf) 1089 + show_sas_rphy_bay_identifier(struct device *dev, 1090 + struct device_attribute *attr, char *buf) 1106 1091 { 1107 - struct sas_rphy *rphy = transport_class_to_rphy(cdev); 1092 + struct sas_rphy *rphy = transport_class_to_rphy(dev); 1108 1093 struct sas_phy *phy = dev_to_phy(rphy->dev.parent); 1109 1094 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); 1110 1095 struct sas_internal *i = to_sas_internal(shost->transportt); ··· 1120 1103 return sprintf(buf, "%d\n", val); 1121 1104 } 1122 1105 1123 - static SAS_CLASS_DEVICE_ATTR(rphy, bay_identifier, S_IRUGO, 1106 + static SAS_DEVICE_ATTR(rphy, bay_identifier, S_IRUGO, 1124 1107 show_sas_rphy_bay_identifier, NULL); 1125 1108 1126 1109 sas_rphy_protocol_attr(identify.initiator_port_protocols, ··· 1178 1161 1179 1162 #define sas_end_dev_show_simple(field, name, format_string, cast) \ 1180 1163 static ssize_t \ 1181 - show_sas_end_dev_##name(struct class_device *cdev, char *buf) \ 1164 + show_sas_end_dev_##name(struct device *dev, \ 1165 + struct device_attribute *attr, char *buf) \ 1182 1166 { \ 1183 - struct sas_rphy *rphy = transport_class_to_rphy(cdev); \ 1167 + struct sas_rphy *rphy = transport_class_to_rphy(dev); \ 1184 1168 struct sas_end_device *rdev = rphy_to_end_device(rphy); \ 1185 1169 \ 1186 1170 return snprintf(buf, 20, format_string, cast rdev->field); \ ··· 1189 1171 1190 1172 #define sas_end_dev_simple_attr(field, name, format_string, type) \ 1191 1173 sas_end_dev_show_simple(field, name, format_string, (type)) \ 1192 - static SAS_CLASS_DEVICE_ATTR(end_dev, name, S_IRUGO, \ 1174 + static SAS_DEVICE_ATTR(end_dev, name, S_IRUGO, \ 1193 1175 show_sas_end_dev_##name, NULL) 1194 1176 1195 1177 sas_end_dev_simple_attr(ready_led_meaning, ready_led_meaning, "%d\n", int); ··· 1203 1185 1204 1186 #define sas_expander_show_simple(field, name, format_string, cast) \ 1205 1187 static ssize_t \ 1206 - show_sas_expander_##name(struct class_device *cdev, char *buf) \ 1188 + show_sas_expander_##name(struct device *dev, \ 1189 + struct device_attribute *attr, char *buf) \ 1207 1190 { \ 1208 - struct sas_rphy *rphy = transport_class_to_rphy(cdev); \ 1191 + struct sas_rphy *rphy = transport_class_to_rphy(dev); \ 1209 1192 struct sas_expander_device *edev = rphy_to_expander_device(rphy); \ 1210 1193 \ 1211 1194 return snprintf(buf, 20, format_string, cast edev->field); \ ··· 1214 1195 1215 1196 #define sas_expander_simple_attr(field, name, format_string, type) \ 1216 1197 sas_expander_show_simple(field, name, format_string, (type)) \ 1217 - static SAS_CLASS_DEVICE_ATTR(expander, name, S_IRUGO, \ 1198 + static SAS_DEVICE_ATTR(expander, name, S_IRUGO, \ 1218 1199 show_sas_expander_##name, NULL) 1219 1200 1220 1201 sas_expander_simple_attr(vendor_id, vendor_id, "%s\n", char *); ··· 1573 1554 */ 1574 1555 1575 1556 #define SETUP_TEMPLATE(attrb, field, perm, test) \ 1576 - i->private_##attrb[count] = class_device_attr_##field; \ 1557 + i->private_##attrb[count] = dev_attr_##field; \ 1577 1558 i->private_##attrb[count].attr.mode = perm; \ 1578 1559 i->attrb[count] = &i->private_##attrb[count]; \ 1579 1560 if (test) \ 1580 1561 count++ 1581 1562 1582 1563 #define SETUP_TEMPLATE_RW(attrb, field, perm, test, ro_test, ro_perm) \ 1583 - i->private_##attrb[count] = class_device_attr_##field; \ 1564 + i->private_##attrb[count] = dev_attr_##field; \ 1584 1565 i->private_##attrb[count].attr.mode = perm; \ 1585 1566 if (ro_test) { \ 1586 1567 i->private_##attrb[count].attr.mode = ro_perm; \
+98 -87
drivers/scsi/scsi_transport_spi.c
··· 158 158 } 159 159 160 160 static int spi_host_setup(struct transport_container *tc, struct device *dev, 161 - struct class_device *cdev) 161 + struct device *cdev) 162 162 { 163 163 struct Scsi_Host *shost = dev_to_shost(dev); 164 164 ··· 169 169 170 170 static int spi_host_configure(struct transport_container *tc, 171 171 struct device *dev, 172 - struct class_device *cdev); 172 + struct device *cdev); 173 173 174 174 static DECLARE_TRANSPORT_CLASS(spi_host_class, 175 175 "spi_host", ··· 195 195 196 196 static int spi_target_configure(struct transport_container *tc, 197 197 struct device *dev, 198 - struct class_device *cdev); 198 + struct device *cdev); 199 199 200 200 static int spi_device_configure(struct transport_container *tc, 201 201 struct device *dev, 202 - struct class_device *cdev) 202 + struct device *cdev) 203 203 { 204 204 struct scsi_device *sdev = to_scsi_device(dev); 205 205 struct scsi_target *starget = sdev->sdev_target; ··· 219 219 220 220 static int spi_setup_transport_attrs(struct transport_container *tc, 221 221 struct device *dev, 222 - struct class_device *cdev) 222 + struct device *cdev) 223 223 { 224 224 struct scsi_target *starget = to_scsi_target(dev); 225 225 ··· 248 248 #define spi_transport_show_simple(field, format_string) \ 249 249 \ 250 250 static ssize_t \ 251 - show_spi_transport_##field(struct class_device *cdev, char *buf) \ 251 + show_spi_transport_##field(struct device *dev, \ 252 + struct device_attribute *attr, char *buf) \ 252 253 { \ 253 - struct scsi_target *starget = transport_class_to_starget(cdev); \ 254 + struct scsi_target *starget = transport_class_to_starget(dev); \ 254 255 struct spi_transport_attrs *tp; \ 255 256 \ 256 257 tp = (struct spi_transport_attrs *)&starget->starget_data; \ ··· 261 260 #define spi_transport_store_simple(field, format_string) \ 262 261 \ 263 262 static ssize_t \ 264 - store_spi_transport_##field(struct class_device *cdev, const char *buf, \ 265 - size_t count) \ 263 + store_spi_transport_##field(struct device *dev, \ 264 + struct device_attribute *attr, \ 265 + const char *buf, size_t count) \ 266 266 { \ 267 267 int val; \ 268 - struct scsi_target *starget = transport_class_to_starget(cdev); \ 268 + struct scsi_target *starget = transport_class_to_starget(dev); \ 269 269 struct spi_transport_attrs *tp; \ 270 270 \ 271 271 tp = (struct spi_transport_attrs *)&starget->starget_data; \ ··· 278 276 #define spi_transport_show_function(field, format_string) \ 279 277 \ 280 278 static ssize_t \ 281 - show_spi_transport_##field(struct class_device *cdev, char *buf) \ 279 + show_spi_transport_##field(struct device *dev, \ 280 + struct device_attribute *attr, char *buf) \ 282 281 { \ 283 - struct scsi_target *starget = transport_class_to_starget(cdev); \ 282 + struct scsi_target *starget = transport_class_to_starget(dev); \ 284 283 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); \ 285 284 struct spi_transport_attrs *tp; \ 286 285 struct spi_internal *i = to_spi_internal(shost->transportt); \ ··· 293 290 294 291 #define spi_transport_store_function(field, format_string) \ 295 292 static ssize_t \ 296 - store_spi_transport_##field(struct class_device *cdev, const char *buf, \ 297 - size_t count) \ 293 + store_spi_transport_##field(struct device *dev, \ 294 + struct device_attribute *attr, \ 295 + const char *buf, size_t count) \ 298 296 { \ 299 297 int val; \ 300 - struct scsi_target *starget = transport_class_to_starget(cdev); \ 298 + struct scsi_target *starget = transport_class_to_starget(dev); \ 301 299 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); \ 302 300 struct spi_internal *i = to_spi_internal(shost->transportt); \ 303 301 \ ··· 311 307 312 308 #define spi_transport_store_max(field, format_string) \ 313 309 static ssize_t \ 314 - store_spi_transport_##field(struct class_device *cdev, const char *buf, \ 315 - size_t count) \ 310 + store_spi_transport_##field(struct device *dev, \ 311 + struct device_attribute *attr, \ 312 + const char *buf, size_t count) \ 316 313 { \ 317 314 int val; \ 318 - struct scsi_target *starget = transport_class_to_starget(cdev); \ 315 + struct scsi_target *starget = transport_class_to_starget(dev); \ 319 316 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); \ 320 317 struct spi_internal *i = to_spi_internal(shost->transportt); \ 321 318 struct spi_transport_attrs *tp \ ··· 334 329 #define spi_transport_rd_attr(field, format_string) \ 335 330 spi_transport_show_function(field, format_string) \ 336 331 spi_transport_store_function(field, format_string) \ 337 - static CLASS_DEVICE_ATTR(field, S_IRUGO, \ 338 - show_spi_transport_##field, \ 339 - store_spi_transport_##field); 332 + static DEVICE_ATTR(field, S_IRUGO, \ 333 + show_spi_transport_##field, \ 334 + store_spi_transport_##field); 340 335 341 336 #define spi_transport_simple_attr(field, format_string) \ 342 337 spi_transport_show_simple(field, format_string) \ 343 338 spi_transport_store_simple(field, format_string) \ 344 - static CLASS_DEVICE_ATTR(field, S_IRUGO, \ 345 - show_spi_transport_##field, \ 346 - store_spi_transport_##field); 339 + static DEVICE_ATTR(field, S_IRUGO, \ 340 + show_spi_transport_##field, \ 341 + store_spi_transport_##field); 347 342 348 343 #define spi_transport_max_attr(field, format_string) \ 349 344 spi_transport_show_function(field, format_string) \ 350 345 spi_transport_store_max(field, format_string) \ 351 346 spi_transport_simple_attr(max_##field, format_string) \ 352 - static CLASS_DEVICE_ATTR(field, S_IRUGO, \ 353 - show_spi_transport_##field, \ 354 - store_spi_transport_##field); 347 + static DEVICE_ATTR(field, S_IRUGO, \ 348 + show_spi_transport_##field, \ 349 + store_spi_transport_##field); 355 350 356 351 /* The Parallel SCSI Tranport Attributes: */ 357 352 spi_transport_max_attr(offset, "%d\n"); ··· 375 370 } 376 371 377 372 static ssize_t 378 - store_spi_revalidate(struct class_device *cdev, const char *buf, size_t count) 373 + store_spi_revalidate(struct device *dev, struct device_attribute *attr, 374 + const char *buf, size_t count) 379 375 { 380 - struct scsi_target *starget = transport_class_to_starget(cdev); 376 + struct scsi_target *starget = transport_class_to_starget(dev); 381 377 382 378 device_for_each_child(&starget->dev, NULL, child_iter); 383 379 return count; 384 380 } 385 - static CLASS_DEVICE_ATTR(revalidate, S_IWUSR, NULL, store_spi_revalidate); 381 + static DEVICE_ATTR(revalidate, S_IWUSR, NULL, store_spi_revalidate); 386 382 387 383 /* Translate the period into ns according to the current spec 388 384 * for SDTR/PPR messages */ ··· 418 412 } 419 413 420 414 static ssize_t 421 - store_spi_transport_period_helper(struct class_device *cdev, const char *buf, 415 + store_spi_transport_period_helper(struct device *dev, const char *buf, 422 416 size_t count, int *periodp) 423 417 { 424 418 int j, picosec, period = -1; ··· 455 449 } 456 450 457 451 static ssize_t 458 - show_spi_transport_period(struct class_device *cdev, char *buf) 452 + show_spi_transport_period(struct device *dev, 453 + struct device_attribute *attr, char *buf) 459 454 { 460 - struct scsi_target *starget = transport_class_to_starget(cdev); 455 + struct scsi_target *starget = transport_class_to_starget(dev); 461 456 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 462 457 struct spi_internal *i = to_spi_internal(shost->transportt); 463 458 struct spi_transport_attrs *tp = ··· 471 464 } 472 465 473 466 static ssize_t 474 - store_spi_transport_period(struct class_device *cdev, const char *buf, 475 - size_t count) 467 + store_spi_transport_period(struct device *cdev, struct device_attribute *attr, 468 + const char *buf, size_t count) 476 469 { 477 470 struct scsi_target *starget = transport_class_to_starget(cdev); 478 471 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); ··· 494 487 return retval; 495 488 } 496 489 497 - static CLASS_DEVICE_ATTR(period, S_IRUGO, 498 - show_spi_transport_period, 499 - store_spi_transport_period); 490 + static DEVICE_ATTR(period, S_IRUGO, 491 + show_spi_transport_period, 492 + store_spi_transport_period); 500 493 501 494 static ssize_t 502 - show_spi_transport_min_period(struct class_device *cdev, char *buf) 495 + show_spi_transport_min_period(struct device *cdev, 496 + struct device_attribute *attr, char *buf) 503 497 { 504 498 struct scsi_target *starget = transport_class_to_starget(cdev); 505 499 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); ··· 515 507 } 516 508 517 509 static ssize_t 518 - store_spi_transport_min_period(struct class_device *cdev, const char *buf, 519 - size_t count) 510 + store_spi_transport_min_period(struct device *cdev, 511 + struct device_attribute *attr, 512 + const char *buf, size_t count) 520 513 { 521 514 struct scsi_target *starget = transport_class_to_starget(cdev); 522 515 struct spi_transport_attrs *tp = ··· 528 519 } 529 520 530 521 531 - static CLASS_DEVICE_ATTR(min_period, S_IRUGO, 532 - show_spi_transport_min_period, 533 - store_spi_transport_min_period); 522 + static DEVICE_ATTR(min_period, S_IRUGO, 523 + show_spi_transport_min_period, 524 + store_spi_transport_min_period); 534 525 535 526 536 - static ssize_t show_spi_host_signalling(struct class_device *cdev, char *buf) 527 + static ssize_t show_spi_host_signalling(struct device *cdev, 528 + struct device_attribute *attr, 529 + char *buf) 537 530 { 538 531 struct Scsi_Host *shost = transport_class_to_shost(cdev); 539 532 struct spi_internal *i = to_spi_internal(shost->transportt); ··· 545 534 546 535 return sprintf(buf, "%s\n", spi_signal_to_string(spi_signalling(shost))); 547 536 } 548 - static ssize_t store_spi_host_signalling(struct class_device *cdev, 537 + static ssize_t store_spi_host_signalling(struct device *dev, 538 + struct device_attribute *attr, 549 539 const char *buf, size_t count) 550 540 { 551 - struct Scsi_Host *shost = transport_class_to_shost(cdev); 541 + struct Scsi_Host *shost = transport_class_to_shost(dev); 552 542 struct spi_internal *i = to_spi_internal(shost->transportt); 553 543 enum spi_signal_type type = spi_signal_to_value(buf); 554 544 ··· 561 549 562 550 return count; 563 551 } 564 - static CLASS_DEVICE_ATTR(signalling, S_IRUGO, 565 - show_spi_host_signalling, 566 - store_spi_host_signalling); 552 + static DEVICE_ATTR(signalling, S_IRUGO, 553 + show_spi_host_signalling, 554 + store_spi_host_signalling); 567 555 568 556 #define DV_SET(x, y) \ 569 557 if(i->f->set_##x) \ ··· 1346 1334 spi_device_configure); 1347 1335 1348 1336 static struct attribute *host_attributes[] = { 1349 - &class_device_attr_signalling.attr, 1337 + &dev_attr_signalling.attr, 1350 1338 NULL 1351 1339 }; 1352 1340 ··· 1356 1344 1357 1345 static int spi_host_configure(struct transport_container *tc, 1358 1346 struct device *dev, 1359 - struct class_device *cdev) 1347 + struct device *cdev) 1360 1348 { 1361 1349 struct kobject *kobj = &cdev->kobj; 1362 1350 struct Scsi_Host *shost = transport_class_to_shost(cdev); 1363 1351 struct spi_internal *si = to_spi_internal(shost->transportt); 1364 - struct attribute *attr = &class_device_attr_signalling.attr; 1352 + struct attribute *attr = &dev_attr_signalling.attr; 1365 1353 int rc = 0; 1366 1354 1367 1355 if (si->f->set_signalling) ··· 1380 1368 static int target_attribute_is_visible(struct kobject *kobj, 1381 1369 struct attribute *attr, int i) 1382 1370 { 1383 - struct class_device *cdev = 1384 - container_of(kobj, struct class_device, kobj); 1371 + struct device *cdev = container_of(kobj, struct device, kobj); 1385 1372 struct scsi_target *starget = transport_class_to_starget(cdev); 1386 1373 struct Scsi_Host *shost = transport_class_to_shost(cdev); 1387 1374 struct spi_internal *si = to_spi_internal(shost->transportt); 1388 1375 1389 - if (attr == &class_device_attr_period.attr && 1376 + if (attr == &dev_attr_period.attr && 1390 1377 spi_support_sync(starget)) 1391 1378 return TARGET_ATTRIBUTE_HELPER(period); 1392 - else if (attr == &class_device_attr_min_period.attr && 1379 + else if (attr == &dev_attr_min_period.attr && 1393 1380 spi_support_sync(starget)) 1394 1381 return TARGET_ATTRIBUTE_HELPER(period); 1395 - else if (attr == &class_device_attr_offset.attr && 1382 + else if (attr == &dev_attr_offset.attr && 1396 1383 spi_support_sync(starget)) 1397 1384 return TARGET_ATTRIBUTE_HELPER(offset); 1398 - else if (attr == &class_device_attr_max_offset.attr && 1385 + else if (attr == &dev_attr_max_offset.attr && 1399 1386 spi_support_sync(starget)) 1400 1387 return TARGET_ATTRIBUTE_HELPER(offset); 1401 - else if (attr == &class_device_attr_width.attr && 1388 + else if (attr == &dev_attr_width.attr && 1402 1389 spi_support_wide(starget)) 1403 1390 return TARGET_ATTRIBUTE_HELPER(width); 1404 - else if (attr == &class_device_attr_max_width.attr && 1391 + else if (attr == &dev_attr_max_width.attr && 1405 1392 spi_support_wide(starget)) 1406 1393 return TARGET_ATTRIBUTE_HELPER(width); 1407 - else if (attr == &class_device_attr_iu.attr && 1394 + else if (attr == &dev_attr_iu.attr && 1408 1395 spi_support_ius(starget)) 1409 1396 return TARGET_ATTRIBUTE_HELPER(iu); 1410 - else if (attr == &class_device_attr_dt.attr && 1397 + else if (attr == &dev_attr_dt.attr && 1411 1398 spi_support_dt(starget)) 1412 1399 return TARGET_ATTRIBUTE_HELPER(dt); 1413 - else if (attr == &class_device_attr_qas.attr && 1400 + else if (attr == &dev_attr_qas.attr && 1414 1401 spi_support_qas(starget)) 1415 1402 return TARGET_ATTRIBUTE_HELPER(qas); 1416 - else if (attr == &class_device_attr_wr_flow.attr && 1403 + else if (attr == &dev_attr_wr_flow.attr && 1417 1404 spi_support_ius(starget)) 1418 1405 return TARGET_ATTRIBUTE_HELPER(wr_flow); 1419 - else if (attr == &class_device_attr_rd_strm.attr && 1406 + else if (attr == &dev_attr_rd_strm.attr && 1420 1407 spi_support_ius(starget)) 1421 1408 return TARGET_ATTRIBUTE_HELPER(rd_strm); 1422 - else if (attr == &class_device_attr_rti.attr && 1409 + else if (attr == &dev_attr_rti.attr && 1423 1410 spi_support_ius(starget)) 1424 1411 return TARGET_ATTRIBUTE_HELPER(rti); 1425 - else if (attr == &class_device_attr_pcomp_en.attr && 1412 + else if (attr == &dev_attr_pcomp_en.attr && 1426 1413 spi_support_ius(starget)) 1427 1414 return TARGET_ATTRIBUTE_HELPER(pcomp_en); 1428 - else if (attr == &class_device_attr_hold_mcs.attr && 1415 + else if (attr == &dev_attr_hold_mcs.attr && 1429 1416 spi_support_ius(starget)) 1430 1417 return TARGET_ATTRIBUTE_HELPER(hold_mcs); 1431 - else if (attr == &class_device_attr_revalidate.attr) 1418 + else if (attr == &dev_attr_revalidate.attr) 1432 1419 return 1; 1433 1420 1434 1421 return 0; 1435 1422 } 1436 1423 1437 1424 static struct attribute *target_attributes[] = { 1438 - &class_device_attr_period.attr, 1439 - &class_device_attr_min_period.attr, 1440 - &class_device_attr_offset.attr, 1441 - &class_device_attr_max_offset.attr, 1442 - &class_device_attr_width.attr, 1443 - &class_device_attr_max_width.attr, 1444 - &class_device_attr_iu.attr, 1445 - &class_device_attr_dt.attr, 1446 - &class_device_attr_qas.attr, 1447 - &class_device_attr_wr_flow.attr, 1448 - &class_device_attr_rd_strm.attr, 1449 - &class_device_attr_rti.attr, 1450 - &class_device_attr_pcomp_en.attr, 1451 - &class_device_attr_hold_mcs.attr, 1452 - &class_device_attr_revalidate.attr, 1425 + &dev_attr_period.attr, 1426 + &dev_attr_min_period.attr, 1427 + &dev_attr_offset.attr, 1428 + &dev_attr_max_offset.attr, 1429 + &dev_attr_width.attr, 1430 + &dev_attr_max_width.attr, 1431 + &dev_attr_iu.attr, 1432 + &dev_attr_dt.attr, 1433 + &dev_attr_qas.attr, 1434 + &dev_attr_wr_flow.attr, 1435 + &dev_attr_rd_strm.attr, 1436 + &dev_attr_rti.attr, 1437 + &dev_attr_pcomp_en.attr, 1438 + &dev_attr_hold_mcs.attr, 1439 + &dev_attr_revalidate.attr, 1453 1440 NULL 1454 1441 }; 1455 1442 ··· 1459 1448 1460 1449 static int spi_target_configure(struct transport_container *tc, 1461 1450 struct device *dev, 1462 - struct class_device *cdev) 1451 + struct device *cdev) 1463 1452 { 1464 1453 struct kobject *kobj = &cdev->kobj; 1465 1454 int i; ··· 1473 1462 * to ignore, sysfs also does a WARN_ON and dumps a trace, 1474 1463 * which is bad, so temporarily, skip attributes that are 1475 1464 * already visible (the revalidate one) */ 1476 - if (j && attr != &class_device_attr_revalidate.attr) 1465 + if (j && attr != &dev_attr_revalidate.attr) 1477 1466 rc = sysfs_add_file_to_group(kobj, attr, 1478 1467 target_attribute_group.name); 1479 1468 /* and make the attribute writeable if we have a set
+14 -12
drivers/scsi/scsi_transport_srp.c
··· 44 44 struct scsi_transport_template t; 45 45 struct srp_function_template *f; 46 46 47 - struct class_device_attribute *host_attrs[SRP_HOST_ATTRS + 1]; 47 + struct device_attribute *host_attrs[SRP_HOST_ATTRS + 1]; 48 48 49 - struct class_device_attribute *rport_attrs[SRP_RPORT_ATTRS + 1]; 50 - struct class_device_attribute private_rport_attrs[SRP_RPORT_ATTRS]; 49 + struct device_attribute *rport_attrs[SRP_RPORT_ATTRS + 1]; 50 + struct device_attribute private_rport_attrs[SRP_RPORT_ATTRS]; 51 51 struct transport_container rport_attr_cont; 52 52 }; 53 53 54 54 #define to_srp_internal(tmpl) container_of(tmpl, struct srp_internal, t) 55 55 56 56 #define dev_to_rport(d) container_of(d, struct srp_rport, dev) 57 - #define transport_class_to_srp_rport(cdev) dev_to_rport((cdev)->dev) 57 + #define transport_class_to_srp_rport(dev) dev_to_rport((dev)->parent) 58 58 59 59 static int srp_host_setup(struct transport_container *tc, struct device *dev, 60 - struct class_device *cdev) 60 + struct device *cdev) 61 61 { 62 62 struct Scsi_Host *shost = dev_to_shost(dev); 63 63 struct srp_host_attrs *srp_host = to_srp_host_attrs(shost); ··· 73 73 NULL, NULL, NULL); 74 74 75 75 #define SETUP_TEMPLATE(attrb, field, perm, test, ro_test, ro_perm) \ 76 - i->private_##attrb[count] = class_device_attr_##field; \ 76 + i->private_##attrb[count] = dev_attr_##field; \ 77 77 i->private_##attrb[count].attr.mode = perm; \ 78 78 if (ro_test) { \ 79 79 i->private_##attrb[count].attr.mode = ro_perm; \ ··· 100 100 "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x" 101 101 102 102 static ssize_t 103 - show_srp_rport_id(struct class_device *cdev, char *buf) 103 + show_srp_rport_id(struct device *dev, struct device_attribute *attr, 104 + char *buf) 104 105 { 105 - struct srp_rport *rport = transport_class_to_srp_rport(cdev); 106 + struct srp_rport *rport = transport_class_to_srp_rport(dev); 106 107 return sprintf(buf, SRP_PID_FMT "\n", SRP_PID(rport)); 107 108 } 108 109 109 - static CLASS_DEVICE_ATTR(port_id, S_IRUGO, show_srp_rport_id, NULL); 110 + static DEVICE_ATTR(port_id, S_IRUGO, show_srp_rport_id, NULL); 110 111 111 112 static const struct { 112 113 u32 value; ··· 118 117 }; 119 118 120 119 static ssize_t 121 - show_srp_rport_roles(struct class_device *cdev, char *buf) 120 + show_srp_rport_roles(struct device *dev, struct device_attribute *attr, 121 + char *buf) 122 122 { 123 - struct srp_rport *rport = transport_class_to_srp_rport(cdev); 123 + struct srp_rport *rport = transport_class_to_srp_rport(dev); 124 124 int i; 125 125 char *name = NULL; 126 126 ··· 133 131 return sprintf(buf, "%s\n", name ? : "unknown"); 134 132 } 135 133 136 - static CLASS_DEVICE_ATTR(roles, S_IRUGO, show_srp_rport_roles, NULL); 134 + static DEVICE_ATTR(roles, S_IRUGO, show_srp_rport_roles, NULL); 137 135 138 136 static void srp_rport_release(struct device *dev) 139 137 {
+44 -34
drivers/scsi/sd.c
··· 95 95 static void sd_rescan(struct device *); 96 96 static int sd_done(struct scsi_cmnd *); 97 97 static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer); 98 - static void scsi_disk_release(struct class_device *cdev); 98 + static void scsi_disk_release(struct device *cdev); 99 99 static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *); 100 100 static void sd_print_result(struct scsi_disk *, int); 101 101 ··· 112 112 "write back, no read (daft)" 113 113 }; 114 114 115 - static ssize_t sd_store_cache_type(struct class_device *cdev, const char *buf, 116 - size_t count) 115 + static ssize_t 116 + sd_store_cache_type(struct device *dev, struct device_attribute *attr, 117 + const char *buf, size_t count) 117 118 { 118 119 int i, ct = -1, rcd, wce, sp; 119 - struct scsi_disk *sdkp = to_scsi_disk(cdev); 120 + struct scsi_disk *sdkp = to_scsi_disk(dev); 120 121 struct scsi_device *sdp = sdkp->device; 121 122 char buffer[64]; 122 123 char *buffer_data; ··· 164 163 return count; 165 164 } 166 165 167 - static ssize_t sd_store_manage_start_stop(struct class_device *cdev, 168 - const char *buf, size_t count) 166 + static ssize_t 167 + sd_store_manage_start_stop(struct device *dev, struct device_attribute *attr, 168 + const char *buf, size_t count) 169 169 { 170 - struct scsi_disk *sdkp = to_scsi_disk(cdev); 170 + struct scsi_disk *sdkp = to_scsi_disk(dev); 171 171 struct scsi_device *sdp = sdkp->device; 172 172 173 173 if (!capable(CAP_SYS_ADMIN)) ··· 179 177 return count; 180 178 } 181 179 182 - static ssize_t sd_store_allow_restart(struct class_device *cdev, const char *buf, 183 - size_t count) 180 + static ssize_t 181 + sd_store_allow_restart(struct device *dev, struct device_attribute *attr, 182 + const char *buf, size_t count) 184 183 { 185 - struct scsi_disk *sdkp = to_scsi_disk(cdev); 184 + struct scsi_disk *sdkp = to_scsi_disk(dev); 186 185 struct scsi_device *sdp = sdkp->device; 187 186 188 187 if (!capable(CAP_SYS_ADMIN)) ··· 197 194 return count; 198 195 } 199 196 200 - static ssize_t sd_show_cache_type(struct class_device *cdev, char *buf) 197 + static ssize_t 198 + sd_show_cache_type(struct device *dev, struct device_attribute *attr, 199 + char *buf) 201 200 { 202 - struct scsi_disk *sdkp = to_scsi_disk(cdev); 201 + struct scsi_disk *sdkp = to_scsi_disk(dev); 203 202 int ct = sdkp->RCD + 2*sdkp->WCE; 204 203 205 204 return snprintf(buf, 40, "%s\n", sd_cache_types[ct]); 206 205 } 207 206 208 - static ssize_t sd_show_fua(struct class_device *cdev, char *buf) 207 + static ssize_t 208 + sd_show_fua(struct device *dev, struct device_attribute *attr, char *buf) 209 209 { 210 - struct scsi_disk *sdkp = to_scsi_disk(cdev); 210 + struct scsi_disk *sdkp = to_scsi_disk(dev); 211 211 212 212 return snprintf(buf, 20, "%u\n", sdkp->DPOFUA); 213 213 } 214 214 215 - static ssize_t sd_show_manage_start_stop(struct class_device *cdev, char *buf) 215 + static ssize_t 216 + sd_show_manage_start_stop(struct device *dev, struct device_attribute *attr, 217 + char *buf) 216 218 { 217 - struct scsi_disk *sdkp = to_scsi_disk(cdev); 219 + struct scsi_disk *sdkp = to_scsi_disk(dev); 218 220 struct scsi_device *sdp = sdkp->device; 219 221 220 222 return snprintf(buf, 20, "%u\n", sdp->manage_start_stop); 221 223 } 222 224 223 - static ssize_t sd_show_allow_restart(struct class_device *cdev, char *buf) 225 + static ssize_t 226 + sd_show_allow_restart(struct device *dev, struct device_attribute *attr, 227 + char *buf) 224 228 { 225 - struct scsi_disk *sdkp = to_scsi_disk(cdev); 229 + struct scsi_disk *sdkp = to_scsi_disk(dev); 226 230 227 231 return snprintf(buf, 40, "%d\n", sdkp->device->allow_restart); 228 232 } 229 233 230 - static struct class_device_attribute sd_disk_attrs[] = { 234 + static struct device_attribute sd_disk_attrs[] = { 231 235 __ATTR(cache_type, S_IRUGO|S_IWUSR, sd_show_cache_type, 232 236 sd_store_cache_type), 233 237 __ATTR(FUA, S_IRUGO, sd_show_fua, NULL), ··· 248 238 static struct class sd_disk_class = { 249 239 .name = "scsi_disk", 250 240 .owner = THIS_MODULE, 251 - .release = scsi_disk_release, 252 - .class_dev_attrs = sd_disk_attrs, 241 + .dev_release = scsi_disk_release, 242 + .dev_attrs = sd_disk_attrs, 253 243 }; 254 244 255 245 static struct scsi_driver sd_template = { ··· 307 297 if (disk->private_data) { 308 298 sdkp = scsi_disk(disk); 309 299 if (scsi_device_get(sdkp->device) == 0) 310 - class_device_get(&sdkp->cdev); 300 + get_device(&sdkp->dev); 311 301 else 312 302 sdkp = NULL; 313 303 } ··· 341 331 struct scsi_device *sdev = sdkp->device; 342 332 343 333 mutex_lock(&sd_ref_mutex); 344 - class_device_put(&sdkp->cdev); 334 + put_device(&sdkp->dev); 345 335 scsi_device_put(sdev); 346 336 mutex_unlock(&sd_ref_mutex); 347 337 } ··· 1673 1663 sdp->timeout = SD_MOD_TIMEOUT; 1674 1664 } 1675 1665 1676 - class_device_initialize(&sdkp->cdev); 1677 - sdkp->cdev.dev = &sdp->sdev_gendev; 1678 - sdkp->cdev.class = &sd_disk_class; 1679 - strncpy(sdkp->cdev.class_id, sdp->sdev_gendev.bus_id, BUS_ID_SIZE); 1666 + device_initialize(&sdkp->dev); 1667 + sdkp->dev.parent = &sdp->sdev_gendev; 1668 + sdkp->dev.class = &sd_disk_class; 1669 + strncpy(sdkp->dev.bus_id, sdp->sdev_gendev.bus_id, BUS_ID_SIZE); 1680 1670 1681 - if (class_device_add(&sdkp->cdev)) 1671 + if (device_add(&sdkp->dev)) 1682 1672 goto out_put; 1683 1673 1684 1674 get_device(&sdp->sdev_gendev); ··· 1744 1734 { 1745 1735 struct scsi_disk *sdkp = dev_get_drvdata(dev); 1746 1736 1747 - class_device_del(&sdkp->cdev); 1737 + device_del(&sdkp->dev); 1748 1738 del_gendisk(sdkp->disk); 1749 1739 sd_shutdown(dev); 1750 1740 1751 1741 mutex_lock(&sd_ref_mutex); 1752 1742 dev_set_drvdata(dev, NULL); 1753 - class_device_put(&sdkp->cdev); 1743 + put_device(&sdkp->dev); 1754 1744 mutex_unlock(&sd_ref_mutex); 1755 1745 1756 1746 return 0; ··· 1758 1748 1759 1749 /** 1760 1750 * scsi_disk_release - Called to free the scsi_disk structure 1761 - * @cdev: pointer to embedded class device 1751 + * @dev: pointer to embedded class device 1762 1752 * 1763 1753 * sd_ref_mutex must be held entering this routine. Because it is 1764 1754 * called on last put, you should always use the scsi_disk_get() 1765 1755 * scsi_disk_put() helpers which manipulate the semaphore directly 1766 - * and never do a direct class_device_put(). 1756 + * and never do a direct put_device. 1767 1757 **/ 1768 - static void scsi_disk_release(struct class_device *cdev) 1758 + static void scsi_disk_release(struct device *dev) 1769 1759 { 1770 - struct scsi_disk *sdkp = to_scsi_disk(cdev); 1760 + struct scsi_disk *sdkp = to_scsi_disk(dev); 1771 1761 struct gendisk *disk = sdkp->disk; 1772 1762 1773 1763 spin_lock(&sd_index_lock);
+14 -14
drivers/scsi/ses.c
··· 107 107 unsigned char *desc) 108 108 { 109 109 int i, j, count = 0, descriptor = ecomp->number; 110 - struct scsi_device *sdev = to_scsi_device(edev->cdev.dev); 110 + struct scsi_device *sdev = to_scsi_device(edev->edev.parent); 111 111 struct ses_device *ses_dev = edev->scratch; 112 112 unsigned char *type_ptr = ses_dev->page1 + 12 + ses_dev->page1[11]; 113 113 unsigned char *desc_ptr = ses_dev->page2 + 8; ··· 137 137 struct enclosure_component *ecomp) 138 138 { 139 139 int i, j, count = 0, descriptor = ecomp->number; 140 - struct scsi_device *sdev = to_scsi_device(edev->cdev.dev); 140 + struct scsi_device *sdev = to_scsi_device(edev->edev.parent); 141 141 struct ses_device *ses_dev = edev->scratch; 142 142 unsigned char *type_ptr = ses_dev->page1 + 12 + ses_dev->page1[11]; 143 143 unsigned char *desc_ptr = ses_dev->page2 + 8; ··· 269 269 struct ses_host_edev *sed = data; 270 270 struct scsi_device *sdev; 271 271 272 - if (!scsi_is_sdev_device(edev->cdev.dev)) 272 + if (!scsi_is_sdev_device(edev->edev.parent)) 273 273 return 0; 274 274 275 - sdev = to_scsi_device(edev->cdev.dev); 275 + sdev = to_scsi_device(edev->edev.parent); 276 276 277 277 if (sdev->host != sed->shost) 278 278 return 0; ··· 407 407 408 408 #define INIT_ALLOC_SIZE 32 409 409 410 - static int ses_intf_add(struct class_device *cdev, 410 + static int ses_intf_add(struct device *cdev, 411 411 struct class_interface *intf) 412 412 { 413 - struct scsi_device *sdev = to_scsi_device(cdev->dev); 413 + struct scsi_device *sdev = to_scsi_device(cdev->parent); 414 414 struct scsi_device *tmp_sdev; 415 415 unsigned char *buf = NULL, *hdr_buf, *type_ptr, *desc_ptr = NULL, 416 416 *addl_desc_ptr = NULL; ··· 426 426 edev = enclosure_find(&sdev->host->shost_gendev); 427 427 if (edev) { 428 428 ses_match_to_enclosure(edev, sdev); 429 - class_device_put(&edev->cdev); 429 + put_device(&edev->edev); 430 430 } 431 431 return -ENODEV; 432 432 } ··· 515 515 if (!scomp) 516 516 goto err_free; 517 517 518 - edev = enclosure_register(cdev->dev, sdev->sdev_gendev.bus_id, 518 + edev = enclosure_register(cdev->parent, sdev->sdev_gendev.bus_id, 519 519 components, &ses_enclosure_callbacks); 520 520 if (IS_ERR(edev)) { 521 521 err = PTR_ERR(edev); ··· 625 625 return 0; 626 626 } 627 627 628 - static void ses_intf_remove(struct class_device *cdev, 628 + static void ses_intf_remove(struct device *cdev, 629 629 struct class_interface *intf) 630 630 { 631 - struct scsi_device *sdev = to_scsi_device(cdev->dev); 631 + struct scsi_device *sdev = to_scsi_device(cdev->parent); 632 632 struct enclosure_device *edev; 633 633 struct ses_device *ses_dev; 634 634 635 635 if (!scsi_device_enclosure(sdev)) 636 636 return; 637 637 638 - edev = enclosure_find(cdev->dev); 638 + edev = enclosure_find(cdev->parent); 639 639 if (!edev) 640 640 return; 641 641 ··· 649 649 650 650 kfree(edev->component[0].scratch); 651 651 652 - class_device_put(&edev->cdev); 652 + put_device(&edev->edev); 653 653 enclosure_unregister(edev); 654 654 } 655 655 656 656 static struct class_interface ses_interface = { 657 - .add = ses_intf_add, 658 - .remove = ses_intf_remove, 657 + .add_dev = ses_intf_add, 658 + .remove_dev = ses_intf_remove, 659 659 }; 660 660 661 661 static struct scsi_driver ses_template = {
+18 -18
drivers/scsi/sg.c
··· 101 101 #define SG_SECTOR_SZ 512 102 102 #define SG_SECTOR_MSK (SG_SECTOR_SZ - 1) 103 103 104 - static int sg_add(struct class_device *, struct class_interface *); 105 - static void sg_remove(struct class_device *, struct class_interface *); 104 + static int sg_add(struct device *, struct class_interface *); 105 + static void sg_remove(struct device *, struct class_interface *); 106 106 107 107 static DEFINE_IDR(sg_index_idr); 108 108 static DEFINE_RWLOCK(sg_index_lock); /* Also used to lock 109 109 file descriptor list for device */ 110 110 111 111 static struct class_interface sg_interface = { 112 - .add = sg_add, 113 - .remove = sg_remove, 112 + .add_dev = sg_add, 113 + .remove_dev = sg_remove, 114 114 }; 115 115 116 116 typedef struct sg_scatter_hold { /* holding area for scsi scatter gather info */ ··· 1401 1401 } 1402 1402 1403 1403 static int 1404 - sg_add(struct class_device *cl_dev, struct class_interface *cl_intf) 1404 + sg_add(struct device *cl_dev, struct class_interface *cl_intf) 1405 1405 { 1406 - struct scsi_device *scsidp = to_scsi_device(cl_dev->dev); 1406 + struct scsi_device *scsidp = to_scsi_device(cl_dev->parent); 1407 1407 struct gendisk *disk; 1408 1408 Sg_device *sdp = NULL; 1409 1409 struct cdev * cdev = NULL; ··· 1439 1439 1440 1440 sdp->cdev = cdev; 1441 1441 if (sg_sysfs_valid) { 1442 - struct class_device * sg_class_member; 1442 + struct device *sg_class_member; 1443 1443 1444 - sg_class_member = class_device_create(sg_sysfs_class, NULL, 1445 - MKDEV(SCSI_GENERIC_MAJOR, sdp->index), 1446 - cl_dev->dev, "%s", 1447 - disk->disk_name); 1444 + sg_class_member = device_create(sg_sysfs_class, cl_dev->parent, 1445 + MKDEV(SCSI_GENERIC_MAJOR, 1446 + sdp->index), 1447 + "%s", disk->disk_name); 1448 1448 if (IS_ERR(sg_class_member)) { 1449 1449 printk(KERN_ERR "sg_add: " 1450 - "class_device_create failed\n"); 1450 + "device_create failed\n"); 1451 1451 error = PTR_ERR(sg_class_member); 1452 1452 goto cdev_add_err; 1453 1453 } 1454 - class_set_devdata(sg_class_member, sdp); 1454 + dev_set_drvdata(sg_class_member, sdp); 1455 1455 error = sysfs_create_link(&scsidp->sdev_gendev.kobj, 1456 1456 &sg_class_member->kobj, "generic"); 1457 1457 if (error) ··· 1464 1464 "Attached scsi generic sg%d type %d\n", sdp->index, 1465 1465 scsidp->type); 1466 1466 1467 - class_set_devdata(cl_dev, sdp); 1467 + dev_set_drvdata(cl_dev, sdp); 1468 1468 1469 1469 return 0; 1470 1470 ··· 1482 1482 } 1483 1483 1484 1484 static void 1485 - sg_remove(struct class_device *cl_dev, struct class_interface *cl_intf) 1485 + sg_remove(struct device *cl_dev, struct class_interface *cl_intf) 1486 1486 { 1487 - struct scsi_device *scsidp = to_scsi_device(cl_dev->dev); 1488 - Sg_device *sdp = class_get_devdata(cl_dev); 1487 + struct scsi_device *scsidp = to_scsi_device(cl_dev->parent); 1488 + Sg_device *sdp = dev_get_drvdata(cl_dev); 1489 1489 unsigned long iflags; 1490 1490 Sg_fd *sfp; 1491 1491 Sg_fd *tsfp; ··· 1528 1528 write_unlock_irqrestore(&sg_index_lock, iflags); 1529 1529 1530 1530 sysfs_remove_link(&scsidp->sdev_gendev.kobj, "generic"); 1531 - class_device_destroy(sg_sysfs_class, MKDEV(SCSI_GENERIC_MAJOR, sdp->index)); 1531 + device_destroy(sg_sysfs_class, MKDEV(SCSI_GENERIC_MAJOR, sdp->index)); 1532 1532 cdev_del(sdp->cdev); 1533 1533 sdp->cdev = NULL; 1534 1534 put_disk(sdp->disk);
+44 -38
drivers/scsi/st.c
··· 4108 4108 if (STm->cdevs[j]) { 4109 4109 if (cdev == STm->cdevs[j]) 4110 4110 cdev = NULL; 4111 - class_device_destroy(st_sysfs_class, 4112 - MKDEV(SCSI_TAPE_MAJOR, 4113 - TAPE_MINOR(i, mode, j))); 4111 + device_destroy(st_sysfs_class, 4112 + MKDEV(SCSI_TAPE_MAJOR, 4113 + TAPE_MINOR(i, mode, j))); 4114 4114 cdev_del(STm->cdevs[j]); 4115 4115 } 4116 4116 } ··· 4148 4148 "tape"); 4149 4149 for (mode = 0; mode < ST_NBR_MODES; ++mode) { 4150 4150 for (j=0; j < 2; j++) { 4151 - class_device_destroy(st_sysfs_class, 4152 - MKDEV(SCSI_TAPE_MAJOR, 4153 - TAPE_MINOR(i, mode, j))); 4151 + device_destroy(st_sysfs_class, 4152 + MKDEV(SCSI_TAPE_MAJOR, 4153 + TAPE_MINOR(i, mode, j))); 4154 4154 cdev_del(tpnt->modes[mode].cdevs[j]); 4155 4155 tpnt->modes[mode].cdevs[j] = NULL; 4156 4156 } ··· 4319 4319 4320 4320 4321 4321 /* The sysfs simple class interface */ 4322 - static ssize_t st_defined_show(struct class_device *class_dev, char *buf) 4322 + static ssize_t 4323 + st_defined_show(struct device *dev, struct device_attribute *attr, char *buf) 4323 4324 { 4324 - struct st_modedef *STm = (struct st_modedef *)class_get_devdata(class_dev); 4325 + struct st_modedef *STm = (struct st_modedef *)dev_get_drvdata(dev); 4325 4326 ssize_t l = 0; 4326 4327 4327 4328 l = snprintf(buf, PAGE_SIZE, "%d\n", STm->defined); 4328 4329 return l; 4329 4330 } 4330 4331 4331 - CLASS_DEVICE_ATTR(defined, S_IRUGO, st_defined_show, NULL); 4332 + DEVICE_ATTR(defined, S_IRUGO, st_defined_show, NULL); 4332 4333 4333 - static ssize_t st_defblk_show(struct class_device *class_dev, char *buf) 4334 + static ssize_t 4335 + st_defblk_show(struct device *dev, struct device_attribute *attr, char *buf) 4334 4336 { 4335 - struct st_modedef *STm = (struct st_modedef *)class_get_devdata(class_dev); 4337 + struct st_modedef *STm = (struct st_modedef *)dev_get_drvdata(dev); 4336 4338 ssize_t l = 0; 4337 4339 4338 4340 l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_blksize); 4339 4341 return l; 4340 4342 } 4341 4343 4342 - CLASS_DEVICE_ATTR(default_blksize, S_IRUGO, st_defblk_show, NULL); 4344 + DEVICE_ATTR(default_blksize, S_IRUGO, st_defblk_show, NULL); 4343 4345 4344 - static ssize_t st_defdensity_show(struct class_device *class_dev, char *buf) 4346 + static ssize_t 4347 + st_defdensity_show(struct device *dev, struct device_attribute *attr, char *buf) 4345 4348 { 4346 - struct st_modedef *STm = (struct st_modedef *)class_get_devdata(class_dev); 4349 + struct st_modedef *STm = (struct st_modedef *)dev_get_drvdata(dev); 4347 4350 ssize_t l = 0; 4348 4351 char *fmt; 4349 4352 ··· 4355 4352 return l; 4356 4353 } 4357 4354 4358 - CLASS_DEVICE_ATTR(default_density, S_IRUGO, st_defdensity_show, NULL); 4355 + DEVICE_ATTR(default_density, S_IRUGO, st_defdensity_show, NULL); 4359 4356 4360 - static ssize_t st_defcompression_show(struct class_device *class_dev, char *buf) 4357 + static ssize_t 4358 + st_defcompression_show(struct device *dev, struct device_attribute *attr, 4359 + char *buf) 4361 4360 { 4362 - struct st_modedef *STm = (struct st_modedef *)class_get_devdata(class_dev); 4361 + struct st_modedef *STm = (struct st_modedef *)dev_get_drvdata(dev); 4363 4362 ssize_t l = 0; 4364 4363 4365 4364 l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_compression - 1); 4366 4365 return l; 4367 4366 } 4368 4367 4369 - CLASS_DEVICE_ATTR(default_compression, S_IRUGO, st_defcompression_show, NULL); 4368 + DEVICE_ATTR(default_compression, S_IRUGO, st_defcompression_show, NULL); 4370 4369 4371 - static ssize_t st_options_show(struct class_device *class_dev, char *buf) 4370 + static ssize_t 4371 + st_options_show(struct device *dev, struct device_attribute *attr, char *buf) 4372 4372 { 4373 - struct st_modedef *STm = (struct st_modedef *)class_get_devdata(class_dev); 4373 + struct st_modedef *STm = (struct st_modedef *)dev_get_drvdata(dev); 4374 4374 struct scsi_tape *STp; 4375 4375 int i, j, options; 4376 4376 ssize_t l = 0; ··· 4409 4403 return l; 4410 4404 } 4411 4405 4412 - CLASS_DEVICE_ATTR(options, S_IRUGO, st_options_show, NULL); 4406 + DEVICE_ATTR(options, S_IRUGO, st_options_show, NULL); 4413 4407 4414 4408 static int do_create_class_files(struct scsi_tape *STp, int dev_num, int mode) 4415 4409 { 4416 4410 int i, rew, error; 4417 4411 char name[10]; 4418 - struct class_device *st_class_member; 4412 + struct device *st_class_member; 4419 4413 4420 4414 for (rew=0; rew < 2; rew++) { 4421 4415 /* Make sure that the minor numbers corresponding to the four ··· 4424 4418 snprintf(name, 10, "%s%s%s", rew ? "n" : "", 4425 4419 STp->disk->disk_name, st_formats[i]); 4426 4420 st_class_member = 4427 - class_device_create(st_sysfs_class, NULL, 4428 - MKDEV(SCSI_TAPE_MAJOR, 4429 - TAPE_MINOR(dev_num, mode, rew)), 4430 - &STp->device->sdev_gendev, "%s", name); 4421 + device_create(st_sysfs_class, &STp->device->sdev_gendev, 4422 + MKDEV(SCSI_TAPE_MAJOR, 4423 + TAPE_MINOR(dev_num, mode, rew)), 4424 + "%s", name); 4431 4425 if (IS_ERR(st_class_member)) { 4432 - printk(KERN_WARNING "st%d: class_device_create failed\n", 4426 + printk(KERN_WARNING "st%d: device_create failed\n", 4433 4427 dev_num); 4434 4428 error = PTR_ERR(st_class_member); 4435 4429 goto out; 4436 4430 } 4437 - class_set_devdata(st_class_member, &STp->modes[mode]); 4431 + dev_set_drvdata(st_class_member, &STp->modes[mode]); 4438 4432 4439 - error = class_device_create_file(st_class_member, 4440 - &class_device_attr_defined); 4433 + error = device_create_file(st_class_member, 4434 + &dev_attr_defined); 4441 4435 if (error) goto out; 4442 - error = class_device_create_file(st_class_member, 4443 - &class_device_attr_default_blksize); 4436 + error = device_create_file(st_class_member, 4437 + &dev_attr_default_blksize); 4444 4438 if (error) goto out; 4445 - error = class_device_create_file(st_class_member, 4446 - &class_device_attr_default_density); 4439 + error = device_create_file(st_class_member, 4440 + &dev_attr_default_density); 4447 4441 if (error) goto out; 4448 - error = class_device_create_file(st_class_member, 4449 - &class_device_attr_default_compression); 4442 + error = device_create_file(st_class_member, 4443 + &dev_attr_default_compression); 4450 4444 if (error) goto out; 4451 - error = class_device_create_file(st_class_member, 4452 - &class_device_attr_options); 4445 + error = device_create_file(st_class_member, 4446 + &dev_attr_options); 4453 4447 if (error) goto out; 4454 4448 4455 4449 if (mode == 0 && rew == 0) {
+14 -14
include/linux/attribute_container.h
··· 1 1 /* 2 - * class_container.h - a generic container for all classes 2 + * attribute_container.h - a generic container for all classes 3 3 * 4 4 * Copyright (c) 2005 - James Bottomley <James.Bottomley@steeleye.com> 5 5 * ··· 18 18 struct klist containers; 19 19 struct class *class; 20 20 struct attribute_group *grp; 21 - struct class_device_attribute **attrs; 21 + struct device_attribute **attrs; 22 22 int (*match)(struct attribute_container *, struct device *); 23 23 #define ATTRIBUTE_CONTAINER_NO_CLASSDEVS 0x01 24 24 unsigned long flags; ··· 41 41 void attribute_container_create_device(struct device *dev, 42 42 int (*fn)(struct attribute_container *, 43 43 struct device *, 44 - struct class_device *)); 44 + struct device *)); 45 45 void attribute_container_add_device(struct device *dev, 46 46 int (*fn)(struct attribute_container *, 47 47 struct device *, 48 - struct class_device *)); 48 + struct device *)); 49 49 void attribute_container_remove_device(struct device *dev, 50 50 void (*fn)(struct attribute_container *, 51 51 struct device *, 52 - struct class_device *)); 52 + struct device *)); 53 53 void attribute_container_device_trigger(struct device *dev, 54 54 int (*fn)(struct attribute_container *, 55 55 struct device *, 56 - struct class_device *)); 56 + struct device *)); 57 57 void attribute_container_trigger(struct device *dev, 58 58 int (*fn)(struct attribute_container *, 59 59 struct device *)); 60 - int attribute_container_add_attrs(struct class_device *classdev); 61 - int attribute_container_add_class_device(struct class_device *classdev); 60 + int attribute_container_add_attrs(struct device *classdev); 61 + int attribute_container_add_class_device(struct device *classdev); 62 62 int attribute_container_add_class_device_adapter(struct attribute_container *cont, 63 63 struct device *dev, 64 - struct class_device *classdev); 65 - void attribute_container_remove_attrs(struct class_device *classdev); 66 - void attribute_container_class_device_del(struct class_device *classdev); 67 - struct attribute_container *attribute_container_classdev_to_container(struct class_device *); 68 - struct class_device *attribute_container_find_class_device(struct attribute_container *, struct device *); 69 - struct class_device_attribute **attribute_container_classdev_to_attrs(const struct class_device *classdev); 64 + struct device *classdev); 65 + void attribute_container_remove_attrs(struct device *classdev); 66 + void attribute_container_class_device_del(struct device *classdev); 67 + struct attribute_container *attribute_container_classdev_to_container(struct device *); 68 + struct device *attribute_container_find_class_device(struct attribute_container *, struct device *); 69 + struct device_attribute **attribute_container_classdev_to_attrs(const struct device *classdev); 70 70 71 71 #endif
+1 -1
include/linux/bsg.h
··· 55 55 56 56 #if defined(CONFIG_BLK_DEV_BSG) 57 57 struct bsg_class_device { 58 - struct class_device *class_dev; 58 + struct device *class_dev; 59 59 struct device *dev; 60 60 int minor; 61 61 struct request_queue *queue;
+6 -5
include/linux/enclosure.h
··· 82 82 83 83 struct enclosure_component { 84 84 void *scratch; 85 - struct class_device cdev; 85 + struct device cdev; 86 + struct device *dev; 86 87 enum enclosure_component_type type; 87 88 int number; 88 89 int fault; ··· 95 94 struct enclosure_device { 96 95 void *scratch; 97 96 struct list_head node; 98 - struct class_device cdev; 97 + struct device edev; 99 98 struct enclosure_component_callbacks *cb; 100 99 int components; 101 100 struct enclosure_component component[0]; 102 101 }; 103 102 104 103 static inline struct enclosure_device * 105 - to_enclosure_device(struct class_device *dev) 104 + to_enclosure_device(struct device *dev) 106 105 { 107 - return container_of(dev, struct enclosure_device, cdev); 106 + return container_of(dev, struct enclosure_device, edev); 108 107 } 109 108 110 109 static inline struct enclosure_component * 111 - to_enclosure_component(struct class_device *dev) 110 + to_enclosure_component(struct device *dev) 112 111 { 113 112 return container_of(dev, struct enclosure_component, cdev); 114 113 }
+1 -1
include/linux/libata.h
··· 443 443 MAX_PERFORMANCE, 444 444 MEDIUM_POWER, 445 445 }; 446 - extern struct class_device_attribute class_device_attr_link_power_management_policy; 446 + extern struct device_attribute dev_attr_link_power_management_policy; 447 447 448 448 #ifdef CONFIG_ATA_SFF 449 449 struct ata_ioports {
+6 -6
include/linux/raid_class.h
··· 53 53 #define DEFINE_RAID_ATTRIBUTE(type, attr) \ 54 54 static inline void \ 55 55 raid_set_##attr(struct raid_template *r, struct device *dev, type value) { \ 56 - struct class_device *cdev = \ 56 + struct device *device = \ 57 57 attribute_container_find_class_device(&r->raid_attrs.ac, dev);\ 58 58 struct raid_data *rd; \ 59 - BUG_ON(!cdev); \ 60 - rd = class_get_devdata(cdev); \ 59 + BUG_ON(!device); \ 60 + rd = dev_get_drvdata(device); \ 61 61 rd->attr = value; \ 62 62 } \ 63 63 static inline type \ 64 64 raid_get_##attr(struct raid_template *r, struct device *dev) { \ 65 - struct class_device *cdev = \ 65 + struct device *device = \ 66 66 attribute_container_find_class_device(&r->raid_attrs.ac, dev);\ 67 67 struct raid_data *rd; \ 68 - BUG_ON(!cdev); \ 69 - rd = class_get_devdata(cdev); \ 68 + BUG_ON(!device); \ 69 + rd = dev_get_drvdata(device); \ 70 70 return rd->attr; \ 71 71 } 72 72
+3 -3
include/linux/transport_class.h
··· 17 17 struct transport_class { 18 18 struct class class; 19 19 int (*setup)(struct transport_container *, struct device *, 20 - struct class_device *); 20 + struct device *); 21 21 int (*configure)(struct transport_container *, struct device *, 22 - struct class_device *); 22 + struct device *); 23 23 int (*remove)(struct transport_container *, struct device *, 24 - struct class_device *); 24 + struct device *); 25 25 }; 26 26 27 27 #define DECLARE_TRANSPORT_CLASS(cls, nm, su, rm, cfg) \
+5 -5
include/scsi/scsi_device.h
··· 156 156 157 157 int timeout; 158 158 159 - struct device sdev_gendev; 160 - struct class_device sdev_classdev; 159 + struct device sdev_gendev, 160 + sdev_dev; 161 161 162 162 struct execute_work ew; /* used to get process context on put */ 163 163 ··· 167 167 #define to_scsi_device(d) \ 168 168 container_of(d, struct scsi_device, sdev_gendev) 169 169 #define class_to_sdev(d) \ 170 - container_of(d, struct scsi_device, sdev_classdev) 170 + container_of(d, struct scsi_device, sdev_dev) 171 171 #define transport_class_to_sdev(class_dev) \ 172 - to_scsi_device(class_dev->dev) 172 + to_scsi_device(class_dev->parent) 173 173 174 174 #define sdev_printk(prefix, sdev, fmt, a...) \ 175 175 dev_printk(prefix, &(sdev)->sdev_gendev, fmt, ##a) ··· 220 220 return to_scsi_target(sdev->sdev_gendev.parent); 221 221 } 222 222 #define transport_class_to_starget(class_dev) \ 223 - to_scsi_target(class_dev->dev) 223 + to_scsi_target(class_dev->parent) 224 224 225 225 #define starget_printk(prefix, starget, fmt, a...) \ 226 226 dev_printk(prefix, &(starget)->dev, fmt, ##a)
+3 -4
include/scsi/scsi_host.h
··· 470 470 /* 471 471 * Pointer to the sysfs class properties for this host, NULL terminated. 472 472 */ 473 - struct class_device_attribute **shost_attrs; 473 + struct device_attribute **shost_attrs; 474 474 475 475 /* 476 476 * Pointer to the SCSI device properties for this host, NULL terminated. ··· 655 655 enum scsi_host_state shost_state; 656 656 657 657 /* ldm bits */ 658 - struct device shost_gendev; 659 - struct class_device shost_classdev; 658 + struct device shost_gendev, shost_dev; 660 659 661 660 /* 662 661 * List of hosts per template. ··· 682 683 }; 683 684 684 685 #define class_to_shost(d) \ 685 - container_of(d, struct Scsi_Host, shost_classdev) 686 + container_of(d, struct Scsi_Host, shost_dev) 686 687 687 688 #define shost_printk(prefix, shost, fmt, a...) \ 688 689 dev_printk(prefix, &(shost)->shost_gendev, fmt, ##a)
+1 -1
include/scsi/scsi_transport.h
··· 80 80 }; 81 81 82 82 #define transport_class_to_shost(tc) \ 83 - dev_to_shost((tc)->dev) 83 + dev_to_shost((tc)->parent) 84 84 85 85 86 86 /* Private area maintenance. The driver requested allocations come
+7 -7
include/scsi/scsi_transport_fc.h
··· 163 163 164 164 165 165 /* Macro for use in defining Virtual Port attributes */ 166 - #define FC_VPORT_ATTR(_name,_mode,_show,_store) \ 167 - struct class_device_attribute class_device_attr_vport_##_name = \ 166 + #define FC_VPORT_ATTR(_name,_mode,_show,_store) \ 167 + struct device_attribute dev_attr_vport_##_name = \ 168 168 __ATTR(_name,_mode,_show,_store) 169 169 170 170 ··· 234 234 235 235 #define dev_to_vport(d) \ 236 236 container_of(d, struct fc_vport, dev) 237 - #define transport_class_to_vport(classdev) \ 238 - dev_to_vport(classdev->dev) 237 + #define transport_class_to_vport(dev) \ 238 + dev_to_vport(dev->parent) 239 239 #define vport_to_shost(v) \ 240 240 (v->shost) 241 241 #define vport_to_shost_channel(v) \ ··· 271 271 272 272 /* Macro for use in defining Remote Port attributes */ 273 273 #define FC_RPORT_ATTR(_name,_mode,_show,_store) \ 274 - struct class_device_attribute class_device_attr_rport_##_name = \ 274 + struct device_attribute dev_attr_rport_##_name = \ 275 275 __ATTR(_name,_mode,_show,_store) 276 276 277 277 ··· 341 341 342 342 #define dev_to_rport(d) \ 343 343 container_of(d, struct fc_rport, dev) 344 - #define transport_class_to_rport(classdev) \ 345 - dev_to_rport(classdev->dev) 344 + #define transport_class_to_rport(dev) \ 345 + dev_to_rport(dev->parent) 346 346 #define rport_to_shost(r) \ 347 347 dev_to_shost(r->dev.parent) 348 348
+6 -6
include/scsi/scsi_transport_sas.h
··· 80 80 81 81 #define dev_to_phy(d) \ 82 82 container_of((d), struct sas_phy, dev) 83 - #define transport_class_to_phy(cdev) \ 84 - dev_to_phy((cdev)->dev) 83 + #define transport_class_to_phy(dev) \ 84 + dev_to_phy((dev)->parent) 85 85 #define phy_to_shost(phy) \ 86 86 dev_to_shost((phy)->dev.parent) 87 87 ··· 96 96 97 97 #define dev_to_rphy(d) \ 98 98 container_of((d), struct sas_rphy, dev) 99 - #define transport_class_to_rphy(cdev) \ 100 - dev_to_rphy((cdev)->dev) 99 + #define transport_class_to_rphy(dev) \ 100 + dev_to_rphy((dev)->parent) 101 101 #define rphy_to_shost(rphy) \ 102 102 dev_to_shost((rphy)->dev.parent) 103 103 #define target_to_rphy(targ) \ ··· 152 152 153 153 #define dev_to_sas_port(d) \ 154 154 container_of((d), struct sas_port, dev) 155 - #define transport_class_to_sas_port(cdev) \ 156 - dev_to_sas_port((cdev)->dev) 155 + #define transport_class_to_sas_port(dev) \ 156 + dev_to_sas_port((dev)->parent) 157 157 158 158 struct sas_phy_linkrates { 159 159 enum sas_linkrate maximum_linkrate;
+2 -2
include/scsi/sd.h
··· 34 34 struct scsi_disk { 35 35 struct scsi_driver *driver; /* always &sd_template */ 36 36 struct scsi_device *device; 37 - struct class_device cdev; 37 + struct device dev; 38 38 struct gendisk *disk; 39 39 unsigned int openers; /* protected by BKL for now, yuck */ 40 40 sector_t capacity; /* size in 512-byte sectors */ ··· 46 46 unsigned RCD : 1; /* state of disk RCD bit, unused */ 47 47 unsigned DPOFUA : 1; /* state of disk DPOFUA bit */ 48 48 }; 49 - #define to_scsi_disk(obj) container_of(obj,struct scsi_disk,cdev) 49 + #define to_scsi_disk(obj) container_of(obj,struct scsi_disk,dev) 50 50 51 51 #define sd_printk(prefix, sdsk, fmt, a...) \ 52 52 (sdsk)->disk ? \