X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=drivers%2Fpnp%2Finterface.c;h=c3f1c8e9d2545a4859d984ed7237455ec8e8ca36;hb=54074d59320581a6d7e4f4dd405e8cac1d174b75;hp=a876ecf7028c06c003d5fc1aed974bb9f5f97f98;hpb=0679c2f47d50651018dd5e0bf35330f6e6ae35ec;p=firefly-linux-kernel-4.4.55.git diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c index a876ecf7028c..c3f1c8e9d254 100644 --- a/drivers/pnp/interface.c +++ b/drivers/pnp/interface.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -243,8 +242,6 @@ static ssize_t pnp_show_options(struct device *dmdev, return ret; } -static DEVICE_ATTR(options, S_IRUGO, pnp_show_options, NULL); - static ssize_t pnp_show_current_resources(struct device *dmdev, struct device_attribute *attr, char *buf) @@ -420,9 +417,6 @@ done: return count; } -static DEVICE_ATTR(resources, S_IRUGO | S_IWUSR, - pnp_show_current_resources, pnp_set_current_resources); - static ssize_t pnp_show_current_ids(struct device *dmdev, struct device_attribute *attr, char *buf) { @@ -437,27 +431,11 @@ static ssize_t pnp_show_current_ids(struct device *dmdev, return (str - buf); } -static DEVICE_ATTR(id, S_IRUGO, pnp_show_current_ids, NULL); - -int pnp_interface_attach_device(struct pnp_dev *dev) -{ - int rc = device_create_file(&dev->dev, &dev_attr_options); - - if (rc) - goto err; - rc = device_create_file(&dev->dev, &dev_attr_resources); - if (rc) - goto err_opt; - rc = device_create_file(&dev->dev, &dev_attr_id); - if (rc) - goto err_res; - - return 0; - -err_res: - device_remove_file(&dev->dev, &dev_attr_resources); -err_opt: - device_remove_file(&dev->dev, &dev_attr_options); -err: - return rc; -} +struct device_attribute pnp_interface_attrs[] = { + __ATTR(resources, S_IRUGO | S_IWUSR, + pnp_show_current_resources, + pnp_set_current_resources), + __ATTR(options, S_IRUGO, pnp_show_options, NULL), + __ATTR(id, S_IRUGO, pnp_show_current_ids, NULL), + __ATTR_NULL, +};