Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 56407
b: refs/heads/master
c: bba9b60
h: refs/heads/master
i:
  56405: db6f8c2
  56403: 5569448
  56399: 6f80f12
v: v3
  • Loading branch information
Joachim Fenkes authored and Roland Dreier committed May 14, 2007
1 parent 922a0a7 commit 6c9dcd9
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 50 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: c7a14939e78e75dd90b54cb0df371019bc6d3e89
refs/heads/master: bba9b6013e604fadb298191c058149acf1cdfced
86 changes: 37 additions & 49 deletions trunk/drivers/infiniband/hw/ehca/ehca_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,15 +454,14 @@ static ssize_t ehca_store_debug_level(struct device_driver *ddp,
DRIVER_ATTR(debug_level, S_IRUSR | S_IWUSR,
ehca_show_debug_level, ehca_store_debug_level);

void ehca_create_driver_sysfs(struct ibmebus_driver *drv)
{
driver_create_file(&drv->driver, &driver_attr_debug_level);
}
static struct attribute *ehca_drv_attrs[] = {
&driver_attr_debug_level.attr,
NULL
};

void ehca_remove_driver_sysfs(struct ibmebus_driver *drv)
{
driver_remove_file(&drv->driver, &driver_attr_debug_level);
}
static struct attribute_group ehca_drv_attr_grp = {
.attrs = ehca_drv_attrs
};

#define EHCA_RESOURCE_ATTR(name) \
static ssize_t ehca_show_##name(struct device *dev, \
Expand Down Expand Up @@ -524,44 +523,28 @@ static ssize_t ehca_show_adapter_handle(struct device *dev,
}
static DEVICE_ATTR(adapter_handle, S_IRUGO, ehca_show_adapter_handle, NULL);

static struct attribute *ehca_dev_attrs[] = {
&dev_attr_adapter_handle.attr,
&dev_attr_num_ports.attr,
&dev_attr_hw_ver.attr,
&dev_attr_max_eq.attr,
&dev_attr_cur_eq.attr,
&dev_attr_max_cq.attr,
&dev_attr_cur_cq.attr,
&dev_attr_max_qp.attr,
&dev_attr_cur_qp.attr,
&dev_attr_max_mr.attr,
&dev_attr_cur_mr.attr,
&dev_attr_max_mw.attr,
&dev_attr_cur_mw.attr,
&dev_attr_max_pd.attr,
&dev_attr_max_ah.attr,
NULL
};

void ehca_create_device_sysfs(struct ibmebus_dev *dev)
{
device_create_file(&dev->ofdev.dev, &dev_attr_adapter_handle);
device_create_file(&dev->ofdev.dev, &dev_attr_num_ports);
device_create_file(&dev->ofdev.dev, &dev_attr_hw_ver);
device_create_file(&dev->ofdev.dev, &dev_attr_max_eq);
device_create_file(&dev->ofdev.dev, &dev_attr_cur_eq);
device_create_file(&dev->ofdev.dev, &dev_attr_max_cq);
device_create_file(&dev->ofdev.dev, &dev_attr_cur_cq);
device_create_file(&dev->ofdev.dev, &dev_attr_max_qp);
device_create_file(&dev->ofdev.dev, &dev_attr_cur_qp);
device_create_file(&dev->ofdev.dev, &dev_attr_max_mr);
device_create_file(&dev->ofdev.dev, &dev_attr_cur_mr);
device_create_file(&dev->ofdev.dev, &dev_attr_max_mw);
device_create_file(&dev->ofdev.dev, &dev_attr_cur_mw);
device_create_file(&dev->ofdev.dev, &dev_attr_max_pd);
device_create_file(&dev->ofdev.dev, &dev_attr_max_ah);
}

void ehca_remove_device_sysfs(struct ibmebus_dev *dev)
{
device_remove_file(&dev->ofdev.dev, &dev_attr_adapter_handle);
device_remove_file(&dev->ofdev.dev, &dev_attr_num_ports);
device_remove_file(&dev->ofdev.dev, &dev_attr_hw_ver);
device_remove_file(&dev->ofdev.dev, &dev_attr_max_eq);
device_remove_file(&dev->ofdev.dev, &dev_attr_cur_eq);
device_remove_file(&dev->ofdev.dev, &dev_attr_max_cq);
device_remove_file(&dev->ofdev.dev, &dev_attr_cur_cq);
device_remove_file(&dev->ofdev.dev, &dev_attr_max_qp);
device_remove_file(&dev->ofdev.dev, &dev_attr_cur_qp);
device_remove_file(&dev->ofdev.dev, &dev_attr_max_mr);
device_remove_file(&dev->ofdev.dev, &dev_attr_cur_mr);
device_remove_file(&dev->ofdev.dev, &dev_attr_max_mw);
device_remove_file(&dev->ofdev.dev, &dev_attr_cur_mw);
device_remove_file(&dev->ofdev.dev, &dev_attr_max_pd);
device_remove_file(&dev->ofdev.dev, &dev_attr_max_ah);
}
static struct attribute_group ehca_dev_attr_grp = {
.attrs = ehca_dev_attrs
};

static int __devinit ehca_probe(struct ibmebus_dev *dev,
const struct of_device_id *id)
Expand Down Expand Up @@ -669,7 +652,10 @@ static int __devinit ehca_probe(struct ibmebus_dev *dev,
}
}

ehca_create_device_sysfs(dev);
ret = sysfs_create_group(&dev->ofdev.dev.kobj, &ehca_dev_attr_grp);
if (ret) /* only complain; we can live without attributes */
ehca_err(&shca->ib_device,
"Cannot create device attributes ret=%d", ret);

spin_lock(&shca_list_lock);
list_add(&shca->shca_list, &shca_list);
Expand Down Expand Up @@ -721,7 +707,7 @@ static int __devexit ehca_remove(struct ibmebus_dev *dev)
struct ehca_shca *shca = dev->ofdev.dev.driver_data;
int ret;

ehca_remove_device_sysfs(dev);
sysfs_remove_group(&dev->ofdev.dev.kobj, &ehca_dev_attr_grp);

if (ehca_open_aqp1 == 1) {
int i;
Expand Down Expand Up @@ -840,7 +826,9 @@ int __init ehca_module_init(void)
goto module_init2;
}

ehca_create_driver_sysfs(&ehca_driver);
ret = sysfs_create_group(&ehca_driver.driver.kobj, &ehca_drv_attr_grp);
if (ret) /* only complain; we can live without attributes */
ehca_gen_err("Cannot create driver attributes ret=%d", ret);

if (ehca_poll_all_eqs != 1) {
ehca_gen_err("WARNING!!!");
Expand All @@ -867,7 +855,7 @@ void __exit ehca_module_exit(void)
if (ehca_poll_all_eqs == 1)
del_timer_sync(&poll_eqs_timer);

ehca_remove_driver_sysfs(&ehca_driver);
sysfs_remove_group(&ehca_driver.driver.kobj, &ehca_drv_attr_grp);
ibmebus_unregister_driver(&ehca_driver);

ehca_destroy_slab_caches();
Expand Down

0 comments on commit 6c9dcd9

Please sign in to comment.