Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 282223
b: refs/heads/master
c: 2b13257
h: refs/heads/master
i:
  282221: d57b006
  282219: 78e90df
  282215: 10478a7
  282207: f5b0381
v: v3
  • Loading branch information
Moger, Babu authored and James Bottomley committed Dec 15, 2011
1 parent 0425d10 commit 14b9982
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 61 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bee89eae8de143b1d9f82ab7ab6d9daef8e44760
refs/heads/master: 2b132577a05ec2970581c99da70825430d5919df
58 changes: 0 additions & 58 deletions trunk/drivers/scsi/device_handler/scsi_dh.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

static DEFINE_SPINLOCK(list_lock);
static LIST_HEAD(scsi_dh_list);
static int scsi_dh_list_idx = 1;

static struct scsi_device_handler *get_device_handler(const char *name)
{
Expand All @@ -45,21 +44,6 @@ static struct scsi_device_handler *get_device_handler(const char *name)
return found;
}

static struct scsi_device_handler *get_device_handler_by_idx(int idx)
{
struct scsi_device_handler *tmp, *found = NULL;

spin_lock(&list_lock);
list_for_each_entry(tmp, &scsi_dh_list, list) {
if (tmp->idx == idx) {
found = tmp;
break;
}
}
spin_unlock(&list_lock);
return found;
}

/*
* device_handler_match_function - Match a device handler to a device
* @sdev - SCSI device to be tested
Expand All @@ -83,23 +67,6 @@ device_handler_match_function(struct scsi_device *sdev)
return found_dh;
}

/*
* device_handler_match_devlist - Match a device handler to a device
* @sdev - SCSI device to be tested
*
* Tests @sdev against all device_handler registered in the devlist.
* Returns the found device handler or NULL if not found.
*/
static struct scsi_device_handler *
device_handler_match_devlist(struct scsi_device *sdev)
{
int idx;

idx = scsi_get_device_flags_keyed(sdev, sdev->vendor, sdev->model,
SCSI_DEVINFO_DH);
return get_device_handler_by_idx(idx);
}

/*
* device_handler_match - Attach a device handler to a device
* @scsi_dh - The device handler to match against or NULL
Expand All @@ -116,8 +83,6 @@ device_handler_match(struct scsi_device_handler *scsi_dh,
struct scsi_device_handler *found_dh;

found_dh = device_handler_match_function(sdev);
if (!found_dh)
found_dh = device_handler_match_devlist(sdev);

if (scsi_dh && found_dh != scsi_dh)
found_dh = NULL;
Expand Down Expand Up @@ -361,25 +326,14 @@ static int scsi_dh_notifier_remove(struct device *dev, void *data)
*/
int scsi_register_device_handler(struct scsi_device_handler *scsi_dh)
{
int i;

if (get_device_handler(scsi_dh->name))
return -EBUSY;

spin_lock(&list_lock);
scsi_dh->idx = scsi_dh_list_idx++;
list_add(&scsi_dh->list, &scsi_dh_list);
spin_unlock(&list_lock);

for (i = 0; scsi_dh->devlist && scsi_dh->devlist[i].vendor; i++) {
scsi_dev_info_list_add_keyed(0,
scsi_dh->devlist[i].vendor,
scsi_dh->devlist[i].model,
NULL,
scsi_dh->idx,
SCSI_DEVINFO_DH);
}

bus_for_each_dev(&scsi_bus_type, NULL, scsi_dh, scsi_dh_notifier_add);
printk(KERN_INFO "%s: device handler registered\n", scsi_dh->name);

Expand All @@ -396,20 +350,13 @@ EXPORT_SYMBOL_GPL(scsi_register_device_handler);
*/
int scsi_unregister_device_handler(struct scsi_device_handler *scsi_dh)
{
int i;

if (!get_device_handler(scsi_dh->name))
return -ENODEV;

bus_for_each_dev(&scsi_bus_type, NULL, scsi_dh,
scsi_dh_notifier_remove);

for (i = 0; scsi_dh->devlist && scsi_dh->devlist[i].vendor; i++) {
scsi_dev_info_list_del_keyed(scsi_dh->devlist[i].vendor,
scsi_dh->devlist[i].model,
SCSI_DEVINFO_DH);
}

spin_lock(&list_lock);
list_del(&scsi_dh->list);
spin_unlock(&list_lock);
Expand Down Expand Up @@ -588,10 +535,6 @@ static int __init scsi_dh_init(void)
{
int r;

r = scsi_dev_info_add_list(SCSI_DEVINFO_DH, "SCSI Device Handler");
if (r)
return r;

r = bus_register_notifier(&scsi_bus_type, &scsi_dh_nb);

if (!r)
Expand All @@ -606,7 +549,6 @@ static void __exit scsi_dh_exit(void)
bus_for_each_dev(&scsi_bus_type, NULL, NULL,
scsi_dh_sysfs_attr_remove);
bus_unregister_notifier(&scsi_bus_type, &scsi_dh_nb);
scsi_dev_info_remove_list(SCSI_DEVINFO_DH);
}

module_init(scsi_dh_init);
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/scsi/scsi_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ static inline void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
enum {
SCSI_DEVINFO_GLOBAL = 0,
SCSI_DEVINFO_SPI,
SCSI_DEVINFO_DH,
};

extern int scsi_get_device_flags(struct scsi_device *sdev,
Expand Down
1 change: 0 additions & 1 deletion trunk/include/scsi/scsi_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ typedef void (*activate_complete)(void *, int);
struct scsi_device_handler {
/* Used by the infrastructure */
struct list_head list; /* list of scsi_device_handlers */
int idx;

/* Filled by the hardware handler */
struct module *module;
Expand Down

0 comments on commit 14b9982

Please sign in to comment.