scsi_sysfs.c (3991e4605dd3a8c7180a5ddd60d802108e880027) | scsi_sysfs.c (ccf1e0045eea8f98d60fc9327bcb14c958d2e4c7) |
---|---|
1/* 2 * scsi_sysfs.c 3 * 4 * SCSI sysfs interface routines. 5 * 6 * Created to pull SCSI mid layer sysfs routines into one file. 7 */ 8 --- 414 unchanged lines hidden (view full) --- 423 put_device(&sdev->sdev_gendev); 424} 425 426static void scsi_device_dev_release_usercontext(struct work_struct *work) 427{ 428 struct scsi_device *sdev; 429 struct device *parent; 430 struct list_head *this, *tmp; | 1/* 2 * scsi_sysfs.c 3 * 4 * SCSI sysfs interface routines. 5 * 6 * Created to pull SCSI mid layer sysfs routines into one file. 7 */ 8 --- 414 unchanged lines hidden (view full) --- 423 put_device(&sdev->sdev_gendev); 424} 425 426static void scsi_device_dev_release_usercontext(struct work_struct *work) 427{ 428 struct scsi_device *sdev; 429 struct device *parent; 430 struct list_head *this, *tmp; |
431 struct scsi_vpd *vpd_pg80 = NULL, *vpd_pg83 = NULL; |
|
431 unsigned long flags; 432 433 sdev = container_of(work, struct scsi_device, ew.work); 434 435 scsi_dh_release_device(sdev); 436 437 parent = sdev->sdev_gendev.parent; 438 --- 12 unchanged lines hidden (view full) --- 451 list_del(&evt->node); 452 kfree(evt); 453 } 454 455 blk_put_queue(sdev->request_queue); 456 /* NULL queue means the device can't be used */ 457 sdev->request_queue = NULL; 458 | 432 unsigned long flags; 433 434 sdev = container_of(work, struct scsi_device, ew.work); 435 436 scsi_dh_release_device(sdev); 437 438 parent = sdev->sdev_gendev.parent; 439 --- 12 unchanged lines hidden (view full) --- 452 list_del(&evt->node); 453 kfree(evt); 454 } 455 456 blk_put_queue(sdev->request_queue); 457 /* NULL queue means the device can't be used */ 458 sdev->request_queue = NULL; 459 |
459 kfree(sdev->vpd_pg83); 460 kfree(sdev->vpd_pg80); | 460 mutex_lock(&sdev->inquiry_mutex); 461 rcu_swap_protected(sdev->vpd_pg80, vpd_pg80, 462 lockdep_is_held(&sdev->inquiry_mutex)); 463 rcu_swap_protected(sdev->vpd_pg83, vpd_pg83, 464 lockdep_is_held(&sdev->inquiry_mutex)); 465 mutex_unlock(&sdev->inquiry_mutex); 466 467 if (vpd_pg83) 468 kfree_rcu(vpd_pg83, rcu); 469 if (vpd_pg80) 470 kfree_rcu(vpd_pg80, rcu); |
461 kfree(sdev->inquiry); 462 kfree(sdev); 463 464 if (parent) 465 put_device(parent); 466} 467 468static void scsi_device_dev_release(struct device *dev) --- 321 unchanged lines hidden (view full) --- 790#define sdev_vpd_pg_attr(_page) \ 791static ssize_t \ 792show_vpd_##_page(struct file *filp, struct kobject *kobj, \ 793 struct bin_attribute *bin_attr, \ 794 char *buf, loff_t off, size_t count) \ 795{ \ 796 struct device *dev = container_of(kobj, struct device, kobj); \ 797 struct scsi_device *sdev = to_scsi_device(dev); \ | 471 kfree(sdev->inquiry); 472 kfree(sdev); 473 474 if (parent) 475 put_device(parent); 476} 477 478static void scsi_device_dev_release(struct device *dev) --- 321 unchanged lines hidden (view full) --- 800#define sdev_vpd_pg_attr(_page) \ 801static ssize_t \ 802show_vpd_##_page(struct file *filp, struct kobject *kobj, \ 803 struct bin_attribute *bin_attr, \ 804 char *buf, loff_t off, size_t count) \ 805{ \ 806 struct device *dev = container_of(kobj, struct device, kobj); \ 807 struct scsi_device *sdev = to_scsi_device(dev); \ |
798 int ret; \ 799 if (!sdev->vpd_##_page) \ 800 return -EINVAL; \ | 808 struct scsi_vpd *vpd_page; \ 809 int ret = -EINVAL; \ 810 \ |
801 rcu_read_lock(); \ | 811 rcu_read_lock(); \ |
802 ret = memory_read_from_buffer(buf, count, &off, \ 803 rcu_dereference(sdev->vpd_##_page), \ 804 sdev->vpd_##_page##_len); \ | 812 vpd_page = rcu_dereference(sdev->vpd_##_page); \ 813 if (vpd_page) \ 814 ret = memory_read_from_buffer(buf, count, &off, \ 815 vpd_page->data, vpd_page->len); \ |
805 rcu_read_unlock(); \ | 816 rcu_read_unlock(); \ |
806 return ret; \ | 817 return ret; \ |
807} \ 808static struct bin_attribute dev_attr_vpd_##_page = { \ 809 .attr = {.name = __stringify(vpd_##_page), .mode = S_IRUGO }, \ 810 .size = 0, \ 811 .read = show_vpd_##_page, \ 812}; 813 814sdev_vpd_pg_attr(pg83); --- 700 unchanged lines hidden --- | 818} \ 819static struct bin_attribute dev_attr_vpd_##_page = { \ 820 .attr = {.name = __stringify(vpd_##_page), .mode = S_IRUGO }, \ 821 .size = 0, \ 822 .read = show_vpd_##_page, \ 823}; 824 825sdev_vpd_pg_attr(pg83); --- 700 unchanged lines hidden --- |