mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
56d110e852
commit
ee959b00c3
11
block/bsg.c
11
block/bsg.c
@@ -758,7 +758,7 @@ static struct bsg_device *bsg_add_device(struct inode *inode,
|
||||
mutex_lock(&bsg_mutex);
|
||||
hlist_add_head(&bd->dev_list, bsg_dev_idx_hash(iminor(inode)));
|
||||
|
||||
strncpy(bd->name, rq->bsg_dev.class_dev->class_id, sizeof(bd->name) - 1);
|
||||
strncpy(bd->name, rq->bsg_dev.class_dev->bus_id, sizeof(bd->name) - 1);
|
||||
dprintk("bound to <%s>, max queue %d\n",
|
||||
format_dev_t(buf, inode->i_rdev), bd->max_queue);
|
||||
|
||||
@@ -946,7 +946,7 @@ void bsg_unregister_queue(struct request_queue *q)
|
||||
mutex_lock(&bsg_mutex);
|
||||
idr_remove(&bsg_minor_idr, bcd->minor);
|
||||
sysfs_remove_link(&q->kobj, "bsg");
|
||||
class_device_unregister(bcd->class_dev);
|
||||
device_unregister(bcd->class_dev);
|
||||
put_device(bcd->dev);
|
||||
bcd->class_dev = NULL;
|
||||
mutex_unlock(&bsg_mutex);
|
||||
@@ -959,7 +959,7 @@ int bsg_register_queue(struct request_queue *q, struct device *gdev,
|
||||
struct bsg_class_device *bcd;
|
||||
dev_t dev;
|
||||
int ret, minor;
|
||||
struct class_device *class_dev = NULL;
|
||||
struct device *class_dev = NULL;
|
||||
const char *devname;
|
||||
|
||||
if (name)
|
||||
@@ -998,8 +998,7 @@ int bsg_register_queue(struct request_queue *q, struct device *gdev,
|
||||
bcd->queue = q;
|
||||
bcd->dev = get_device(gdev);
|
||||
dev = MKDEV(bsg_major, bcd->minor);
|
||||
class_dev = class_device_create(bsg_class, NULL, dev, gdev, "%s",
|
||||
devname);
|
||||
class_dev = device_create(bsg_class, gdev, dev, "%s", devname);
|
||||
if (IS_ERR(class_dev)) {
|
||||
ret = PTR_ERR(class_dev);
|
||||
goto put_dev;
|
||||
@@ -1016,7 +1015,7 @@ int bsg_register_queue(struct request_queue *q, struct device *gdev,
|
||||
return 0;
|
||||
|
||||
unregister_class_dev:
|
||||
class_device_unregister(class_dev);
|
||||
device_unregister(class_dev);
|
||||
put_dev:
|
||||
put_device(gdev);
|
||||
remove_idr:
|
||||
|
||||
@@ -273,8 +273,8 @@ static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
|
||||
static int ahci_pci_device_resume(struct pci_dev *pdev);
|
||||
#endif
|
||||
|
||||
static struct class_device_attribute *ahci_shost_attrs[] = {
|
||||
&class_device_attr_link_power_management_policy,
|
||||
static struct device_attribute *ahci_shost_attrs[] = {
|
||||
&dev_attr_link_power_management_policy,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -131,10 +131,11 @@ static const char *ata_scsi_lpm_get(enum link_pm policy)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static ssize_t ata_scsi_lpm_put(struct class_device *class_dev,
|
||||
const char *buf, size_t count)
|
||||
static ssize_t ata_scsi_lpm_put(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct Scsi_Host *shost = class_to_shost(class_dev);
|
||||
struct Scsi_Host *shost = class_to_shost(dev);
|
||||
struct ata_port *ap = ata_shost_to_port(shost);
|
||||
enum link_pm policy = 0;
|
||||
int i;
|
||||
@@ -162,9 +163,9 @@ static ssize_t ata_scsi_lpm_put(struct class_device *class_dev,
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
ata_scsi_lpm_show(struct class_device *class_dev, char *buf)
|
||||
ata_scsi_lpm_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct Scsi_Host *shost = class_to_shost(class_dev);
|
||||
struct Scsi_Host *shost = class_to_shost(dev);
|
||||
struct ata_port *ap = ata_shost_to_port(shost);
|
||||
const char *policy =
|
||||
ata_scsi_lpm_get(ap->pm_policy);
|
||||
@@ -174,9 +175,9 @@ ata_scsi_lpm_show(struct class_device *class_dev, char *buf)
|
||||
|
||||
return snprintf(buf, 23, "%s\n", policy);
|
||||
}
|
||||
CLASS_DEVICE_ATTR(link_power_management_policy, S_IRUGO | S_IWUSR,
|
||||
DEVICE_ATTR(link_power_management_policy, S_IRUGO | S_IWUSR,
|
||||
ata_scsi_lpm_show, ata_scsi_lpm_put);
|
||||
EXPORT_SYMBOL_GPL(class_device_attr_link_power_management_policy);
|
||||
EXPORT_SYMBOL_GPL(dev_attr_link_power_management_policy);
|
||||
|
||||
static void ata_scsi_invalid_field(struct scsi_cmnd *cmd,
|
||||
void (*done)(struct scsi_cmnd *))
|
||||
|
||||
@@ -27,21 +27,21 @@
|
||||
struct internal_container {
|
||||
struct klist_node node;
|
||||
struct attribute_container *cont;
|
||||
struct class_device classdev;
|
||||
struct device classdev;
|
||||
};
|
||||
|
||||
static void internal_container_klist_get(struct klist_node *n)
|
||||
{
|
||||
struct internal_container *ic =
|
||||
container_of(n, struct internal_container, node);
|
||||
class_device_get(&ic->classdev);
|
||||
get_device(&ic->classdev);
|
||||
}
|
||||
|
||||
static void internal_container_klist_put(struct klist_node *n)
|
||||
{
|
||||
struct internal_container *ic =
|
||||
container_of(n, struct internal_container, node);
|
||||
class_device_put(&ic->classdev);
|
||||
put_device(&ic->classdev);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ static void internal_container_klist_put(struct klist_node *n)
|
||||
* Returns the container associated with this classdev.
|
||||
*/
|
||||
struct attribute_container *
|
||||
attribute_container_classdev_to_container(struct class_device *classdev)
|
||||
attribute_container_classdev_to_container(struct device *classdev)
|
||||
{
|
||||
struct internal_container *ic =
|
||||
container_of(classdev, struct internal_container, classdev);
|
||||
@@ -110,11 +110,11 @@ attribute_container_unregister(struct attribute_container *cont)
|
||||
EXPORT_SYMBOL_GPL(attribute_container_unregister);
|
||||
|
||||
/* private function used as class release */
|
||||
static void attribute_container_release(struct class_device *classdev)
|
||||
static void attribute_container_release(struct device *classdev)
|
||||
{
|
||||
struct internal_container *ic
|
||||
= container_of(classdev, struct internal_container, classdev);
|
||||
struct device *dev = classdev->dev;
|
||||
struct device *dev = classdev->parent;
|
||||
|
||||
kfree(ic);
|
||||
put_device(dev);
|
||||
@@ -129,12 +129,12 @@ static void attribute_container_release(struct class_device *classdev)
|
||||
* This function allocates storage for the class device(s) to be
|
||||
* attached to dev (one for each matching attribute_container). If no
|
||||
* fn is provided, the code will simply register the class device via
|
||||
* class_device_add. If a function is provided, it is expected to add
|
||||
* device_add. If a function is provided, it is expected to add
|
||||
* the class device at the appropriate time. One of the things that
|
||||
* might be necessary is to allocate and initialise the classdev and
|
||||
* then add it a later time. To do this, call this routine for
|
||||
* allocation and initialisation and then use
|
||||
* attribute_container_device_trigger() to call class_device_add() on
|
||||
* attribute_container_device_trigger() to call device_add() on
|
||||
* it. Note: after this, the class device contains a reference to dev
|
||||
* which is not relinquished until the release of the classdev.
|
||||
*/
|
||||
@@ -142,7 +142,7 @@ void
|
||||
attribute_container_add_device(struct device *dev,
|
||||
int (*fn)(struct attribute_container *,
|
||||
struct device *,
|
||||
struct class_device *))
|
||||
struct device *))
|
||||
{
|
||||
struct attribute_container *cont;
|
||||
|
||||
@@ -163,11 +163,11 @@ attribute_container_add_device(struct device *dev,
|
||||
}
|
||||
|
||||
ic->cont = cont;
|
||||
class_device_initialize(&ic->classdev);
|
||||
ic->classdev.dev = get_device(dev);
|
||||
device_initialize(&ic->classdev);
|
||||
ic->classdev.parent = get_device(dev);
|
||||
ic->classdev.class = cont->class;
|
||||
cont->class->release = attribute_container_release;
|
||||
strcpy(ic->classdev.class_id, dev->bus_id);
|
||||
cont->class->dev_release = attribute_container_release;
|
||||
strcpy(ic->classdev.bus_id, dev->bus_id);
|
||||
if (fn)
|
||||
fn(cont, dev, &ic->classdev);
|
||||
else
|
||||
@@ -195,20 +195,19 @@ attribute_container_add_device(struct device *dev,
|
||||
* @fn: A function to call to remove the device
|
||||
*
|
||||
* This routine triggers device removal. If fn is NULL, then it is
|
||||
* simply done via class_device_unregister (note that if something
|
||||
* simply done via device_unregister (note that if something
|
||||
* still has a reference to the classdev, then the memory occupied
|
||||
* will not be freed until the classdev is released). If you want a
|
||||
* two phase release: remove from visibility and then delete the
|
||||
* device, then you should use this routine with a fn that calls
|
||||
* class_device_del() and then use
|
||||
* attribute_container_device_trigger() to do the final put on the
|
||||
* classdev.
|
||||
* device_del() and then use attribute_container_device_trigger()
|
||||
* to do the final put on the classdev.
|
||||
*/
|
||||
void
|
||||
attribute_container_remove_device(struct device *dev,
|
||||
void (*fn)(struct attribute_container *,
|
||||
struct device *,
|
||||
struct class_device *))
|
||||
struct device *))
|
||||
{
|
||||
struct attribute_container *cont;
|
||||
|
||||
@@ -224,14 +223,14 @@ attribute_container_remove_device(struct device *dev,
|
||||
continue;
|
||||
|
||||
klist_for_each_entry(ic, &cont->containers, node, &iter) {
|
||||
if (dev != ic->classdev.dev)
|
||||
if (dev != ic->classdev.parent)
|
||||
continue;
|
||||
klist_del(&ic->node);
|
||||
if (fn)
|
||||
fn(cont, dev, &ic->classdev);
|
||||
else {
|
||||
attribute_container_remove_attrs(&ic->classdev);
|
||||
class_device_unregister(&ic->classdev);
|
||||
device_unregister(&ic->classdev);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -252,7 +251,7 @@ void
|
||||
attribute_container_device_trigger(struct device *dev,
|
||||
int (*fn)(struct attribute_container *,
|
||||
struct device *,
|
||||
struct class_device *))
|
||||
struct device *))
|
||||
{
|
||||
struct attribute_container *cont;
|
||||
|
||||
@@ -270,7 +269,7 @@ attribute_container_device_trigger(struct device *dev,
|
||||
}
|
||||
|
||||
klist_for_each_entry(ic, &cont->containers, node, &iter) {
|
||||
if (dev == ic->classdev.dev)
|
||||
if (dev == ic->classdev.parent)
|
||||
fn(cont, dev, &ic->classdev);
|
||||
}
|
||||
}
|
||||
@@ -313,11 +312,11 @@ attribute_container_trigger(struct device *dev,
|
||||
* attributes listed in the container
|
||||
*/
|
||||
int
|
||||
attribute_container_add_attrs(struct class_device *classdev)
|
||||
attribute_container_add_attrs(struct device *classdev)
|
||||
{
|
||||
struct attribute_container *cont =
|
||||
attribute_container_classdev_to_container(classdev);
|
||||
struct class_device_attribute **attrs = cont->attrs;
|
||||
struct device_attribute **attrs = cont->attrs;
|
||||
int i, error;
|
||||
|
||||
BUG_ON(attrs && cont->grp);
|
||||
@@ -329,7 +328,7 @@ attribute_container_add_attrs(struct class_device *classdev)
|
||||
return sysfs_create_group(&classdev->kobj, cont->grp);
|
||||
|
||||
for (i = 0; attrs[i]; i++) {
|
||||
error = class_device_create_file(classdev, attrs[i]);
|
||||
error = device_create_file(classdev, attrs[i]);
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
@@ -338,18 +337,18 @@ attribute_container_add_attrs(struct class_device *classdev)
|
||||
}
|
||||
|
||||
/**
|
||||
* attribute_container_add_class_device - same function as class_device_add
|
||||
* attribute_container_add_class_device - same function as device_add
|
||||
*
|
||||
* @classdev: the class device to add
|
||||
*
|
||||
* This performs essentially the same function as class_device_add except for
|
||||
* This performs essentially the same function as device_add except for
|
||||
* attribute containers, namely add the classdev to the system and then
|
||||
* create the attribute files
|
||||
*/
|
||||
int
|
||||
attribute_container_add_class_device(struct class_device *classdev)
|
||||
attribute_container_add_class_device(struct device *classdev)
|
||||
{
|
||||
int error = class_device_add(classdev);
|
||||
int error = device_add(classdev);
|
||||
if (error)
|
||||
return error;
|
||||
return attribute_container_add_attrs(classdev);
|
||||
@@ -364,7 +363,7 @@ attribute_container_add_class_device(struct class_device *classdev)
|
||||
int
|
||||
attribute_container_add_class_device_adapter(struct attribute_container *cont,
|
||||
struct device *dev,
|
||||
struct class_device *classdev)
|
||||
struct device *classdev)
|
||||
{
|
||||
return attribute_container_add_class_device(classdev);
|
||||
}
|
||||
@@ -376,11 +375,11 @@ attribute_container_add_class_device_adapter(struct attribute_container *cont,
|
||||
*
|
||||
*/
|
||||
void
|
||||
attribute_container_remove_attrs(struct class_device *classdev)
|
||||
attribute_container_remove_attrs(struct device *classdev)
|
||||
{
|
||||
struct attribute_container *cont =
|
||||
attribute_container_classdev_to_container(classdev);
|
||||
struct class_device_attribute **attrs = cont->attrs;
|
||||
struct device_attribute **attrs = cont->attrs;
|
||||
int i;
|
||||
|
||||
if (!attrs && !cont->grp)
|
||||
@@ -392,7 +391,7 @@ attribute_container_remove_attrs(struct class_device *classdev)
|
||||
}
|
||||
|
||||
for (i = 0; attrs[i]; i++)
|
||||
class_device_remove_file(classdev, attrs[i]);
|
||||
device_remove_file(classdev, attrs[i]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -401,13 +400,13 @@ attribute_container_remove_attrs(struct class_device *classdev)
|
||||
* @classdev: the class device
|
||||
*
|
||||
* This function simply removes all the attribute files and then calls
|
||||
* class_device_del.
|
||||
* device_del.
|
||||
*/
|
||||
void
|
||||
attribute_container_class_device_del(struct class_device *classdev)
|
||||
attribute_container_class_device_del(struct device *classdev)
|
||||
{
|
||||
attribute_container_remove_attrs(classdev);
|
||||
class_device_del(classdev);
|
||||
device_del(classdev);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -419,16 +418,16 @@ attribute_container_class_device_del(struct class_device *classdev)
|
||||
* Looks up the device in the container's list of class devices and returns
|
||||
* the corresponding class_device.
|
||||
*/
|
||||
struct class_device *
|
||||
struct device *
|
||||
attribute_container_find_class_device(struct attribute_container *cont,
|
||||
struct device *dev)
|
||||
{
|
||||
struct class_device *cdev = NULL;
|
||||
struct device *cdev = NULL;
|
||||
struct internal_container *ic;
|
||||
struct klist_iter iter;
|
||||
|
||||
klist_for_each_entry(ic, &cont->containers, node, &iter) {
|
||||
if (ic->classdev.dev == dev) {
|
||||
if (ic->classdev.parent == dev) {
|
||||
cdev = &ic->classdev;
|
||||
/* FIXME: must exit iterator then break */
|
||||
klist_iter_exit(&iter);
|
||||
|
||||
@@ -66,7 +66,7 @@ EXPORT_SYMBOL_GPL(transport_class_unregister);
|
||||
|
||||
static int anon_transport_dummy_function(struct transport_container *tc,
|
||||
struct device *dev,
|
||||
struct class_device *cdev)
|
||||
struct device *cdev)
|
||||
{
|
||||
/* do nothing */
|
||||
return 0;
|
||||
@@ -115,7 +115,7 @@ EXPORT_SYMBOL_GPL(anon_transport_class_unregister);
|
||||
|
||||
static int transport_setup_classdev(struct attribute_container *cont,
|
||||
struct device *dev,
|
||||
struct class_device *classdev)
|
||||
struct device *classdev)
|
||||
{
|
||||
struct transport_class *tclass = class_to_transport_class(cont->class);
|
||||
struct transport_container *tcont = attribute_container_to_transport_container(cont);
|
||||
@@ -149,7 +149,7 @@ EXPORT_SYMBOL_GPL(transport_setup_device);
|
||||
|
||||
static int transport_add_class_device(struct attribute_container *cont,
|
||||
struct device *dev,
|
||||
struct class_device *classdev)
|
||||
struct device *classdev)
|
||||
{
|
||||
int error = attribute_container_add_class_device(classdev);
|
||||
struct transport_container *tcont =
|
||||
@@ -181,7 +181,7 @@ EXPORT_SYMBOL_GPL(transport_add_device);
|
||||
|
||||
static int transport_configure(struct attribute_container *cont,
|
||||
struct device *dev,
|
||||
struct class_device *cdev)
|
||||
struct device *cdev)
|
||||
{
|
||||
struct transport_class *tclass = class_to_transport_class(cont->class);
|
||||
struct transport_container *tcont = attribute_container_to_transport_container(cont);
|
||||
@@ -212,7 +212,7 @@ EXPORT_SYMBOL_GPL(transport_configure_device);
|
||||
|
||||
static int transport_remove_classdev(struct attribute_container *cont,
|
||||
struct device *dev,
|
||||
struct class_device *classdev)
|
||||
struct device *classdev)
|
||||
{
|
||||
struct transport_container *tcont =
|
||||
attribute_container_to_transport_container(cont);
|
||||
@@ -251,12 +251,12 @@ EXPORT_SYMBOL_GPL(transport_remove_device);
|
||||
|
||||
static void transport_destroy_classdev(struct attribute_container *cont,
|
||||
struct device *dev,
|
||||
struct class_device *classdev)
|
||||
struct device *classdev)
|
||||
{
|
||||
struct transport_class *tclass = class_to_transport_class(cont->class);
|
||||
|
||||
if (tclass->remove != anon_transport_dummy_function)
|
||||
class_device_put(classdev);
|
||||
put_device(classdev);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1458,9 +1458,10 @@ static int srp_reset_host(struct scsi_cmnd *scmnd)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t show_id_ext(struct class_device *cdev, char *buf)
|
||||
static ssize_t show_id_ext(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct srp_target_port *target = host_to_target(class_to_shost(cdev));
|
||||
struct srp_target_port *target = host_to_target(class_to_shost(dev));
|
||||
|
||||
if (target->state == SRP_TARGET_DEAD ||
|
||||
target->state == SRP_TARGET_REMOVED)
|
||||
@@ -1470,9 +1471,10 @@ static ssize_t show_id_ext(struct class_device *cdev, char *buf)
|
||||
(unsigned long long) be64_to_cpu(target->id_ext));
|
||||
}
|
||||
|
||||
static ssize_t show_ioc_guid(struct class_device *cdev, char *buf)
|
||||
static ssize_t show_ioc_guid(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct srp_target_port *target = host_to_target(class_to_shost(cdev));
|
||||
struct srp_target_port *target = host_to_target(class_to_shost(dev));
|
||||
|
||||
if (target->state == SRP_TARGET_DEAD ||
|
||||
target->state == SRP_TARGET_REMOVED)
|
||||
@@ -1482,9 +1484,10 @@ static ssize_t show_ioc_guid(struct class_device *cdev, char *buf)
|
||||
(unsigned long long) be64_to_cpu(target->ioc_guid));
|
||||
}
|
||||
|
||||
static ssize_t show_service_id(struct class_device *cdev, char *buf)
|
||||
static ssize_t show_service_id(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct srp_target_port *target = host_to_target(class_to_shost(cdev));
|
||||
struct srp_target_port *target = host_to_target(class_to_shost(dev));
|
||||
|
||||
if (target->state == SRP_TARGET_DEAD ||
|
||||
target->state == SRP_TARGET_REMOVED)
|
||||
@@ -1494,9 +1497,10 @@ static ssize_t show_service_id(struct class_device *cdev, char *buf)
|
||||
(unsigned long long) be64_to_cpu(target->service_id));
|
||||
}
|
||||
|
||||
static ssize_t show_pkey(struct class_device *cdev, char *buf)
|
||||
static ssize_t show_pkey(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct srp_target_port *target = host_to_target(class_to_shost(cdev));
|
||||
struct srp_target_port *target = host_to_target(class_to_shost(dev));
|
||||
|
||||
if (target->state == SRP_TARGET_DEAD ||
|
||||
target->state == SRP_TARGET_REMOVED)
|
||||
@@ -1505,9 +1509,10 @@ static ssize_t show_pkey(struct class_device *cdev, char *buf)
|
||||
return sprintf(buf, "0x%04x\n", be16_to_cpu(target->path.pkey));
|
||||
}
|
||||
|
||||
static ssize_t show_dgid(struct class_device *cdev, char *buf)
|
||||
static ssize_t show_dgid(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct srp_target_port *target = host_to_target(class_to_shost(cdev));
|
||||
struct srp_target_port *target = host_to_target(class_to_shost(dev));
|
||||
|
||||
if (target->state == SRP_TARGET_DEAD ||
|
||||
target->state == SRP_TARGET_REMOVED)
|
||||
@@ -1524,9 +1529,10 @@ static ssize_t show_dgid(struct class_device *cdev, char *buf)
|
||||
be16_to_cpu(((__be16 *) target->path.dgid.raw)[7]));
|
||||
}
|
||||
|
||||
static ssize_t show_orig_dgid(struct class_device *cdev, char *buf)
|
||||
static ssize_t show_orig_dgid(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct srp_target_port *target = host_to_target(class_to_shost(cdev));
|
||||
struct srp_target_port *target = host_to_target(class_to_shost(dev));
|
||||
|
||||
if (target->state == SRP_TARGET_DEAD ||
|
||||
target->state == SRP_TARGET_REMOVED)
|
||||
@@ -1543,9 +1549,10 @@ static ssize_t show_orig_dgid(struct class_device *cdev, char *buf)
|
||||
be16_to_cpu(target->orig_dgid[7]));
|
||||
}
|
||||
|
||||
static ssize_t show_zero_req_lim(struct class_device *cdev, char *buf)
|
||||
static ssize_t show_zero_req_lim(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct srp_target_port *target = host_to_target(class_to_shost(cdev));
|
||||
struct srp_target_port *target = host_to_target(class_to_shost(dev));
|
||||
|
||||
if (target->state == SRP_TARGET_DEAD ||
|
||||
target->state == SRP_TARGET_REMOVED)
|
||||
@@ -1554,40 +1561,42 @@ static ssize_t show_zero_req_lim(struct class_device *cdev, char *buf)
|
||||
return sprintf(buf, "%d\n", target->zero_req_lim);
|
||||
}
|
||||
|
||||
static ssize_t show_local_ib_port(struct class_device *cdev, char *buf)
|
||||
static ssize_t show_local_ib_port(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct srp_target_port *target = host_to_target(class_to_shost(cdev));
|
||||
struct srp_target_port *target = host_to_target(class_to_shost(dev));
|
||||
|
||||
return sprintf(buf, "%d\n", target->srp_host->port);
|
||||
}
|
||||
|
||||
static ssize_t show_local_ib_device(struct class_device *cdev, char *buf)
|
||||
static ssize_t show_local_ib_device(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct srp_target_port *target = host_to_target(class_to_shost(cdev));
|
||||
struct srp_target_port *target = host_to_target(class_to_shost(dev));
|
||||
|
||||
return sprintf(buf, "%s\n", target->srp_host->srp_dev->dev->name);
|
||||
}
|
||||
|
||||
static CLASS_DEVICE_ATTR(id_ext, S_IRUGO, show_id_ext, NULL);
|
||||
static CLASS_DEVICE_ATTR(ioc_guid, S_IRUGO, show_ioc_guid, NULL);
|
||||
static CLASS_DEVICE_ATTR(service_id, S_IRUGO, show_service_id, NULL);
|
||||
static CLASS_DEVICE_ATTR(pkey, S_IRUGO, show_pkey, NULL);
|
||||
static CLASS_DEVICE_ATTR(dgid, S_IRUGO, show_dgid, NULL);
|
||||
static CLASS_DEVICE_ATTR(orig_dgid, S_IRUGO, show_orig_dgid, NULL);
|
||||
static CLASS_DEVICE_ATTR(zero_req_lim, S_IRUGO, show_zero_req_lim, NULL);
|
||||
static CLASS_DEVICE_ATTR(local_ib_port, S_IRUGO, show_local_ib_port, NULL);
|
||||
static CLASS_DEVICE_ATTR(local_ib_device, S_IRUGO, show_local_ib_device, NULL);
|
||||
static DEVICE_ATTR(id_ext, S_IRUGO, show_id_ext, NULL);
|
||||
static DEVICE_ATTR(ioc_guid, S_IRUGO, show_ioc_guid, NULL);
|
||||
static DEVICE_ATTR(service_id, S_IRUGO, show_service_id, NULL);
|
||||
static DEVICE_ATTR(pkey, S_IRUGO, show_pkey, NULL);
|
||||
static DEVICE_ATTR(dgid, S_IRUGO, show_dgid, NULL);
|
||||
static DEVICE_ATTR(orig_dgid, S_IRUGO, show_orig_dgid, NULL);
|
||||
static DEVICE_ATTR(zero_req_lim, S_IRUGO, show_zero_req_lim, NULL);
|
||||
static DEVICE_ATTR(local_ib_port, S_IRUGO, show_local_ib_port, NULL);
|
||||
static DEVICE_ATTR(local_ib_device, S_IRUGO, show_local_ib_device, NULL);
|
||||
|
||||
static struct class_device_attribute *srp_host_attrs[] = {
|
||||
&class_device_attr_id_ext,
|
||||
&class_device_attr_ioc_guid,
|
||||
&class_device_attr_service_id,
|
||||
&class_device_attr_pkey,
|
||||
&class_device_attr_dgid,
|
||||
&class_device_attr_orig_dgid,
|
||||
&class_device_attr_zero_req_lim,
|
||||
&class_device_attr_local_ib_port,
|
||||
&class_device_attr_local_ib_device,
|
||||
static struct device_attribute *srp_host_attrs[] = {
|
||||
&dev_attr_id_ext,
|
||||
&dev_attr_ioc_guid,
|
||||
&dev_attr_service_id,
|
||||
&dev_attr_pkey,
|
||||
&dev_attr_dgid,
|
||||
&dev_attr_orig_dgid,
|
||||
&dev_attr_zero_req_lim,
|
||||
&dev_attr_local_ib_port,
|
||||
&dev_attr_local_ib_device,
|
||||
NULL
|
||||
};
|
||||
|
||||
@@ -1639,17 +1648,17 @@ static int srp_add_target(struct srp_host *host, struct srp_target_port *target)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void srp_release_class_dev(struct class_device *class_dev)
|
||||
static void srp_release_dev(struct device *dev)
|
||||
{
|
||||
struct srp_host *host =
|
||||
container_of(class_dev, struct srp_host, class_dev);
|
||||
container_of(dev, struct srp_host, dev);
|
||||
|
||||
complete(&host->released);
|
||||
}
|
||||
|
||||
static struct class srp_class = {
|
||||
.name = "infiniband_srp",
|
||||
.release = srp_release_class_dev
|
||||
.dev_release = srp_release_dev
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -1837,11 +1846,12 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t srp_create_target(struct class_device *class_dev,
|
||||
static ssize_t srp_create_target(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct srp_host *host =
|
||||
container_of(class_dev, struct srp_host, class_dev);
|
||||
container_of(dev, struct srp_host, dev);
|
||||
struct Scsi_Host *target_host;
|
||||
struct srp_target_port *target;
|
||||
int ret;
|
||||
@@ -1929,27 +1939,27 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static CLASS_DEVICE_ATTR(add_target, S_IWUSR, NULL, srp_create_target);
|
||||
static DEVICE_ATTR(add_target, S_IWUSR, NULL, srp_create_target);
|
||||
|
||||
static ssize_t show_ibdev(struct class_device *class_dev, char *buf)
|
||||
static ssize_t show_ibdev(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct srp_host *host =
|
||||
container_of(class_dev, struct srp_host, class_dev);
|
||||
struct srp_host *host = container_of(dev, struct srp_host, dev);
|
||||
|
||||
return sprintf(buf, "%s\n", host->srp_dev->dev->name);
|
||||
}
|
||||
|
||||
static CLASS_DEVICE_ATTR(ibdev, S_IRUGO, show_ibdev, NULL);
|
||||
static DEVICE_ATTR(ibdev, S_IRUGO, show_ibdev, NULL);
|
||||
|
||||
static ssize_t show_port(struct class_device *class_dev, char *buf)
|
||||
static ssize_t show_port(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct srp_host *host =
|
||||
container_of(class_dev, struct srp_host, class_dev);
|
||||
struct srp_host *host = container_of(dev, struct srp_host, dev);
|
||||
|
||||
return sprintf(buf, "%d\n", host->port);
|
||||
}
|
||||
|
||||
static CLASS_DEVICE_ATTR(port, S_IRUGO, show_port, NULL);
|
||||
static DEVICE_ATTR(port, S_IRUGO, show_port, NULL);
|
||||
|
||||
static struct srp_host *srp_add_port(struct srp_device *device, u8 port)
|
||||
{
|
||||
@@ -1965,24 +1975,24 @@ static struct srp_host *srp_add_port(struct srp_device *device, u8 port)
|
||||
host->srp_dev = device;
|
||||
host->port = port;
|
||||
|
||||
host->class_dev.class = &srp_class;
|
||||
host->class_dev.dev = device->dev->dma_device;
|
||||
snprintf(host->class_dev.class_id, BUS_ID_SIZE, "srp-%s-%d",
|
||||
host->dev.class = &srp_class;
|
||||
host->dev.parent = device->dev->dma_device;
|
||||
snprintf(host->dev.bus_id, BUS_ID_SIZE, "srp-%s-%d",
|
||||
device->dev->name, port);
|
||||
|
||||
if (class_device_register(&host->class_dev))
|
||||
if (device_register(&host->dev))
|
||||
goto free_host;
|
||||
if (class_device_create_file(&host->class_dev, &class_device_attr_add_target))
|
||||
if (device_create_file(&host->dev, &dev_attr_add_target))
|
||||
goto err_class;
|
||||
if (class_device_create_file(&host->class_dev, &class_device_attr_ibdev))
|
||||
if (device_create_file(&host->dev, &dev_attr_ibdev))
|
||||
goto err_class;
|
||||
if (class_device_create_file(&host->class_dev, &class_device_attr_port))
|
||||
if (device_create_file(&host->dev, &dev_attr_port))
|
||||
goto err_class;
|
||||
|
||||
return host;
|
||||
|
||||
err_class:
|
||||
class_device_unregister(&host->class_dev);
|
||||
device_unregister(&host->dev);
|
||||
|
||||
free_host:
|
||||
kfree(host);
|
||||
@@ -2087,7 +2097,7 @@ static void srp_remove_one(struct ib_device *device)
|
||||
srp_dev = ib_get_client_data(device, &srp_client);
|
||||
|
||||
list_for_each_entry_safe(host, tmp_host, &srp_dev->dev_list, list) {
|
||||
class_device_unregister(&host->class_dev);
|
||||
device_unregister(&host->dev);
|
||||
/*
|
||||
* Wait for the sysfs entry to go away, so that no new
|
||||
* target ports can be created.
|
||||
|
||||
@@ -99,7 +99,7 @@ struct srp_device {
|
||||
struct srp_host {
|
||||
struct srp_device *srp_dev;
|
||||
u8 port;
|
||||
struct class_device class_dev;
|
||||
struct device dev;
|
||||
struct list_head target_list;
|
||||
spinlock_t target_lock;
|
||||
struct completion released;
|
||||
|
||||
@@ -3300,9 +3300,10 @@ mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, VirtDevice *vdevice)
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
mptscsih_version_fw_show(struct class_device *cdev, char *buf)
|
||||
mptscsih_version_fw_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
MPT_SCSI_HOST *hd = shost_priv(host);
|
||||
MPT_ADAPTER *ioc = hd->ioc;
|
||||
|
||||
@@ -3312,12 +3313,13 @@ mptscsih_version_fw_show(struct class_device *cdev, char *buf)
|
||||
(ioc->facts.FWVersion.Word & 0x0000FF00) >> 8,
|
||||
ioc->facts.FWVersion.Word & 0x000000FF);
|
||||
}
|
||||
static CLASS_DEVICE_ATTR(version_fw, S_IRUGO, mptscsih_version_fw_show, NULL);
|
||||
static DEVICE_ATTR(version_fw, S_IRUGO, mptscsih_version_fw_show, NULL);
|
||||
|
||||
static ssize_t
|
||||
mptscsih_version_bios_show(struct class_device *cdev, char *buf)
|
||||
mptscsih_version_bios_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
MPT_SCSI_HOST *hd = shost_priv(host);
|
||||
MPT_ADAPTER *ioc = hd->ioc;
|
||||
|
||||
@@ -3327,129 +3329,141 @@ mptscsih_version_bios_show(struct class_device *cdev, char *buf)
|
||||
(ioc->biosVersion & 0x0000FF00) >> 8,
|
||||
ioc->biosVersion & 0x000000FF);
|
||||
}
|
||||
static CLASS_DEVICE_ATTR(version_bios, S_IRUGO, mptscsih_version_bios_show, NULL);
|
||||
static DEVICE_ATTR(version_bios, S_IRUGO, mptscsih_version_bios_show, NULL);
|
||||
|
||||
static ssize_t
|
||||
mptscsih_version_mpi_show(struct class_device *cdev, char *buf)
|
||||
mptscsih_version_mpi_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
MPT_SCSI_HOST *hd = shost_priv(host);
|
||||
MPT_ADAPTER *ioc = hd->ioc;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%03x\n", ioc->facts.MsgVersion);
|
||||
}
|
||||
static CLASS_DEVICE_ATTR(version_mpi, S_IRUGO, mptscsih_version_mpi_show, NULL);
|
||||
static DEVICE_ATTR(version_mpi, S_IRUGO, mptscsih_version_mpi_show, NULL);
|
||||
|
||||
static ssize_t
|
||||
mptscsih_version_product_show(struct class_device *cdev, char *buf)
|
||||
mptscsih_version_product_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
MPT_SCSI_HOST *hd = shost_priv(host);
|
||||
MPT_ADAPTER *ioc = hd->ioc;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%s\n", ioc->prod_name);
|
||||
}
|
||||
static CLASS_DEVICE_ATTR(version_product, S_IRUGO,
|
||||
static DEVICE_ATTR(version_product, S_IRUGO,
|
||||
mptscsih_version_product_show, NULL);
|
||||
|
||||
static ssize_t
|
||||
mptscsih_version_nvdata_persistent_show(struct class_device *cdev, char *buf)
|
||||
mptscsih_version_nvdata_persistent_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
MPT_SCSI_HOST *hd = shost_priv(host);
|
||||
MPT_ADAPTER *ioc = hd->ioc;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%02xh\n",
|
||||
ioc->nvdata_version_persistent);
|
||||
}
|
||||
static CLASS_DEVICE_ATTR(version_nvdata_persistent, S_IRUGO,
|
||||
static DEVICE_ATTR(version_nvdata_persistent, S_IRUGO,
|
||||
mptscsih_version_nvdata_persistent_show, NULL);
|
||||
|
||||
static ssize_t
|
||||
mptscsih_version_nvdata_default_show(struct class_device *cdev, char *buf)
|
||||
mptscsih_version_nvdata_default_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
MPT_SCSI_HOST *hd = shost_priv(host);
|
||||
MPT_ADAPTER *ioc = hd->ioc;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%02xh\n",ioc->nvdata_version_default);
|
||||
}
|
||||
static CLASS_DEVICE_ATTR(version_nvdata_default, S_IRUGO,
|
||||
static DEVICE_ATTR(version_nvdata_default, S_IRUGO,
|
||||
mptscsih_version_nvdata_default_show, NULL);
|
||||
|
||||
static ssize_t
|
||||
mptscsih_board_name_show(struct class_device *cdev, char *buf)
|
||||
mptscsih_board_name_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
MPT_SCSI_HOST *hd = shost_priv(host);
|
||||
MPT_ADAPTER *ioc = hd->ioc;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_name);
|
||||
}
|
||||
static CLASS_DEVICE_ATTR(board_name, S_IRUGO, mptscsih_board_name_show, NULL);
|
||||
static DEVICE_ATTR(board_name, S_IRUGO, mptscsih_board_name_show, NULL);
|
||||
|
||||
static ssize_t
|
||||
mptscsih_board_assembly_show(struct class_device *cdev, char *buf)
|
||||
mptscsih_board_assembly_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
MPT_SCSI_HOST *hd = shost_priv(host);
|
||||
MPT_ADAPTER *ioc = hd->ioc;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_assembly);
|
||||
}
|
||||
static CLASS_DEVICE_ATTR(board_assembly, S_IRUGO,
|
||||
static DEVICE_ATTR(board_assembly, S_IRUGO,
|
||||
mptscsih_board_assembly_show, NULL);
|
||||
|
||||
static ssize_t
|
||||
mptscsih_board_tracer_show(struct class_device *cdev, char *buf)
|
||||
mptscsih_board_tracer_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
MPT_SCSI_HOST *hd = shost_priv(host);
|
||||
MPT_ADAPTER *ioc = hd->ioc;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_tracer);
|
||||
}
|
||||
static CLASS_DEVICE_ATTR(board_tracer, S_IRUGO,
|
||||
static DEVICE_ATTR(board_tracer, S_IRUGO,
|
||||
mptscsih_board_tracer_show, NULL);
|
||||
|
||||
static ssize_t
|
||||
mptscsih_io_delay_show(struct class_device *cdev, char *buf)
|
||||
mptscsih_io_delay_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
MPT_SCSI_HOST *hd = shost_priv(host);
|
||||
MPT_ADAPTER *ioc = hd->ioc;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%02d\n", ioc->io_missing_delay);
|
||||
}
|
||||
static CLASS_DEVICE_ATTR(io_delay, S_IRUGO,
|
||||
static DEVICE_ATTR(io_delay, S_IRUGO,
|
||||
mptscsih_io_delay_show, NULL);
|
||||
|
||||
static ssize_t
|
||||
mptscsih_device_delay_show(struct class_device *cdev, char *buf)
|
||||
mptscsih_device_delay_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
MPT_SCSI_HOST *hd = shost_priv(host);
|
||||
MPT_ADAPTER *ioc = hd->ioc;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%02d\n", ioc->device_missing_delay);
|
||||
}
|
||||
static CLASS_DEVICE_ATTR(device_delay, S_IRUGO,
|
||||
static DEVICE_ATTR(device_delay, S_IRUGO,
|
||||
mptscsih_device_delay_show, NULL);
|
||||
|
||||
static ssize_t
|
||||
mptscsih_debug_level_show(struct class_device *cdev, char *buf)
|
||||
mptscsih_debug_level_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
MPT_SCSI_HOST *hd = shost_priv(host);
|
||||
MPT_ADAPTER *ioc = hd->ioc;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%08xh\n", ioc->debug_level);
|
||||
}
|
||||
static ssize_t
|
||||
mptscsih_debug_level_store(struct class_device *cdev, const char *buf,
|
||||
size_t count)
|
||||
mptscsih_debug_level_store(struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
MPT_SCSI_HOST *hd = shost_priv(host);
|
||||
MPT_ADAPTER *ioc = hd->ioc;
|
||||
int val = 0;
|
||||
@@ -3462,22 +3476,22 @@ mptscsih_debug_level_store(struct class_device *cdev, const char *buf,
|
||||
ioc->name, ioc->debug_level);
|
||||
return strlen(buf);
|
||||
}
|
||||
static CLASS_DEVICE_ATTR(debug_level, S_IRUGO | S_IWUSR,
|
||||
mptscsih_debug_level_show, mptscsih_debug_level_store);
|
||||
static DEVICE_ATTR(debug_level, S_IRUGO | S_IWUSR,
|
||||
mptscsih_debug_level_show, mptscsih_debug_level_store);
|
||||
|
||||
struct class_device_attribute *mptscsih_host_attrs[] = {
|
||||
&class_device_attr_version_fw,
|
||||
&class_device_attr_version_bios,
|
||||
&class_device_attr_version_mpi,
|
||||
&class_device_attr_version_product,
|
||||
&class_device_attr_version_nvdata_persistent,
|
||||
&class_device_attr_version_nvdata_default,
|
||||
&class_device_attr_board_name,
|
||||
&class_device_attr_board_assembly,
|
||||
&class_device_attr_board_tracer,
|
||||
&class_device_attr_io_delay,
|
||||
&class_device_attr_device_delay,
|
||||
&class_device_attr_debug_level,
|
||||
struct device_attribute *mptscsih_host_attrs[] = {
|
||||
&dev_attr_version_fw,
|
||||
&dev_attr_version_bios,
|
||||
&dev_attr_version_mpi,
|
||||
&dev_attr_version_product,
|
||||
&dev_attr_version_nvdata_persistent,
|
||||
&dev_attr_version_nvdata_default,
|
||||
&dev_attr_board_name,
|
||||
&dev_attr_board_assembly,
|
||||
&dev_attr_board_tracer,
|
||||
&dev_attr_io_delay,
|
||||
&dev_attr_device_delay,
|
||||
&dev_attr_debug_level,
|
||||
NULL,
|
||||
};
|
||||
EXPORT_SYMBOL(mptscsih_host_attrs);
|
||||
|
||||
@@ -129,4 +129,4 @@ extern void mptscsih_timer_expired(unsigned long data);
|
||||
extern int mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, int ctx2abort, ulong timeout);
|
||||
extern u8 mptscsih_raid_id_to_num(MPT_ADAPTER *ioc, u8 channel, u8 id);
|
||||
extern int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, u8 channel, u8 id);
|
||||
extern struct class_device_attribute *mptscsih_host_attrs[];
|
||||
extern struct device_attribute *mptscsih_host_attrs[];
|
||||
|
||||
@@ -40,16 +40,16 @@ static struct class enclosure_component_class;
|
||||
* Looks through the list of registered enclosures to see
|
||||
* if it can find a match for a device. Returns NULL if no
|
||||
* enclosure is found. Obtains a reference to the enclosure class
|
||||
* device which must be released with class_device_put().
|
||||
* device which must be released with device_put().
|
||||
*/
|
||||
struct enclosure_device *enclosure_find(struct device *dev)
|
||||
{
|
||||
struct enclosure_device *edev = NULL;
|
||||
struct enclosure_device *edev;
|
||||
|
||||
mutex_lock(&container_list_lock);
|
||||
list_for_each_entry(edev, &container_list, node) {
|
||||
if (edev->cdev.dev == dev) {
|
||||
class_device_get(&edev->cdev);
|
||||
if (edev->edev.parent == dev) {
|
||||
get_device(&edev->edev);
|
||||
mutex_unlock(&container_list_lock);
|
||||
return edev;
|
||||
}
|
||||
@@ -117,11 +117,11 @@ enclosure_register(struct device *dev, const char *name, int components,
|
||||
|
||||
edev->components = components;
|
||||
|
||||
edev->cdev.class = &enclosure_class;
|
||||
edev->cdev.dev = get_device(dev);
|
||||
edev->edev.class = &enclosure_class;
|
||||
edev->edev.parent = get_device(dev);
|
||||
edev->cb = cb;
|
||||
snprintf(edev->cdev.class_id, BUS_ID_SIZE, "%s", name);
|
||||
err = class_device_register(&edev->cdev);
|
||||
snprintf(edev->edev.bus_id, BUS_ID_SIZE, "%s", name);
|
||||
err = device_register(&edev->edev);
|
||||
if (err)
|
||||
goto err;
|
||||
|
||||
@@ -135,7 +135,7 @@ enclosure_register(struct device *dev, const char *name, int components,
|
||||
return edev;
|
||||
|
||||
err:
|
||||
put_device(edev->cdev.dev);
|
||||
put_device(edev->edev.parent);
|
||||
kfree(edev);
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
@@ -158,27 +158,28 @@ void enclosure_unregister(struct enclosure_device *edev)
|
||||
|
||||
for (i = 0; i < edev->components; i++)
|
||||
if (edev->component[i].number != -1)
|
||||
class_device_unregister(&edev->component[i].cdev);
|
||||
device_unregister(&edev->component[i].cdev);
|
||||
|
||||
/* prevent any callbacks into service user */
|
||||
edev->cb = &enclosure_null_callbacks;
|
||||
class_device_unregister(&edev->cdev);
|
||||
device_unregister(&edev->edev);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(enclosure_unregister);
|
||||
|
||||
static void enclosure_release(struct class_device *cdev)
|
||||
static void enclosure_release(struct device *cdev)
|
||||
{
|
||||
struct enclosure_device *edev = to_enclosure_device(cdev);
|
||||
|
||||
put_device(cdev->dev);
|
||||
put_device(cdev->parent);
|
||||
kfree(edev);
|
||||
}
|
||||
|
||||
static void enclosure_component_release(struct class_device *cdev)
|
||||
static void enclosure_component_release(struct device *dev)
|
||||
{
|
||||
if (cdev->dev)
|
||||
put_device(cdev->dev);
|
||||
class_device_put(cdev->parent);
|
||||
struct enclosure_component *cdev = to_enclosure_component(dev);
|
||||
|
||||
put_device(cdev->dev);
|
||||
put_device(dev->parent);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -201,7 +202,7 @@ enclosure_component_register(struct enclosure_device *edev,
|
||||
const char *name)
|
||||
{
|
||||
struct enclosure_component *ecomp;
|
||||
struct class_device *cdev;
|
||||
struct device *cdev;
|
||||
int err;
|
||||
|
||||
if (number >= edev->components)
|
||||
@@ -215,14 +216,14 @@ enclosure_component_register(struct enclosure_device *edev,
|
||||
ecomp->type = type;
|
||||
ecomp->number = number;
|
||||
cdev = &ecomp->cdev;
|
||||
cdev->parent = class_device_get(&edev->cdev);
|
||||
cdev->parent = get_device(&edev->edev);
|
||||
cdev->class = &enclosure_component_class;
|
||||
if (name)
|
||||
snprintf(cdev->class_id, BUS_ID_SIZE, "%s", name);
|
||||
snprintf(cdev->bus_id, BUS_ID_SIZE, "%s", name);
|
||||
else
|
||||
snprintf(cdev->class_id, BUS_ID_SIZE, "%u", number);
|
||||
snprintf(cdev->bus_id, BUS_ID_SIZE, "%u", number);
|
||||
|
||||
err = class_device_register(cdev);
|
||||
err = device_register(cdev);
|
||||
if (err)
|
||||
ERR_PTR(err);
|
||||
|
||||
@@ -247,18 +248,17 @@ EXPORT_SYMBOL_GPL(enclosure_component_register);
|
||||
int enclosure_add_device(struct enclosure_device *edev, int component,
|
||||
struct device *dev)
|
||||
{
|
||||
struct class_device *cdev;
|
||||
struct enclosure_component *cdev;
|
||||
|
||||
if (!edev || component >= edev->components)
|
||||
return -EINVAL;
|
||||
|
||||
cdev = &edev->component[component].cdev;
|
||||
cdev = &edev->component[component];
|
||||
|
||||
class_device_del(cdev);
|
||||
if (cdev->dev)
|
||||
put_device(cdev->dev);
|
||||
device_del(&cdev->cdev);
|
||||
put_device(cdev->dev);
|
||||
cdev->dev = get_device(dev);
|
||||
return class_device_add(cdev);
|
||||
return device_add(&cdev->cdev);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(enclosure_add_device);
|
||||
|
||||
@@ -272,18 +272,17 @@ EXPORT_SYMBOL_GPL(enclosure_add_device);
|
||||
*/
|
||||
int enclosure_remove_device(struct enclosure_device *edev, int component)
|
||||
{
|
||||
struct class_device *cdev;
|
||||
struct enclosure_component *cdev;
|
||||
|
||||
if (!edev || component >= edev->components)
|
||||
return -EINVAL;
|
||||
|
||||
cdev = &edev->component[component].cdev;
|
||||
cdev = &edev->component[component];
|
||||
|
||||
class_device_del(cdev);
|
||||
if (cdev->dev)
|
||||
put_device(cdev->dev);
|
||||
device_del(&cdev->cdev);
|
||||
put_device(cdev->dev);
|
||||
cdev->dev = NULL;
|
||||
return class_device_add(cdev);
|
||||
return device_add(&cdev->cdev);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(enclosure_remove_device);
|
||||
|
||||
@@ -291,14 +290,16 @@ EXPORT_SYMBOL_GPL(enclosure_remove_device);
|
||||
* sysfs pieces below
|
||||
*/
|
||||
|
||||
static ssize_t enclosure_show_components(struct class_device *cdev, char *buf)
|
||||
static ssize_t enclosure_show_components(struct device *cdev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct enclosure_device *edev = to_enclosure_device(cdev);
|
||||
|
||||
return snprintf(buf, 40, "%d\n", edev->components);
|
||||
}
|
||||
|
||||
static struct class_device_attribute enclosure_attrs[] = {
|
||||
static struct device_attribute enclosure_attrs[] = {
|
||||
__ATTR(components, S_IRUGO, enclosure_show_components, NULL),
|
||||
__ATTR_NULL
|
||||
};
|
||||
@@ -306,8 +307,8 @@ static struct class_device_attribute enclosure_attrs[] = {
|
||||
static struct class enclosure_class = {
|
||||
.name = "enclosure",
|
||||
.owner = THIS_MODULE,
|
||||
.release = enclosure_release,
|
||||
.class_dev_attrs = enclosure_attrs,
|
||||
.dev_release = enclosure_release,
|
||||
.dev_attrs = enclosure_attrs,
|
||||
};
|
||||
|
||||
static const char *const enclosure_status [] = {
|
||||
@@ -326,7 +327,8 @@ static const char *const enclosure_type [] = {
|
||||
[ENCLOSURE_COMPONENT_ARRAY_DEVICE] = "array device",
|
||||
};
|
||||
|
||||
static ssize_t get_component_fault(struct class_device *cdev, char *buf)
|
||||
static ssize_t get_component_fault(struct device *cdev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
||||
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
||||
@@ -336,8 +338,9 @@ static ssize_t get_component_fault(struct class_device *cdev, char *buf)
|
||||
return snprintf(buf, 40, "%d\n", ecomp->fault);
|
||||
}
|
||||
|
||||
static ssize_t set_component_fault(struct class_device *cdev, const char *buf,
|
||||
size_t count)
|
||||
static ssize_t set_component_fault(struct device *cdev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
||||
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
||||
@@ -348,7 +351,8 @@ static ssize_t set_component_fault(struct class_device *cdev, const char *buf,
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t get_component_status(struct class_device *cdev, char *buf)
|
||||
static ssize_t get_component_status(struct device *cdev,
|
||||
struct device_attribute *attr,char *buf)
|
||||
{
|
||||
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
||||
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
||||
@@ -358,8 +362,9 @@ static ssize_t get_component_status(struct class_device *cdev, char *buf)
|
||||
return snprintf(buf, 40, "%s\n", enclosure_status[ecomp->status]);
|
||||
}
|
||||
|
||||
static ssize_t set_component_status(struct class_device *cdev, const char *buf,
|
||||
size_t count)
|
||||
static ssize_t set_component_status(struct device *cdev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
||||
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
||||
@@ -380,7 +385,8 @@ static ssize_t set_component_status(struct class_device *cdev, const char *buf,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static ssize_t get_component_active(struct class_device *cdev, char *buf)
|
||||
static ssize_t get_component_active(struct device *cdev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
||||
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
||||
@@ -390,8 +396,9 @@ static ssize_t get_component_active(struct class_device *cdev, char *buf)
|
||||
return snprintf(buf, 40, "%d\n", ecomp->active);
|
||||
}
|
||||
|
||||
static ssize_t set_component_active(struct class_device *cdev, const char *buf,
|
||||
size_t count)
|
||||
static ssize_t set_component_active(struct device *cdev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
||||
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
||||
@@ -402,7 +409,8 @@ static ssize_t set_component_active(struct class_device *cdev, const char *buf,
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t get_component_locate(struct class_device *cdev, char *buf)
|
||||
static ssize_t get_component_locate(struct device *cdev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
||||
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
||||
@@ -412,8 +420,9 @@ static ssize_t get_component_locate(struct class_device *cdev, char *buf)
|
||||
return snprintf(buf, 40, "%d\n", ecomp->locate);
|
||||
}
|
||||
|
||||
static ssize_t set_component_locate(struct class_device *cdev, const char *buf,
|
||||
size_t count)
|
||||
static ssize_t set_component_locate(struct device *cdev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
||||
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
||||
@@ -424,7 +433,8 @@ static ssize_t set_component_locate(struct class_device *cdev, const char *buf,
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t get_component_type(struct class_device *cdev, char *buf)
|
||||
static ssize_t get_component_type(struct device *cdev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
||||
|
||||
@@ -432,7 +442,7 @@ static ssize_t get_component_type(struct class_device *cdev, char *buf)
|
||||
}
|
||||
|
||||
|
||||
static struct class_device_attribute enclosure_component_attrs[] = {
|
||||
static struct device_attribute enclosure_component_attrs[] = {
|
||||
__ATTR(fault, S_IRUGO | S_IWUSR, get_component_fault,
|
||||
set_component_fault),
|
||||
__ATTR(status, S_IRUGO | S_IWUSR, get_component_status,
|
||||
@@ -448,8 +458,8 @@ static struct class_device_attribute enclosure_component_attrs[] = {
|
||||
static struct class enclosure_component_class = {
|
||||
.name = "enclosure_component",
|
||||
.owner = THIS_MODULE,
|
||||
.class_dev_attrs = enclosure_component_attrs,
|
||||
.release = enclosure_component_release,
|
||||
.dev_attrs = enclosure_component_attrs,
|
||||
.dev_release = enclosure_component_release,
|
||||
};
|
||||
|
||||
static int __init enclosure_init(void)
|
||||
|
||||
@@ -140,9 +140,10 @@ static void twa_unmap_scsi_data(TW_Device_Extension *tw_dev, int request_id);
|
||||
/* Functions */
|
||||
|
||||
/* Show some statistics about the card */
|
||||
static ssize_t twa_show_stats(struct class_device *class_dev, char *buf)
|
||||
static ssize_t twa_show_stats(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(class_dev);
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata;
|
||||
unsigned long flags = 0;
|
||||
ssize_t len;
|
||||
@@ -184,7 +185,7 @@ static int twa_change_queue_depth(struct scsi_device *sdev, int queue_depth)
|
||||
} /* End twa_change_queue_depth() */
|
||||
|
||||
/* Create sysfs 'stats' entry */
|
||||
static struct class_device_attribute twa_host_stats_attr = {
|
||||
static struct device_attribute twa_host_stats_attr = {
|
||||
.attr = {
|
||||
.name = "stats",
|
||||
.mode = S_IRUGO,
|
||||
@@ -193,7 +194,7 @@ static struct class_device_attribute twa_host_stats_attr = {
|
||||
};
|
||||
|
||||
/* Host attributes initializer */
|
||||
static struct class_device_attribute *twa_host_attrs[] = {
|
||||
static struct device_attribute *twa_host_attrs[] = {
|
||||
&twa_host_stats_attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@@ -484,9 +484,10 @@ static void tw_state_request_start(TW_Device_Extension *tw_dev, int *request_id)
|
||||
} /* End tw_state_request_start() */
|
||||
|
||||
/* Show some statistics about the card */
|
||||
static ssize_t tw_show_stats(struct class_device *class_dev, char *buf)
|
||||
static ssize_t tw_show_stats(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(class_dev);
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata;
|
||||
unsigned long flags = 0;
|
||||
ssize_t len;
|
||||
@@ -528,7 +529,7 @@ static int tw_change_queue_depth(struct scsi_device *sdev, int queue_depth)
|
||||
} /* End tw_change_queue_depth() */
|
||||
|
||||
/* Create sysfs 'stats' entry */
|
||||
static struct class_device_attribute tw_host_stats_attr = {
|
||||
static struct device_attribute tw_host_stats_attr = {
|
||||
.attr = {
|
||||
.name = "stats",
|
||||
.mode = S_IRUGO,
|
||||
@@ -537,7 +538,7 @@ static struct class_device_attribute tw_host_stats_attr = {
|
||||
};
|
||||
|
||||
/* Host attributes initializer */
|
||||
static struct class_device_attribute *tw_host_attrs[] = {
|
||||
static struct device_attribute *tw_host_attrs[] = {
|
||||
&tw_host_stats_attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@@ -1316,7 +1316,7 @@ int aac_get_adapter_info(struct aac_dev* dev)
|
||||
tmp>>24,(tmp>>16)&0xff,tmp&0xff,
|
||||
le32_to_cpu(dev->adapter_info.biosbuild));
|
||||
buffer[0] = '\0';
|
||||
if (aac_show_serial_number(
|
||||
if (aac_get_serial_number(
|
||||
shost_to_class(dev->scsi_host_ptr), buffer))
|
||||
printk(KERN_INFO "%s%d: serial %s",
|
||||
dev->name, dev->id, buffer);
|
||||
|
||||
@@ -1850,9 +1850,9 @@ int aac_get_containers(struct aac_dev *dev);
|
||||
int aac_scsi_cmd(struct scsi_cmnd *cmd);
|
||||
int aac_dev_ioctl(struct aac_dev *dev, int cmd, void __user *arg);
|
||||
#ifndef shost_to_class
|
||||
#define shost_to_class(shost) &shost->shost_classdev
|
||||
#define shost_to_class(shost) &shost->shost_dev
|
||||
#endif
|
||||
ssize_t aac_show_serial_number(struct class_device *class_dev, char *buf);
|
||||
ssize_t aac_get_serial_number(struct device *dev, char *buf);
|
||||
int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg);
|
||||
int aac_rx_init(struct aac_dev *dev);
|
||||
int aac_rkt_init(struct aac_dev *dev);
|
||||
|
||||
@@ -755,10 +755,10 @@ static long aac_compat_cfg_ioctl(struct file *file, unsigned cmd, unsigned long
|
||||
}
|
||||
#endif
|
||||
|
||||
static ssize_t aac_show_model(struct class_device *class_dev,
|
||||
char *buf)
|
||||
static ssize_t aac_show_model(struct device *device,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata;
|
||||
struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata;
|
||||
int len;
|
||||
|
||||
if (dev->supplement_adapter_info.AdapterTypeText[0]) {
|
||||
@@ -774,10 +774,10 @@ static ssize_t aac_show_model(struct class_device *class_dev,
|
||||
return len;
|
||||
}
|
||||
|
||||
static ssize_t aac_show_vendor(struct class_device *class_dev,
|
||||
char *buf)
|
||||
static ssize_t aac_show_vendor(struct device *device,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata;
|
||||
struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata;
|
||||
int len;
|
||||
|
||||
if (dev->supplement_adapter_info.AdapterTypeText[0]) {
|
||||
@@ -793,10 +793,11 @@ static ssize_t aac_show_vendor(struct class_device *class_dev,
|
||||
return len;
|
||||
}
|
||||
|
||||
static ssize_t aac_show_flags(struct class_device *class_dev, char *buf)
|
||||
static ssize_t aac_show_flags(struct device *cdev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
int len = 0;
|
||||
struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata;
|
||||
struct aac_dev *dev = (struct aac_dev*)class_to_shost(cdev)->hostdata;
|
||||
|
||||
if (nblank(dprintk(x)))
|
||||
len = snprintf(buf, PAGE_SIZE, "dprintk\n");
|
||||
@@ -812,10 +813,11 @@ static ssize_t aac_show_flags(struct class_device *class_dev, char *buf)
|
||||
return len;
|
||||
}
|
||||
|
||||
static ssize_t aac_show_kernel_version(struct class_device *class_dev,
|
||||
char *buf)
|
||||
static ssize_t aac_show_kernel_version(struct device *device,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata;
|
||||
struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata;
|
||||
int len, tmp;
|
||||
|
||||
tmp = le32_to_cpu(dev->adapter_info.kernelrev);
|
||||
@@ -825,10 +827,11 @@ static ssize_t aac_show_kernel_version(struct class_device *class_dev,
|
||||
return len;
|
||||
}
|
||||
|
||||
static ssize_t aac_show_monitor_version(struct class_device *class_dev,
|
||||
char *buf)
|
||||
static ssize_t aac_show_monitor_version(struct device *device,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata;
|
||||
struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata;
|
||||
int len, tmp;
|
||||
|
||||
tmp = le32_to_cpu(dev->adapter_info.monitorrev);
|
||||
@@ -838,10 +841,11 @@ static ssize_t aac_show_monitor_version(struct class_device *class_dev,
|
||||
return len;
|
||||
}
|
||||
|
||||
static ssize_t aac_show_bios_version(struct class_device *class_dev,
|
||||
char *buf)
|
||||
static ssize_t aac_show_bios_version(struct device *device,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata;
|
||||
struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata;
|
||||
int len, tmp;
|
||||
|
||||
tmp = le32_to_cpu(dev->adapter_info.biosrev);
|
||||
@@ -851,9 +855,10 @@ static ssize_t aac_show_bios_version(struct class_device *class_dev,
|
||||
return len;
|
||||
}
|
||||
|
||||
ssize_t aac_show_serial_number(struct class_device *class_dev, char *buf)
|
||||
ssize_t aac_show_serial_number(struct device *device,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata;
|
||||
struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata;
|
||||
int len = 0;
|
||||
|
||||
if (le32_to_cpu(dev->adapter_info.serial[0]) != 0xBAD0)
|
||||
@@ -869,35 +874,39 @@ ssize_t aac_show_serial_number(struct class_device *class_dev, char *buf)
|
||||
return len;
|
||||
}
|
||||
|
||||
static ssize_t aac_show_max_channel(struct class_device *class_dev, char *buf)
|
||||
static ssize_t aac_show_max_channel(struct device *device,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n",
|
||||
class_to_shost(class_dev)->max_channel);
|
||||
class_to_shost(device)->max_channel);
|
||||
}
|
||||
|
||||
static ssize_t aac_show_max_id(struct class_device *class_dev, char *buf)
|
||||
static ssize_t aac_show_max_id(struct device *device,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n",
|
||||
class_to_shost(class_dev)->max_id);
|
||||
class_to_shost(device)->max_id);
|
||||
}
|
||||
|
||||
static ssize_t aac_store_reset_adapter(struct class_device *class_dev,
|
||||
const char *buf, size_t count)
|
||||
static ssize_t aac_store_reset_adapter(struct device *device,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
int retval = -EACCES;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return retval;
|
||||
retval = aac_reset_adapter((struct aac_dev*)class_to_shost(class_dev)->hostdata, buf[0] == '!');
|
||||
retval = aac_reset_adapter((struct aac_dev*)class_to_shost(device)->hostdata, buf[0] == '!');
|
||||
if (retval >= 0)
|
||||
retval = count;
|
||||
return retval;
|
||||
}
|
||||
|
||||
static ssize_t aac_show_reset_adapter(struct class_device *class_dev,
|
||||
char *buf)
|
||||
static ssize_t aac_show_reset_adapter(struct device *device,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata;
|
||||
struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata;
|
||||
int len, tmp;
|
||||
|
||||
tmp = aac_adapter_check_health(dev);
|
||||
@@ -907,70 +916,70 @@ static ssize_t aac_show_reset_adapter(struct class_device *class_dev,
|
||||
return len;
|
||||
}
|
||||
|
||||
static struct class_device_attribute aac_model = {
|
||||
static struct device_attribute aac_model = {
|
||||
.attr = {
|
||||
.name = "model",
|
||||
.mode = S_IRUGO,
|
||||
},
|
||||
.show = aac_show_model,
|
||||
};
|
||||
static struct class_device_attribute aac_vendor = {
|
||||
static struct device_attribute aac_vendor = {
|
||||
.attr = {
|
||||
.name = "vendor",
|
||||
.mode = S_IRUGO,
|
||||
},
|
||||
.show = aac_show_vendor,
|
||||
};
|
||||
static struct class_device_attribute aac_flags = {
|
||||
static struct device_attribute aac_flags = {
|
||||
.attr = {
|
||||
.name = "flags",
|
||||
.mode = S_IRUGO,
|
||||
},
|
||||
.show = aac_show_flags,
|
||||
};
|
||||
static struct class_device_attribute aac_kernel_version = {
|
||||
static struct device_attribute aac_kernel_version = {
|
||||
.attr = {
|
||||
.name = "hba_kernel_version",
|
||||
.mode = S_IRUGO,
|
||||
},
|
||||
.show = aac_show_kernel_version,
|
||||
};
|
||||
static struct class_device_attribute aac_monitor_version = {
|
||||
static struct device_attribute aac_monitor_version = {
|
||||
.attr = {
|
||||
.name = "hba_monitor_version",
|
||||
.mode = S_IRUGO,
|
||||
},
|
||||
.show = aac_show_monitor_version,
|
||||
};
|
||||
static struct class_device_attribute aac_bios_version = {
|
||||
static struct device_attribute aac_bios_version = {
|
||||
.attr = {
|
||||
.name = "hba_bios_version",
|
||||
.mode = S_IRUGO,
|
||||
},
|
||||
.show = aac_show_bios_version,
|
||||
};
|
||||
static struct class_device_attribute aac_serial_number = {
|
||||
static struct device_attribute aac_serial_number = {
|
||||
.attr = {
|
||||
.name = "serial_number",
|
||||
.mode = S_IRUGO,
|
||||
},
|
||||
.show = aac_show_serial_number,
|
||||
};
|
||||
static struct class_device_attribute aac_max_channel = {
|
||||
static struct device_attribute aac_max_channel = {
|
||||
.attr = {
|
||||
.name = "max_channel",
|
||||
.mode = S_IRUGO,
|
||||
},
|
||||
.show = aac_show_max_channel,
|
||||
};
|
||||
static struct class_device_attribute aac_max_id = {
|
||||
static struct device_attribute aac_max_id = {
|
||||
.attr = {
|
||||
.name = "max_id",
|
||||
.mode = S_IRUGO,
|
||||
},
|
||||
.show = aac_show_max_id,
|
||||
};
|
||||
static struct class_device_attribute aac_reset = {
|
||||
static struct device_attribute aac_reset = {
|
||||
.attr = {
|
||||
.name = "reset_host",
|
||||
.mode = S_IWUSR|S_IRUGO,
|
||||
@@ -979,7 +988,7 @@ static struct class_device_attribute aac_reset = {
|
||||
.show = aac_show_reset_adapter,
|
||||
};
|
||||
|
||||
static struct class_device_attribute *aac_attrs[] = {
|
||||
static struct device_attribute *aac_attrs[] = {
|
||||
&aac_model,
|
||||
&aac_vendor,
|
||||
&aac_flags,
|
||||
@@ -993,6 +1002,10 @@ static struct class_device_attribute *aac_attrs[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
ssize_t aac_get_serial_number(struct device *device, char *buf)
|
||||
{
|
||||
return aac_show_serial_number(device, &aac_serial_number, buf);
|
||||
}
|
||||
|
||||
static const struct file_operations aac_cfg_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
*/
|
||||
#include <linux/interrupt.h>
|
||||
|
||||
struct class_device_attribute;
|
||||
struct device_attribute;
|
||||
/*The limit of outstanding scsi command that firmware can handle*/
|
||||
#define ARCMSR_MAX_OUTSTANDING_CMD 256
|
||||
#define ARCMSR_MAX_FREECCB_NUM 320
|
||||
@@ -556,6 +556,6 @@ struct SENSE_DATA
|
||||
extern void arcmsr_post_ioctldata2iop(struct AdapterControlBlock *);
|
||||
extern void arcmsr_iop_message_read(struct AdapterControlBlock *);
|
||||
extern struct QBUFFER __iomem *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *);
|
||||
extern struct class_device_attribute *arcmsr_host_attrs[];
|
||||
extern struct device_attribute *arcmsr_host_attrs[];
|
||||
extern int arcmsr_alloc_sysfs_attr(struct AdapterControlBlock *);
|
||||
void arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb);
|
||||
|
||||
@@ -57,15 +57,15 @@
|
||||
#include <scsi/scsi_transport.h>
|
||||
#include "arcmsr.h"
|
||||
|
||||
struct class_device_attribute *arcmsr_host_attrs[];
|
||||
struct device_attribute *arcmsr_host_attrs[];
|
||||
|
||||
static ssize_t arcmsr_sysfs_iop_message_read(struct kobject *kobj,
|
||||
struct bin_attribute *bin,
|
||||
char *buf, loff_t off,
|
||||
size_t count)
|
||||
{
|
||||
struct class_device *cdev = container_of(kobj,struct class_device,kobj);
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct device *dev = container_of(kobj,struct device,kobj);
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata;
|
||||
uint8_t *pQbuffer,*ptmpQbuffer;
|
||||
int32_t allxfer_len = 0;
|
||||
@@ -110,8 +110,8 @@ static ssize_t arcmsr_sysfs_iop_message_write(struct kobject *kobj,
|
||||
char *buf, loff_t off,
|
||||
size_t count)
|
||||
{
|
||||
struct class_device *cdev = container_of(kobj,struct class_device,kobj);
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct device *dev = container_of(kobj,struct device,kobj);
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata;
|
||||
int32_t my_empty_len, user_len, wqbuf_firstindex, wqbuf_lastindex;
|
||||
uint8_t *pQbuffer, *ptmpuserbuffer;
|
||||
@@ -158,8 +158,8 @@ static ssize_t arcmsr_sysfs_iop_message_clear(struct kobject *kobj,
|
||||
char *buf, loff_t off,
|
||||
size_t count)
|
||||
{
|
||||
struct class_device *cdev = container_of(kobj,struct class_device,kobj);
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct device *dev = container_of(kobj,struct device,kobj);
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata;
|
||||
uint8_t *pQbuffer;
|
||||
|
||||
@@ -220,87 +220,104 @@ int arcmsr_alloc_sysfs_attr(struct AdapterControlBlock *acb)
|
||||
struct Scsi_Host *host = acb->host;
|
||||
int error;
|
||||
|
||||
error = sysfs_create_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_read_attr);
|
||||
error = sysfs_create_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_read_attr);
|
||||
if (error) {
|
||||
printk(KERN_ERR "arcmsr: alloc sysfs mu_read failed\n");
|
||||
goto error_bin_file_message_read;
|
||||
}
|
||||
error = sysfs_create_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_write_attr);
|
||||
error = sysfs_create_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_write_attr);
|
||||
if (error) {
|
||||
printk(KERN_ERR "arcmsr: alloc sysfs mu_write failed\n");
|
||||
goto error_bin_file_message_write;
|
||||
}
|
||||
error = sysfs_create_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_clear_attr);
|
||||
error = sysfs_create_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_clear_attr);
|
||||
if (error) {
|
||||
printk(KERN_ERR "arcmsr: alloc sysfs mu_clear failed\n");
|
||||
goto error_bin_file_message_clear;
|
||||
}
|
||||
return 0;
|
||||
error_bin_file_message_clear:
|
||||
sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_write_attr);
|
||||
sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_write_attr);
|
||||
error_bin_file_message_write:
|
||||
sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_read_attr);
|
||||
sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_read_attr);
|
||||
error_bin_file_message_read:
|
||||
return error;
|
||||
}
|
||||
|
||||
void
|
||||
arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb) {
|
||||
void arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb)
|
||||
{
|
||||
struct Scsi_Host *host = acb->host;
|
||||
|
||||
sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_clear_attr);
|
||||
sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_write_attr);
|
||||
sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_read_attr);
|
||||
sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_clear_attr);
|
||||
sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_write_attr);
|
||||
sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_read_attr);
|
||||
}
|
||||
|
||||
|
||||
static ssize_t
|
||||
arcmsr_attr_host_driver_version(struct class_device *cdev, char *buf) {
|
||||
arcmsr_attr_host_driver_version(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
return snprintf(buf, PAGE_SIZE,
|
||||
"%s\n",
|
||||
ARCMSR_DRIVER_VERSION);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
arcmsr_attr_host_driver_posted_cmd(struct class_device *cdev, char *buf) {
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata;
|
||||
arcmsr_attr_host_driver_posted_cmd(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
struct AdapterControlBlock *acb =
|
||||
(struct AdapterControlBlock *) host->hostdata;
|
||||
return snprintf(buf, PAGE_SIZE,
|
||||
"%4d\n",
|
||||
atomic_read(&acb->ccboutstandingcount));
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
arcmsr_attr_host_driver_reset(struct class_device *cdev, char *buf) {
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata;
|
||||
arcmsr_attr_host_driver_reset(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
struct AdapterControlBlock *acb =
|
||||
(struct AdapterControlBlock *) host->hostdata;
|
||||
return snprintf(buf, PAGE_SIZE,
|
||||
"%4d\n",
|
||||
acb->num_resets);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
arcmsr_attr_host_driver_abort(struct class_device *cdev, char *buf) {
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata;
|
||||
arcmsr_attr_host_driver_abort(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
struct AdapterControlBlock *acb =
|
||||
(struct AdapterControlBlock *) host->hostdata;
|
||||
return snprintf(buf, PAGE_SIZE,
|
||||
"%4d\n",
|
||||
acb->num_aborts);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
arcmsr_attr_host_fw_model(struct class_device *cdev, char *buf) {
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata;
|
||||
arcmsr_attr_host_fw_model(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
struct AdapterControlBlock *acb =
|
||||
(struct AdapterControlBlock *) host->hostdata;
|
||||
return snprintf(buf, PAGE_SIZE,
|
||||
"%s\n",
|
||||
acb->firm_model);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
arcmsr_attr_host_fw_version(struct class_device *cdev, char *buf) {
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata;
|
||||
arcmsr_attr_host_fw_version(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
struct AdapterControlBlock *acb =
|
||||
(struct AdapterControlBlock *) host->hostdata;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE,
|
||||
"%s\n",
|
||||
@@ -308,9 +325,12 @@ arcmsr_attr_host_fw_version(struct class_device *cdev, char *buf) {
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
arcmsr_attr_host_fw_request_len(struct class_device *cdev, char *buf) {
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata;
|
||||
arcmsr_attr_host_fw_request_len(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
struct AdapterControlBlock *acb =
|
||||
(struct AdapterControlBlock *) host->hostdata;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE,
|
||||
"%4d\n",
|
||||
@@ -318,9 +338,12 @@ arcmsr_attr_host_fw_request_len(struct class_device *cdev, char *buf) {
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
arcmsr_attr_host_fw_numbers_queue(struct class_device *cdev, char *buf) {
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata;
|
||||
arcmsr_attr_host_fw_numbers_queue(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
struct AdapterControlBlock *acb =
|
||||
(struct AdapterControlBlock *) host->hostdata;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE,
|
||||
"%4d\n",
|
||||
@@ -328,9 +351,12 @@ arcmsr_attr_host_fw_numbers_queue(struct class_device *cdev, char *buf) {
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
arcmsr_attr_host_fw_sdram_size(struct class_device *cdev, char *buf) {
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata;
|
||||
arcmsr_attr_host_fw_sdram_size(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
struct AdapterControlBlock *acb =
|
||||
(struct AdapterControlBlock *) host->hostdata;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE,
|
||||
"%4d\n",
|
||||
@@ -338,36 +364,39 @@ arcmsr_attr_host_fw_sdram_size(struct class_device *cdev, char *buf) {
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
arcmsr_attr_host_fw_hd_channels(struct class_device *cdev, char *buf) {
|
||||
struct Scsi_Host *host = class_to_shost(cdev);
|
||||
struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata;
|
||||
arcmsr_attr_host_fw_hd_channels(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
struct AdapterControlBlock *acb =
|
||||
(struct AdapterControlBlock *) host->hostdata;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE,
|
||||
"%4d\n",
|
||||
acb->firm_hd_channels);
|
||||
}
|
||||
|
||||
static CLASS_DEVICE_ATTR(host_driver_version, S_IRUGO, arcmsr_attr_host_driver_version, NULL);
|
||||
static CLASS_DEVICE_ATTR(host_driver_posted_cmd, S_IRUGO, arcmsr_attr_host_driver_posted_cmd, NULL);
|
||||
static CLASS_DEVICE_ATTR(host_driver_reset, S_IRUGO, arcmsr_attr_host_driver_reset, NULL);
|
||||
static CLASS_DEVICE_ATTR(host_driver_abort, S_IRUGO, arcmsr_attr_host_driver_abort, NULL);
|
||||
static CLASS_DEVICE_ATTR(host_fw_model, S_IRUGO, arcmsr_attr_host_fw_model, NULL);
|
||||
static CLASS_DEVICE_ATTR(host_fw_version, S_IRUGO, arcmsr_attr_host_fw_version, NULL);
|
||||
static CLASS_DEVICE_ATTR(host_fw_request_len, S_IRUGO, arcmsr_attr_host_fw_request_len, NULL);
|
||||
static CLASS_DEVICE_ATTR(host_fw_numbers_queue, S_IRUGO, arcmsr_attr_host_fw_numbers_queue, NULL);
|
||||
static CLASS_DEVICE_ATTR(host_fw_sdram_size, S_IRUGO, arcmsr_attr_host_fw_sdram_size, NULL);
|
||||
static CLASS_DEVICE_ATTR(host_fw_hd_channels, S_IRUGO, arcmsr_attr_host_fw_hd_channels, NULL);
|
||||
static DEVICE_ATTR(host_driver_version, S_IRUGO, arcmsr_attr_host_driver_version, NULL);
|
||||
static DEVICE_ATTR(host_driver_posted_cmd, S_IRUGO, arcmsr_attr_host_driver_posted_cmd, NULL);
|
||||
static DEVICE_ATTR(host_driver_reset, S_IRUGO, arcmsr_attr_host_driver_reset, NULL);
|
||||
static DEVICE_ATTR(host_driver_abort, S_IRUGO, arcmsr_attr_host_driver_abort, NULL);
|
||||
static DEVICE_ATTR(host_fw_model, S_IRUGO, arcmsr_attr_host_fw_model, NULL);
|
||||
static DEVICE_ATTR(host_fw_version, S_IRUGO, arcmsr_attr_host_fw_version, NULL);
|
||||
static DEVICE_ATTR(host_fw_request_len, S_IRUGO, arcmsr_attr_host_fw_request_len, NULL);
|
||||
static DEVICE_ATTR(host_fw_numbers_queue, S_IRUGO, arcmsr_attr_host_fw_numbers_queue, NULL);
|
||||
static DEVICE_ATTR(host_fw_sdram_size, S_IRUGO, arcmsr_attr_host_fw_sdram_size, NULL);
|
||||
static DEVICE_ATTR(host_fw_hd_channels, S_IRUGO, arcmsr_attr_host_fw_hd_channels, NULL);
|
||||
|
||||
struct class_device_attribute *arcmsr_host_attrs[] = {
|
||||
&class_device_attr_host_driver_version,
|
||||
&class_device_attr_host_driver_posted_cmd,
|
||||
&class_device_attr_host_driver_reset,
|
||||
&class_device_attr_host_driver_abort,
|
||||
&class_device_attr_host_fw_model,
|
||||
&class_device_attr_host_fw_version,
|
||||
&class_device_attr_host_fw_request_len,
|
||||
&class_device_attr_host_fw_numbers_queue,
|
||||
&class_device_attr_host_fw_sdram_size,
|
||||
&class_device_attr_host_fw_hd_channels,
|
||||
struct device_attribute *arcmsr_host_attrs[] = {
|
||||
&dev_attr_host_driver_version,
|
||||
&dev_attr_host_driver_posted_cmd,
|
||||
&dev_attr_host_driver_reset,
|
||||
&dev_attr_host_driver_abort,
|
||||
&dev_attr_host_fw_model,
|
||||
&dev_attr_host_fw_version,
|
||||
&dev_attr_host_fw_request_len,
|
||||
&dev_attr_host_fw_numbers_queue,
|
||||
&dev_attr_host_fw_sdram_size,
|
||||
&dev_attr_host_fw_hd_channels,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@@ -881,7 +881,7 @@ static long ch_ioctl_compat(struct file * file,
|
||||
static int ch_probe(struct device *dev)
|
||||
{
|
||||
struct scsi_device *sd = to_scsi_device(dev);
|
||||
struct class_device *class_dev;
|
||||
struct device *class_dev;
|
||||
int minor, ret = -ENOMEM;
|
||||
scsi_changer *ch;
|
||||
|
||||
@@ -910,11 +910,11 @@ static int ch_probe(struct device *dev)
|
||||
ch->minor = minor;
|
||||
sprintf(ch->name,"ch%d",ch->minor);
|
||||
|
||||
class_dev = class_device_create(ch_sysfs_class, NULL,
|
||||
MKDEV(SCSI_CHANGER_MAJOR, ch->minor),
|
||||
dev, "s%s", ch->name);
|
||||
class_dev = device_create(ch_sysfs_class, dev,
|
||||
MKDEV(SCSI_CHANGER_MAJOR,ch->minor),
|
||||
"s%s", ch->name);
|
||||
if (IS_ERR(class_dev)) {
|
||||
printk(KERN_WARNING "ch%d: class_device_create failed\n",
|
||||
printk(KERN_WARNING "ch%d: device_create failed\n",
|
||||
ch->minor);
|
||||
ret = PTR_ERR(class_dev);
|
||||
goto remove_idr;
|
||||
@@ -945,8 +945,7 @@ static int ch_remove(struct device *dev)
|
||||
idr_remove(&ch_index_idr, ch->minor);
|
||||
spin_unlock(&ch_index_lock);
|
||||
|
||||
class_device_destroy(ch_sysfs_class,
|
||||
MKDEV(SCSI_CHANGER_MAJOR,ch->minor));
|
||||
device_destroy(ch_sysfs_class, MKDEV(SCSI_CHANGER_MAJOR,ch->minor));
|
||||
kfree(ch->dt);
|
||||
kfree(ch);
|
||||
return 0;
|
||||
|
||||
@@ -43,14 +43,14 @@
|
||||
static int scsi_host_next_hn; /* host_no for next new host */
|
||||
|
||||
|
||||
static void scsi_host_cls_release(struct class_device *class_dev)
|
||||
static void scsi_host_cls_release(struct device *dev)
|
||||
{
|
||||
put_device(&class_to_shost(class_dev)->shost_gendev);
|
||||
put_device(&class_to_shost(dev)->shost_gendev);
|
||||
}
|
||||
|
||||
static struct class shost_class = {
|
||||
.name = "scsi_host",
|
||||
.release = scsi_host_cls_release,
|
||||
.dev_release = scsi_host_cls_release,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -174,7 +174,7 @@ void scsi_remove_host(struct Scsi_Host *shost)
|
||||
spin_unlock_irqrestore(shost->host_lock, flags);
|
||||
|
||||
transport_unregister_device(&shost->shost_gendev);
|
||||
class_device_unregister(&shost->shost_classdev);
|
||||
device_unregister(&shost->shost_dev);
|
||||
device_del(&shost->shost_gendev);
|
||||
scsi_proc_hostdir_rm(shost->hostt);
|
||||
}
|
||||
@@ -212,7 +212,7 @@ int scsi_add_host(struct Scsi_Host *shost, struct device *dev)
|
||||
scsi_host_set_state(shost, SHOST_RUNNING);
|
||||
get_device(shost->shost_gendev.parent);
|
||||
|
||||
error = class_device_add(&shost->shost_classdev);
|
||||
error = device_add(&shost->shost_dev);
|
||||
if (error)
|
||||
goto out_del_gendev;
|
||||
|
||||
@@ -223,7 +223,7 @@ int scsi_add_host(struct Scsi_Host *shost, struct device *dev)
|
||||
GFP_KERNEL);
|
||||
if (shost->shost_data == NULL) {
|
||||
error = -ENOMEM;
|
||||
goto out_del_classdev;
|
||||
goto out_del_dev;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,8 +250,8 @@ int scsi_add_host(struct Scsi_Host *shost, struct device *dev)
|
||||
destroy_workqueue(shost->work_q);
|
||||
out_free_shost_data:
|
||||
kfree(shost->shost_data);
|
||||
out_del_classdev:
|
||||
class_device_del(&shost->shost_classdev);
|
||||
out_del_dev:
|
||||
device_del(&shost->shost_dev);
|
||||
out_del_gendev:
|
||||
device_del(&shost->shost_gendev);
|
||||
out:
|
||||
@@ -385,11 +385,11 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
|
||||
shost->host_no);
|
||||
shost->shost_gendev.release = scsi_host_dev_release;
|
||||
|
||||
class_device_initialize(&shost->shost_classdev);
|
||||
shost->shost_classdev.dev = &shost->shost_gendev;
|
||||
shost->shost_classdev.class = &shost_class;
|
||||
snprintf(shost->shost_classdev.class_id, BUS_ID_SIZE, "host%d",
|
||||
shost->host_no);
|
||||
device_initialize(&shost->shost_dev);
|
||||
shost->shost_dev.parent = &shost->shost_gendev;
|
||||
shost->shost_dev.class = &shost_class;
|
||||
snprintf(shost->shost_dev.bus_id, BUS_ID_SIZE, "host%d",
|
||||
shost->host_no);
|
||||
|
||||
shost->ehandler = kthread_run(scsi_error_handler, shost,
|
||||
"scsi_eh_%d", shost->host_no);
|
||||
@@ -432,12 +432,12 @@ void scsi_unregister(struct Scsi_Host *shost)
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_unregister);
|
||||
|
||||
static int __scsi_host_match(struct class_device *cdev, void *data)
|
||||
static int __scsi_host_match(struct device *dev, void *data)
|
||||
{
|
||||
struct Scsi_Host *p;
|
||||
unsigned short *hostnum = (unsigned short *)data;
|
||||
|
||||
p = class_to_shost(cdev);
|
||||
p = class_to_shost(dev);
|
||||
return p->host_no == *hostnum;
|
||||
}
|
||||
|
||||
@@ -450,10 +450,10 @@ static int __scsi_host_match(struct class_device *cdev, void *data)
|
||||
**/
|
||||
struct Scsi_Host *scsi_host_lookup(unsigned short hostnum)
|
||||
{
|
||||
struct class_device *cdev;
|
||||
struct device *cdev;
|
||||
struct Scsi_Host *shost = ERR_PTR(-ENXIO);
|
||||
|
||||
cdev = class_find_child(&shost_class, &hostnum, __scsi_host_match);
|
||||
cdev = class_find_device(&shost_class, &hostnum, __scsi_host_match);
|
||||
if (cdev)
|
||||
shost = scsi_host_get(class_to_shost(cdev));
|
||||
|
||||
|
||||
@@ -859,14 +859,16 @@ static int hptiop_adjust_disk_queue_depth(struct scsi_device *sdev,
|
||||
return queue_depth;
|
||||
}
|
||||
|
||||
static ssize_t hptiop_show_version(struct class_device *class_dev, char *buf)
|
||||
static ssize_t hptiop_show_version(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
return snprintf(buf, PAGE_SIZE, "%s\n", driver_ver);
|
||||
}
|
||||
|
||||
static ssize_t hptiop_show_fw_version(struct class_device *class_dev, char *buf)
|
||||
static ssize_t hptiop_show_fw_version(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct Scsi_Host *host = class_to_shost(class_dev);
|
||||
struct Scsi_Host *host = class_to_shost(dev);
|
||||
struct hptiop_hba *hba = (struct hptiop_hba *)host->hostdata;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%d.%d.%d.%d\n",
|
||||
@@ -876,7 +878,7 @@ static ssize_t hptiop_show_fw_version(struct class_device *class_dev, char *buf)
|
||||
hba->firmware_version & 0xff);
|
||||
}
|
||||
|
||||
static struct class_device_attribute hptiop_attr_version = {
|
||||
static struct device_attribute hptiop_attr_version = {
|
||||
.attr = {
|
||||
.name = "driver-version",
|
||||
.mode = S_IRUGO,
|
||||
@@ -884,7 +886,7 @@ static struct class_device_attribute hptiop_attr_version = {
|
||||
.show = hptiop_show_version,
|
||||
};
|
||||
|
||||
static struct class_device_attribute hptiop_attr_fw_version = {
|
||||
static struct device_attribute hptiop_attr_fw_version = {
|
||||
.attr = {
|
||||
.name = "firmware-version",
|
||||
.mode = S_IRUGO,
|
||||
@@ -892,7 +894,7 @@ static struct class_device_attribute hptiop_attr_fw_version = {
|
||||
.show = hptiop_show_fw_version,
|
||||
};
|
||||
|
||||
static struct class_device_attribute *hptiop_attrs[] = {
|
||||
static struct device_attribute *hptiop_attrs[] = {
|
||||
&hptiop_attr_version,
|
||||
&hptiop_attr_fw_version,
|
||||
NULL
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user