diff options
Diffstat (limited to 'drivers/pcmcia/rsrc_nonstatic.c')
-rw-r--r-- | drivers/pcmcia/rsrc_nonstatic.c | 56 |
1 files changed, 31 insertions, 25 deletions
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c index c3176b16b7b..bfcaad6021c 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c | |||
@@ -616,7 +616,7 @@ static int nonstatic_adjust_io_region(struct resource *res, unsigned long r_star | |||
616 | static struct resource *nonstatic_find_io_region(unsigned long base, int num, | 616 | static struct resource *nonstatic_find_io_region(unsigned long base, int num, |
617 | unsigned long align, struct pcmcia_socket *s) | 617 | unsigned long align, struct pcmcia_socket *s) |
618 | { | 618 | { |
619 | struct resource *res = make_resource(0, num, IORESOURCE_IO, s->dev.class_id); | 619 | struct resource *res = make_resource(0, num, IORESOURCE_IO, s->dev.bus_id); |
620 | struct socket_data *s_data = s->resource_data; | 620 | struct socket_data *s_data = s->resource_data; |
621 | struct pcmcia_align_data data; | 621 | struct pcmcia_align_data data; |
622 | unsigned long min = base; | 622 | unsigned long min = base; |
@@ -650,7 +650,7 @@ static struct resource *nonstatic_find_io_region(unsigned long base, int num, | |||
650 | static struct resource * nonstatic_find_mem_region(u_long base, u_long num, | 650 | static struct resource * nonstatic_find_mem_region(u_long base, u_long num, |
651 | u_long align, int low, struct pcmcia_socket *s) | 651 | u_long align, int low, struct pcmcia_socket *s) |
652 | { | 652 | { |
653 | struct resource *res = make_resource(0, num, IORESOURCE_MEM, s->dev.class_id); | 653 | struct resource *res = make_resource(0, num, IORESOURCE_MEM, s->dev.bus_id); |
654 | struct socket_data *s_data = s->resource_data; | 654 | struct socket_data *s_data = s->resource_data; |
655 | struct pcmcia_align_data data; | 655 | struct pcmcia_align_data data; |
656 | unsigned long min, max; | 656 | unsigned long min, max; |
@@ -897,9 +897,10 @@ EXPORT_SYMBOL(pccard_nonstatic_ops); | |||
897 | 897 | ||
898 | /* sysfs interface to the resource database */ | 898 | /* sysfs interface to the resource database */ |
899 | 899 | ||
900 | static ssize_t show_io_db(struct class_device *class_dev, char *buf) | 900 | static ssize_t show_io_db(struct device *dev, |
901 | struct device_attribute *attr, char *buf) | ||
901 | { | 902 | { |
902 | struct pcmcia_socket *s = class_get_devdata(class_dev); | 903 | struct pcmcia_socket *s = dev_get_drvdata(dev); |
903 | struct socket_data *data; | 904 | struct socket_data *data; |
904 | struct resource_map *p; | 905 | struct resource_map *p; |
905 | ssize_t ret = 0; | 906 | ssize_t ret = 0; |
@@ -920,9 +921,11 @@ static ssize_t show_io_db(struct class_device *class_dev, char *buf) | |||
920 | return (ret); | 921 | return (ret); |
921 | } | 922 | } |
922 | 923 | ||
923 | static ssize_t store_io_db(struct class_device *class_dev, const char *buf, size_t count) | 924 | static ssize_t store_io_db(struct device *dev, |
925 | struct device_attribute *attr, | ||
926 | const char *buf, size_t count) | ||
924 | { | 927 | { |
925 | struct pcmcia_socket *s = class_get_devdata(class_dev); | 928 | struct pcmcia_socket *s = dev_get_drvdata(dev); |
926 | unsigned long start_addr, end_addr; | 929 | unsigned long start_addr, end_addr; |
927 | unsigned int add = ADD_MANAGED_RESOURCE; | 930 | unsigned int add = ADD_MANAGED_RESOURCE; |
928 | ssize_t ret = 0; | 931 | ssize_t ret = 0; |
@@ -947,11 +950,12 @@ static ssize_t store_io_db(struct class_device *class_dev, const char *buf, size | |||
947 | 950 | ||
948 | return ret ? ret : count; | 951 | return ret ? ret : count; |
949 | } | 952 | } |
950 | static CLASS_DEVICE_ATTR(available_resources_io, 0600, show_io_db, store_io_db); | 953 | static DEVICE_ATTR(available_resources_io, 0600, show_io_db, store_io_db); |
951 | 954 | ||
952 | static ssize_t show_mem_db(struct class_device *class_dev, char *buf) | 955 | static ssize_t show_mem_db(struct device *dev, |
956 | struct device_attribute *attr, char *buf) | ||
953 | { | 957 | { |
954 | struct pcmcia_socket *s = class_get_devdata(class_dev); | 958 | struct pcmcia_socket *s = dev_get_drvdata(dev); |
955 | struct socket_data *data; | 959 | struct socket_data *data; |
956 | struct resource_map *p; | 960 | struct resource_map *p; |
957 | ssize_t ret = 0; | 961 | ssize_t ret = 0; |
@@ -972,9 +976,11 @@ static ssize_t show_mem_db(struct class_device *class_dev, char *buf) | |||
972 | return (ret); | 976 | return (ret); |
973 | } | 977 | } |
974 | 978 | ||
975 | static ssize_t store_mem_db(struct class_device *class_dev, const char *buf, size_t count) | 979 | static ssize_t store_mem_db(struct device *dev, |
980 | struct device_attribute *attr, | ||
981 | const char *buf, size_t count) | ||
976 | { | 982 | { |
977 | struct pcmcia_socket *s = class_get_devdata(class_dev); | 983 | struct pcmcia_socket *s = dev_get_drvdata(dev); |
978 | unsigned long start_addr, end_addr; | 984 | unsigned long start_addr, end_addr; |
979 | unsigned int add = ADD_MANAGED_RESOURCE; | 985 | unsigned int add = ADD_MANAGED_RESOURCE; |
980 | ssize_t ret = 0; | 986 | ssize_t ret = 0; |
@@ -999,25 +1005,25 @@ static ssize_t store_mem_db(struct class_device *class_dev, const char *buf, siz | |||
999 | 1005 | ||
1000 | return ret ? ret : count; | 1006 | return ret ? ret : count; |
1001 | } | 1007 | } |
1002 | static CLASS_DEVICE_ATTR(available_resources_mem, 0600, show_mem_db, store_mem_db); | 1008 | static DEVICE_ATTR(available_resources_mem, 0600, show_mem_db, store_mem_db); |
1003 | 1009 | ||
1004 | static struct class_device_attribute *pccard_rsrc_attributes[] = { | 1010 | static struct device_attribute *pccard_rsrc_attributes[] = { |
1005 | &class_device_attr_available_resources_io, | 1011 | &dev_attr_available_resources_io, |
1006 | &class_device_attr_available_resources_mem, | 1012 | &dev_attr_available_resources_mem, |
1007 | NULL, | 1013 | NULL, |
1008 | }; | 1014 | }; |
1009 | 1015 | ||
1010 | static int __devinit pccard_sysfs_add_rsrc(struct class_device *class_dev, | 1016 | static int __devinit pccard_sysfs_add_rsrc(struct device *dev, |
1011 | struct class_interface *class_intf) | 1017 | struct class_interface *class_intf) |
1012 | { | 1018 | { |
1013 | struct pcmcia_socket *s = class_get_devdata(class_dev); | 1019 | struct pcmcia_socket *s = dev_get_drvdata(dev); |
1014 | struct class_device_attribute **attr; | 1020 | struct device_attribute **attr; |
1015 | int ret = 0; | 1021 | int ret = 0; |
1016 | if (s->resource_ops != &pccard_nonstatic_ops) | 1022 | if (s->resource_ops != &pccard_nonstatic_ops) |
1017 | return 0; | 1023 | return 0; |
1018 | 1024 | ||
1019 | for (attr = pccard_rsrc_attributes; *attr; attr++) { | 1025 | for (attr = pccard_rsrc_attributes; *attr; attr++) { |
1020 | ret = class_device_create_file(class_dev, *attr); | 1026 | ret = device_create_file(dev, *attr); |
1021 | if (ret) | 1027 | if (ret) |
1022 | break; | 1028 | break; |
1023 | } | 1029 | } |
@@ -1025,23 +1031,23 @@ static int __devinit pccard_sysfs_add_rsrc(struct class_device *class_dev, | |||
1025 | return ret; | 1031 | return ret; |
1026 | } | 1032 | } |
1027 | 1033 | ||
1028 | static void __devexit pccard_sysfs_remove_rsrc(struct class_device *class_dev, | 1034 | static void __devexit pccard_sysfs_remove_rsrc(struct device *dev, |
1029 | struct class_interface *class_intf) | 1035 | struct class_interface *class_intf) |
1030 | { | 1036 | { |
1031 | struct pcmcia_socket *s = class_get_devdata(class_dev); | 1037 | struct pcmcia_socket *s = dev_get_drvdata(dev); |
1032 | struct class_device_attribute **attr; | 1038 | struct device_attribute **attr; |
1033 | 1039 | ||
1034 | if (s->resource_ops != &pccard_nonstatic_ops) | 1040 | if (s->resource_ops != &pccard_nonstatic_ops) |
1035 | return; | 1041 | return; |
1036 | 1042 | ||
1037 | for (attr = pccard_rsrc_attributes; *attr; attr++) | 1043 | for (attr = pccard_rsrc_attributes; *attr; attr++) |
1038 | class_device_remove_file(class_dev, *attr); | 1044 | device_remove_file(dev, *attr); |
1039 | } | 1045 | } |
1040 | 1046 | ||
1041 | static struct class_interface pccard_rsrc_interface = { | 1047 | static struct class_interface pccard_rsrc_interface = { |
1042 | .class = &pcmcia_socket_class, | 1048 | .class = &pcmcia_socket_class, |
1043 | .add = &pccard_sysfs_add_rsrc, | 1049 | .add_dev = &pccard_sysfs_add_rsrc, |
1044 | .remove = __devexit_p(&pccard_sysfs_remove_rsrc), | 1050 | .remove_dev = __devexit_p(&pccard_sysfs_remove_rsrc), |
1045 | }; | 1051 | }; |
1046 | 1052 | ||
1047 | static int __init nonstatic_sysfs_init(void) | 1053 | static int __init nonstatic_sysfs_init(void) |