scsi_sysfs.c (1212663fba7c5e003e05d24f043d5ed57eb18b24) | scsi_sysfs.c (a341cd0f6a0fde1f85fec9aa8f81f824ea4a3f92) |
---|---|
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 --- 254 unchanged lines hidden (view full) --- 263 put_device(&sdev->sdev_gendev); 264} 265 266static void scsi_device_dev_release_usercontext(struct work_struct *work) 267{ 268 struct scsi_device *sdev; 269 struct device *parent; 270 struct scsi_target *starget; | 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 --- 254 unchanged lines hidden (view full) --- 263 put_device(&sdev->sdev_gendev); 264} 265 266static void scsi_device_dev_release_usercontext(struct work_struct *work) 267{ 268 struct scsi_device *sdev; 269 struct device *parent; 270 struct scsi_target *starget; |
271 struct list_head *this, *tmp; |
|
271 unsigned long flags; 272 273 sdev = container_of(work, struct scsi_device, ew.work); 274 275 parent = sdev->sdev_gendev.parent; 276 starget = to_scsi_target(parent); 277 278 spin_lock_irqsave(sdev->host->host_lock, flags); 279 starget->reap_ref++; 280 list_del(&sdev->siblings); 281 list_del(&sdev->same_target_siblings); 282 list_del(&sdev->starved_entry); 283 spin_unlock_irqrestore(sdev->host->host_lock, flags); 284 | 272 unsigned long flags; 273 274 sdev = container_of(work, struct scsi_device, ew.work); 275 276 parent = sdev->sdev_gendev.parent; 277 starget = to_scsi_target(parent); 278 279 spin_lock_irqsave(sdev->host->host_lock, flags); 280 starget->reap_ref++; 281 list_del(&sdev->siblings); 282 list_del(&sdev->same_target_siblings); 283 list_del(&sdev->starved_entry); 284 spin_unlock_irqrestore(sdev->host->host_lock, flags); 285 |
286 cancel_work_sync(&sdev->event_work); 287 288 list_for_each_safe(this, tmp, &sdev->event_list) { 289 struct scsi_event *evt; 290 291 evt = list_entry(this, struct scsi_event, node); 292 list_del(&evt->node); 293 kfree(evt); 294 } 295 |
|
285 if (sdev->request_queue) { 286 sdev->request_queue->queuedata = NULL; 287 /* user context needed to free queue */ 288 scsi_free_queue(sdev->request_queue); 289 /* temporary expedient, try to catch use of queue lock 290 * after free of sdev */ 291 sdev->request_queue = NULL; 292 } --- 316 unchanged lines hidden (view full) --- 609sdev_show_modalias(struct device *dev, struct device_attribute *attr, char *buf) 610{ 611 struct scsi_device *sdev; 612 sdev = to_scsi_device(dev); 613 return snprintf (buf, 20, SCSI_DEVICE_MODALIAS_FMT "\n", sdev->type); 614} 615static DEVICE_ATTR(modalias, S_IRUGO, sdev_show_modalias, NULL); 616 | 296 if (sdev->request_queue) { 297 sdev->request_queue->queuedata = NULL; 298 /* user context needed to free queue */ 299 scsi_free_queue(sdev->request_queue); 300 /* temporary expedient, try to catch use of queue lock 301 * after free of sdev */ 302 sdev->request_queue = NULL; 303 } --- 316 unchanged lines hidden (view full) --- 620sdev_show_modalias(struct device *dev, struct device_attribute *attr, char *buf) 621{ 622 struct scsi_device *sdev; 623 sdev = to_scsi_device(dev); 624 return snprintf (buf, 20, SCSI_DEVICE_MODALIAS_FMT "\n", sdev->type); 625} 626static DEVICE_ATTR(modalias, S_IRUGO, sdev_show_modalias, NULL); 627 |
628#define DECLARE_EVT_SHOW(name, Cap_name) \ 629static ssize_t \ 630sdev_show_evt_##name(struct device *dev, struct device_attribute *attr, \ 631 char *buf) \ 632{ \ 633 struct scsi_device *sdev = to_scsi_device(dev); \ 634 int val = test_bit(SDEV_EVT_##Cap_name, sdev->supported_events);\ 635 return snprintf(buf, 20, "%d\n", val); \ 636} 637 638#define DECLARE_EVT_STORE(name, Cap_name) \ 639static ssize_t \ 640sdev_store_evt_##name(struct device *dev, struct device_attribute *attr, \ 641 const char *buf, size_t count) \ 642{ \ 643 struct scsi_device *sdev = to_scsi_device(dev); \ 644 int val = simple_strtoul(buf, NULL, 0); \ 645 if (val == 0) \ 646 clear_bit(SDEV_EVT_##Cap_name, sdev->supported_events); \ 647 else if (val == 1) \ 648 set_bit(SDEV_EVT_##Cap_name, sdev->supported_events); \ 649 else \ 650 return -EINVAL; \ 651 return count; \ 652} 653 654#define DECLARE_EVT(name, Cap_name) \ 655 DECLARE_EVT_SHOW(name, Cap_name) \ 656 DECLARE_EVT_STORE(name, Cap_name) \ 657 static DEVICE_ATTR(evt_##name, S_IRUGO, sdev_show_evt_##name, \ 658 sdev_store_evt_##name); 659#define REF_EVT(name) &dev_attr_evt_##name.attr 660 661DECLARE_EVT(media_change, MEDIA_CHANGE) 662 |
|
617/* Default template for device attributes. May NOT be modified */ 618static struct attribute *scsi_sdev_attrs[] = { 619 &dev_attr_device_blocked.attr, 620 &dev_attr_type.attr, 621 &dev_attr_scsi_level.attr, 622 &dev_attr_vendor.attr, 623 &dev_attr_model.attr, 624 &dev_attr_rev.attr, 625 &dev_attr_rescan.attr, 626 &dev_attr_delete.attr, 627 &dev_attr_state.attr, 628 &dev_attr_timeout.attr, 629 &dev_attr_iocounterbits.attr, 630 &dev_attr_iorequest_cnt.attr, 631 &dev_attr_iodone_cnt.attr, 632 &dev_attr_ioerr_cnt.attr, 633 &dev_attr_modalias.attr, | 663/* Default template for device attributes. May NOT be modified */ 664static struct attribute *scsi_sdev_attrs[] = { 665 &dev_attr_device_blocked.attr, 666 &dev_attr_type.attr, 667 &dev_attr_scsi_level.attr, 668 &dev_attr_vendor.attr, 669 &dev_attr_model.attr, 670 &dev_attr_rev.attr, 671 &dev_attr_rescan.attr, 672 &dev_attr_delete.attr, 673 &dev_attr_state.attr, 674 &dev_attr_timeout.attr, 675 &dev_attr_iocounterbits.attr, 676 &dev_attr_iorequest_cnt.attr, 677 &dev_attr_iodone_cnt.attr, 678 &dev_attr_ioerr_cnt.attr, 679 &dev_attr_modalias.attr, |
680 REF_EVT(media_change), |
|
634 NULL 635}; 636 637static struct attribute_group scsi_sdev_attr_group = { 638 .attrs = scsi_sdev_attrs, 639}; 640 641static struct attribute_group *scsi_sdev_attr_groups[] = { --- 360 unchanged lines hidden --- | 681 NULL 682}; 683 684static struct attribute_group scsi_sdev_attr_group = { 685 .attrs = scsi_sdev_attrs, 686}; 687 688static struct attribute_group *scsi_sdev_attr_groups[] = { --- 360 unchanged lines hidden --- |