aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-06 20:03:42 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-06 21:42:15 -0500
commit0324e74534241f3f00910ec04ef67de1fe1542f4 (patch)
tree88f0b2a40a47dc0a22c0ce5e9b75a58470a56204 /drivers/pcmcia
parent1071ec7bc2dabd0a9d12a1ae5570f4fd3ba944ca (diff)
parent0cae60f91494e34a0c5391f1455f825d5849b05f (diff)
Merge tag 'driver-core-3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core / sysfs patches from Greg KH: "Here's the big driver core / sysfs update for 3.13-rc1. There's lots of dev_groups updates for different subsystems, as they all get slowly migrated over to the safe versions of the attribute groups (removing userspace races with the creation of the sysfs files.) Also in here are some kobject updates, devres expansions, and the first round of Tejun's sysfs reworking to enable it to be used by other subsystems as a backend for an in-kernel filesystem. All of these have been in linux-next for a while with no reported issues" * tag 'driver-core-3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (83 commits) sysfs: rename sysfs_assoc_lock and explain what it's about sysfs: use generic_file_llseek() for sysfs_file_operations sysfs: return correct error code on unimplemented mmap() mdio_bus: convert bus code to use dev_groups device: Make dev_WARN/dev_WARN_ONCE print device as well as driver name sysfs: separate out dup filename warning into a separate function sysfs: move sysfs_hash_and_remove() to fs/sysfs/dir.c sysfs: remove unused sysfs_get_dentry() prototype sysfs: honor bin_attr.attr.ignore_lockdep sysfs: merge sysfs_elem_bin_attr into sysfs_elem_attr devres: restore zeroing behavior of devres_alloc() sysfs: fix sysfs_write_file for bin file input: gameport: convert bus code to use dev_groups input: serio: remove bus usage of dev_attrs input: serio: use DEVICE_ATTR_RO() i2o: convert bus code to use dev_groups memstick: convert bus code to use dev_groups tifm: convert bus code to use dev_groups virtio: convert bus code to use dev_groups ipack: convert bus code to use dev_groups ...
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/at91_cf.c11
-rw-r--r--drivers/pcmcia/ds.c65
2 files changed, 44 insertions, 32 deletions
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c
index b8f5acf02261..de24232c5191 100644
--- a/drivers/pcmcia/at91_cf.c
+++ b/drivers/pcmcia/at91_cf.c
@@ -245,7 +245,7 @@ static int at91_cf_dt_init(struct platform_device *pdev)
245} 245}
246#endif 246#endif
247 247
248static int __init at91_cf_probe(struct platform_device *pdev) 248static int at91_cf_probe(struct platform_device *pdev)
249{ 249{
250 struct at91_cf_socket *cf; 250 struct at91_cf_socket *cf;
251 struct at91_cf_data *board = pdev->dev.platform_data; 251 struct at91_cf_data *board = pdev->dev.platform_data;
@@ -354,7 +354,7 @@ fail0a:
354 return status; 354 return status;
355} 355}
356 356
357static int __exit at91_cf_remove(struct platform_device *pdev) 357static int at91_cf_remove(struct platform_device *pdev)
358{ 358{
359 struct at91_cf_socket *cf = platform_get_drvdata(pdev); 359 struct at91_cf_socket *cf = platform_get_drvdata(pdev);
360 360
@@ -404,14 +404,13 @@ static struct platform_driver at91_cf_driver = {
404 .owner = THIS_MODULE, 404 .owner = THIS_MODULE,
405 .of_match_table = of_match_ptr(at91_cf_dt_ids), 405 .of_match_table = of_match_ptr(at91_cf_dt_ids),
406 }, 406 },
407 .remove = __exit_p(at91_cf_remove), 407 .probe = at91_cf_probe,
408 .remove = at91_cf_remove,
408 .suspend = at91_cf_suspend, 409 .suspend = at91_cf_suspend,
409 .resume = at91_cf_resume, 410 .resume = at91_cf_resume,
410}; 411};
411 412
412/*--------------------------------------------------------------------------*/ 413module_platform_driver(at91_cf_driver);
413
414module_platform_driver_probe(at91_cf_driver, at91_cf_probe);
415 414
416MODULE_DESCRIPTION("AT91 Compact Flash Driver"); 415MODULE_DESCRIPTION("AT91 Compact Flash Driver");
417MODULE_AUTHOR("David Brownell"); 416MODULE_AUTHOR("David Brownell");
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 2deacbb2ffdc..757119b87146 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -992,16 +992,17 @@ static ssize_t field##_show (struct device *dev, struct device_attribute *attr,
992{ \ 992{ \
993 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); \ 993 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); \
994 return p_dev->test ? sprintf(buf, format, p_dev->field) : -ENODEV; \ 994 return p_dev->test ? sprintf(buf, format, p_dev->field) : -ENODEV; \
995} 995} \
996static DEVICE_ATTR_RO(field);
996 997
997#define pcmcia_device_stringattr(name, field) \ 998#define pcmcia_device_stringattr(name, field) \
998static ssize_t name##_show (struct device *dev, struct device_attribute *attr, char *buf) \ 999static ssize_t name##_show (struct device *dev, struct device_attribute *attr, char *buf) \
999{ \ 1000{ \
1000 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); \ 1001 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); \
1001 return p_dev->field ? sprintf(buf, "%s\n", p_dev->field) : -ENODEV; \ 1002 return p_dev->field ? sprintf(buf, "%s\n", p_dev->field) : -ENODEV; \
1002} 1003} \
1004static DEVICE_ATTR_RO(name);
1003 1005
1004pcmcia_device_attr(func, socket, "0x%02x\n");
1005pcmcia_device_attr(func_id, has_func_id, "0x%02x\n"); 1006pcmcia_device_attr(func_id, has_func_id, "0x%02x\n");
1006pcmcia_device_attr(manf_id, has_manf_id, "0x%04x\n"); 1007pcmcia_device_attr(manf_id, has_manf_id, "0x%04x\n");
1007pcmcia_device_attr(card_id, has_card_id, "0x%04x\n"); 1008pcmcia_device_attr(card_id, has_card_id, "0x%04x\n");
@@ -1010,8 +1011,16 @@ pcmcia_device_stringattr(prod_id2, prod_id[1]);
1010pcmcia_device_stringattr(prod_id3, prod_id[2]); 1011pcmcia_device_stringattr(prod_id3, prod_id[2]);
1011pcmcia_device_stringattr(prod_id4, prod_id[3]); 1012pcmcia_device_stringattr(prod_id4, prod_id[3]);
1012 1013
1013static ssize_t pcmcia_show_resources(struct device *dev, 1014static ssize_t function_show(struct device *dev, struct device_attribute *attr,
1014 struct device_attribute *attr, char *buf) 1015 char *buf)
1016{
1017 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
1018 return p_dev->socket ? sprintf(buf, "0x%02x\n", p_dev->func) : -ENODEV;
1019}
1020static DEVICE_ATTR_RO(function);
1021
1022static ssize_t resources_show(struct device *dev,
1023 struct device_attribute *attr, char *buf)
1015{ 1024{
1016 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 1025 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
1017 char *str = buf; 1026 char *str = buf;
@@ -1022,8 +1031,9 @@ static ssize_t pcmcia_show_resources(struct device *dev,
1022 1031
1023 return str - buf; 1032 return str - buf;
1024} 1033}
1034static DEVICE_ATTR_RO(resources);
1025 1035
1026static ssize_t pcmcia_show_pm_state(struct device *dev, struct device_attribute *attr, char *buf) 1036static ssize_t pm_state_show(struct device *dev, struct device_attribute *attr, char *buf)
1027{ 1037{
1028 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 1038 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
1029 1039
@@ -1033,8 +1043,8 @@ static ssize_t pcmcia_show_pm_state(struct device *dev, struct device_attribute
1033 return sprintf(buf, "on\n"); 1043 return sprintf(buf, "on\n");
1034} 1044}
1035 1045
1036static ssize_t pcmcia_store_pm_state(struct device *dev, struct device_attribute *attr, 1046static ssize_t pm_state_store(struct device *dev, struct device_attribute *attr,
1037 const char *buf, size_t count) 1047 const char *buf, size_t count)
1038{ 1048{
1039 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 1049 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
1040 int ret = 0; 1050 int ret = 0;
@@ -1049,7 +1059,7 @@ static ssize_t pcmcia_store_pm_state(struct device *dev, struct device_attribute
1049 1059
1050 return ret ? ret : count; 1060 return ret ? ret : count;
1051} 1061}
1052 1062static DEVICE_ATTR_RW(pm_state);
1053 1063
1054static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf) 1064static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf)
1055{ 1065{
@@ -1072,8 +1082,9 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
1072 p_dev->func, p_dev->device_no, 1082 p_dev->func, p_dev->device_no,
1073 hash[0], hash[1], hash[2], hash[3]); 1083 hash[0], hash[1], hash[2], hash[3]);
1074} 1084}
1085static DEVICE_ATTR_RO(modalias);
1075 1086
1076static ssize_t pcmcia_store_allow_func_id_match(struct device *dev, 1087static ssize_t allow_func_id_match_store(struct device *dev,
1077 struct device_attribute *attr, const char *buf, size_t count) 1088 struct device_attribute *attr, const char *buf, size_t count)
1078{ 1089{
1079 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 1090 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
@@ -1088,22 +1099,24 @@ static ssize_t pcmcia_store_allow_func_id_match(struct device *dev,
1088 1099
1089 return count; 1100 return count;
1090} 1101}
1091 1102static DEVICE_ATTR_WO(allow_func_id_match);
1092static struct device_attribute pcmcia_dev_attrs[] = { 1103
1093 __ATTR(function, 0444, func_show, NULL), 1104static struct attribute *pcmcia_dev_attrs[] = {
1094 __ATTR(pm_state, 0644, pcmcia_show_pm_state, pcmcia_store_pm_state), 1105 &dev_attr_resources.attr,
1095 __ATTR(resources, 0444, pcmcia_show_resources, NULL), 1106 &dev_attr_pm_state.attr,
1096 __ATTR_RO(func_id), 1107 &dev_attr_function.attr,
1097 __ATTR_RO(manf_id), 1108 &dev_attr_func_id.attr,
1098 __ATTR_RO(card_id), 1109 &dev_attr_manf_id.attr,
1099 __ATTR_RO(prod_id1), 1110 &dev_attr_card_id.attr,
1100 __ATTR_RO(prod_id2), 1111 &dev_attr_prod_id1.attr,
1101 __ATTR_RO(prod_id3), 1112 &dev_attr_prod_id2.attr,
1102 __ATTR_RO(prod_id4), 1113 &dev_attr_prod_id3.attr,
1103 __ATTR_RO(modalias), 1114 &dev_attr_prod_id4.attr,
1104 __ATTR(allow_func_id_match, 0200, NULL, pcmcia_store_allow_func_id_match), 1115 &dev_attr_modalias.attr,
1105 __ATTR_NULL, 1116 &dev_attr_allow_func_id_match.attr,
1117 NULL,
1106}; 1118};
1119ATTRIBUTE_GROUPS(pcmcia_dev);
1107 1120
1108/* PM support, also needed for reset */ 1121/* PM support, also needed for reset */
1109 1122
@@ -1389,7 +1402,7 @@ struct bus_type pcmcia_bus_type = {
1389 .name = "pcmcia", 1402 .name = "pcmcia",
1390 .uevent = pcmcia_bus_uevent, 1403 .uevent = pcmcia_bus_uevent,
1391 .match = pcmcia_bus_match, 1404 .match = pcmcia_bus_match,
1392 .dev_attrs = pcmcia_dev_attrs, 1405 .dev_groups = pcmcia_dev_groups,
1393 .probe = pcmcia_device_probe, 1406 .probe = pcmcia_device_probe,
1394 .remove = pcmcia_device_remove, 1407 .remove = pcmcia_device_remove,
1395 .suspend = pcmcia_dev_suspend, 1408 .suspend = pcmcia_dev_suspend,