aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/i2c/i2c-core.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 79ac8605936d..7730a68fa2d0 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -709,6 +709,7 @@ show_name(struct device *dev, struct device_attribute *attr, char *buf)
709 return sprintf(buf, "%s\n", dev->type == &i2c_client_type ? 709 return sprintf(buf, "%s\n", dev->type == &i2c_client_type ?
710 to_i2c_client(dev)->name : to_i2c_adapter(dev)->name); 710 to_i2c_client(dev)->name : to_i2c_adapter(dev)->name);
711} 711}
712static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
712 713
713static ssize_t 714static ssize_t
714show_modalias(struct device *dev, struct device_attribute *attr, char *buf) 715show_modalias(struct device *dev, struct device_attribute *attr, char *buf)
@@ -722,8 +723,6 @@ show_modalias(struct device *dev, struct device_attribute *attr, char *buf)
722 723
723 return sprintf(buf, "%s%s\n", I2C_MODULE_PREFIX, client->name); 724 return sprintf(buf, "%s%s\n", I2C_MODULE_PREFIX, client->name);
724} 725}
725
726static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
727static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL); 726static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL);
728 727
729static struct attribute *i2c_dev_attrs[] = { 728static struct attribute *i2c_dev_attrs[] = {
@@ -732,15 +731,7 @@ static struct attribute *i2c_dev_attrs[] = {
732 &dev_attr_modalias.attr, 731 &dev_attr_modalias.attr,
733 NULL 732 NULL
734}; 733};
735 734ATTRIBUTE_GROUPS(i2c_dev);
736static struct attribute_group i2c_dev_attr_group = {
737 .attrs = i2c_dev_attrs,
738};
739
740static const struct attribute_group *i2c_dev_attr_groups[] = {
741 &i2c_dev_attr_group,
742 NULL
743};
744 735
745struct bus_type i2c_bus_type = { 736struct bus_type i2c_bus_type = {
746 .name = "i2c", 737 .name = "i2c",
@@ -752,7 +743,7 @@ struct bus_type i2c_bus_type = {
752EXPORT_SYMBOL_GPL(i2c_bus_type); 743EXPORT_SYMBOL_GPL(i2c_bus_type);
753 744
754static struct device_type i2c_client_type = { 745static struct device_type i2c_client_type = {
755 .groups = i2c_dev_attr_groups, 746 .groups = i2c_dev_groups,
756 .uevent = i2c_device_uevent, 747 .uevent = i2c_device_uevent,
757 .release = i2c_client_dev_release, 748 .release = i2c_client_dev_release,
758}; 749};
@@ -1151,6 +1142,7 @@ i2c_sysfs_new_device(struct device *dev, struct device_attribute *attr,
1151 1142
1152 return count; 1143 return count;
1153} 1144}
1145static DEVICE_ATTR(new_device, S_IWUSR, NULL, i2c_sysfs_new_device);
1154 1146
1155/* 1147/*
1156 * And of course let the users delete the devices they instantiated, if 1148 * And of course let the users delete the devices they instantiated, if
@@ -1205,8 +1197,6 @@ i2c_sysfs_delete_device(struct device *dev, struct device_attribute *attr,
1205 "delete_device"); 1197 "delete_device");
1206 return res; 1198 return res;
1207} 1199}
1208
1209static DEVICE_ATTR(new_device, S_IWUSR, NULL, i2c_sysfs_new_device);
1210static DEVICE_ATTR_IGNORE_LOCKDEP(delete_device, S_IWUSR, NULL, 1200static DEVICE_ATTR_IGNORE_LOCKDEP(delete_device, S_IWUSR, NULL,
1211 i2c_sysfs_delete_device); 1201 i2c_sysfs_delete_device);
1212 1202
@@ -1216,18 +1206,10 @@ static struct attribute *i2c_adapter_attrs[] = {
1216 &dev_attr_delete_device.attr, 1206 &dev_attr_delete_device.attr,
1217 NULL 1207 NULL
1218}; 1208};
1219 1209ATTRIBUTE_GROUPS(i2c_adapter);
1220static struct attribute_group i2c_adapter_attr_group = {
1221 .attrs = i2c_adapter_attrs,
1222};
1223
1224static const struct attribute_group *i2c_adapter_attr_groups[] = {
1225 &i2c_adapter_attr_group,
1226 NULL
1227};
1228 1210
1229struct device_type i2c_adapter_type = { 1211struct device_type i2c_adapter_type = {
1230 .groups = i2c_adapter_attr_groups, 1212 .groups = i2c_adapter_groups,
1231 .release = i2c_adapter_dev_release, 1213 .release = i2c_adapter_dev_release,
1232}; 1214};
1233EXPORT_SYMBOL_GPL(i2c_adapter_type); 1215EXPORT_SYMBOL_GPL(i2c_adapter_type);