diff options
145 files changed, 1463 insertions, 793 deletions
diff --git a/Documentation/HOWTO b/Documentation/HOWTO index 8495fc970391..f5395af88a41 100644 --- a/Documentation/HOWTO +++ b/Documentation/HOWTO | |||
| @@ -221,8 +221,8 @@ branches. These different branches are: | |||
| 221 | - main 2.6.x kernel tree | 221 | - main 2.6.x kernel tree |
| 222 | - 2.6.x.y -stable kernel tree | 222 | - 2.6.x.y -stable kernel tree |
| 223 | - 2.6.x -git kernel patches | 223 | - 2.6.x -git kernel patches |
| 224 | - 2.6.x -mm kernel patches | ||
| 225 | - subsystem specific kernel trees and patches | 224 | - subsystem specific kernel trees and patches |
| 225 | - the 2.6.x -next kernel tree for integration tests | ||
| 226 | 226 | ||
| 227 | 2.6.x kernel tree | 227 | 2.6.x kernel tree |
| 228 | ----------------- | 228 | ----------------- |
| @@ -232,7 +232,7 @@ process is as follows: | |||
| 232 | - As soon as a new kernel is released a two weeks window is open, | 232 | - As soon as a new kernel is released a two weeks window is open, |
| 233 | during this period of time maintainers can submit big diffs to | 233 | during this period of time maintainers can submit big diffs to |
| 234 | Linus, usually the patches that have already been included in the | 234 | Linus, usually the patches that have already been included in the |
| 235 | -mm kernel for a few weeks. The preferred way to submit big changes | 235 | -next kernel for a few weeks. The preferred way to submit big changes |
| 236 | is using git (the kernel's source management tool, more information | 236 | is using git (the kernel's source management tool, more information |
| 237 | can be found at http://git.or.cz/) but plain patches are also just | 237 | can be found at http://git.or.cz/) but plain patches are also just |
| 238 | fine. | 238 | fine. |
| @@ -293,84 +293,43 @@ daily and represent the current state of Linus' tree. They are more | |||
| 293 | experimental than -rc kernels since they are generated automatically | 293 | experimental than -rc kernels since they are generated automatically |
| 294 | without even a cursory glance to see if they are sane. | 294 | without even a cursory glance to see if they are sane. |
| 295 | 295 | ||
| 296 | 2.6.x -mm kernel patches | ||
| 297 | ------------------------ | ||
| 298 | These are experimental kernel patches released by Andrew Morton. Andrew | ||
| 299 | takes all of the different subsystem kernel trees and patches and mushes | ||
| 300 | them together, along with a lot of patches that have been plucked from | ||
| 301 | the linux-kernel mailing list. This tree serves as a proving ground for | ||
| 302 | new features and patches. Once a patch has proved its worth in -mm for | ||
| 303 | a while Andrew or the subsystem maintainer pushes it on to Linus for | ||
| 304 | inclusion in mainline. | ||
| 305 | |||
| 306 | It is heavily encouraged that all new patches get tested in the -mm tree | ||
| 307 | before they are sent to Linus for inclusion in the main kernel tree. Code | ||
| 308 | which does not make an appearance in -mm before the opening of the merge | ||
| 309 | window will prove hard to merge into the mainline. | ||
| 310 | |||
| 311 | These kernels are not appropriate for use on systems that are supposed | ||
| 312 | to be stable and they are more risky to run than any of the other | ||
| 313 | branches. | ||
| 314 | |||
| 315 | If you wish to help out with the kernel development process, please test | ||
| 316 | and use these kernel releases and provide feedback to the linux-kernel | ||
| 317 | mailing list if you have any problems, and if everything works properly. | ||
| 318 | |||
| 319 | In addition to all the other experimental patches, these kernels usually | ||
| 320 | also contain any changes in the mainline -git kernels available at the | ||
| 321 | time of release. | ||
| 322 | |||
| 323 | The -mm kernels are not released on a fixed schedule, but usually a few | ||
| 324 | -mm kernels are released in between each -rc kernel (1 to 3 is common). | ||
| 325 | |||
| 326 | Subsystem Specific kernel trees and patches | 296 | Subsystem Specific kernel trees and patches |
| 327 | ------------------------------------------- | 297 | ------------------------------------------- |
| 328 | A number of the different kernel subsystem developers expose their | 298 | The maintainers of the various kernel subsystems --- and also many |
| 329 | development trees so that others can see what is happening in the | 299 | kernel subsystem developers --- expose their current state of |
| 330 | different areas of the kernel. These trees are pulled into the -mm | 300 | development in source repositories. That way, others can see what is |
| 331 | kernel releases as described above. | 301 | happening in the different areas of the kernel. In areas where |
| 332 | 302 | development is rapid, a developer may be asked to base his submissions | |
| 333 | Here is a list of some of the different kernel trees available: | 303 | onto such a subsystem kernel tree so that conflicts between the |
| 334 | git trees: | 304 | submission and other already ongoing work are avoided. |
| 335 | - Kbuild development tree, Sam Ravnborg <sam@ravnborg.org> | 305 | |
| 336 | git.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git | 306 | Most of these repositories are git trees, but there are also other SCMs |
| 337 | 307 | in use, or patch queues being published as quilt series. Addresses of | |
| 338 | - ACPI development tree, Len Brown <len.brown@intel.com> | 308 | these subsystem repositories are listed in the MAINTAINERS file. Many |
| 339 | git.kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git | 309 | of them can be browsed at http://git.kernel.org/. |
| 340 | 310 | ||
| 341 | - Block development tree, Jens Axboe <jens.axboe@oracle.com> | 311 | Before a proposed patch is committed to such a subsystem tree, it is |
| 342 | git.kernel.org:/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git | 312 | subject to review which primarily happens on mailing lists (see the |
| 343 | 313 | respective section below). For several kernel subsystems, this review | |
| 344 | - DRM development tree, Dave Airlie <airlied@linux.ie> | 314 | process is tracked with the tool patchwork. Patchwork offers a web |
| 345 | git.kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git | 315 | interface which shows patch postings, any comments on a patch or |
| 346 | 316 | revisions to it, and maintainers can mark patches as under review, | |
| 347 | - ia64 development tree, Tony Luck <tony.luck@intel.com> | 317 | accepted, or rejected. Most of these patchwork sites are listed at |
| 348 | git.kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git | 318 | http://patchwork.kernel.org/ or http://patchwork.ozlabs.org/. |
| 349 | 319 | ||
| 350 | - infiniband, Roland Dreier <rolandd@cisco.com> | 320 | 2.6.x -next kernel tree for integration tests |
| 351 | git.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git | 321 | --------------------------------------------- |
| 352 | 322 | Before updates from subsystem trees are merged into the mainline 2.6.x | |
| 353 | - libata, Jeff Garzik <jgarzik@pobox.com> | 323 | tree, they need to be integration-tested. For this purpose, a special |
| 354 | git.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git | 324 | testing repository exists into which virtually all subsystem trees are |
| 355 | 325 | pulled on an almost daily basis: | |
| 356 | - network drivers, Jeff Garzik <jgarzik@pobox.com> | 326 | http://git.kernel.org/?p=linux/kernel/git/sfr/linux-next.git |
| 357 | git.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git | 327 | http://linux.f-seidel.de/linux-next/pmwiki/ |
| 358 | 328 | ||
| 359 | - pcmcia, Dominik Brodowski <linux@dominikbrodowski.net> | 329 | This way, the -next kernel gives a summary outlook onto what will be |
| 360 | git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git | 330 | expected to go into the mainline kernel at the next merge period. |
| 361 | 331 | Adventurous testers are very welcome to runtime-test the -next kernel. | |
| 362 | - SCSI, James Bottomley <James.Bottomley@hansenpartnership.com> | ||
| 363 | git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git | ||
| 364 | |||
| 365 | - x86, Ingo Molnar <mingo@elte.hu> | ||
| 366 | git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git | ||
| 367 | |||
| 368 | quilt trees: | ||
| 369 | - USB, Driver Core, and I2C, Greg Kroah-Hartman <gregkh@suse.de> | ||
| 370 | kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/ | ||
| 371 | 332 | ||
| 372 | Other kernel trees can be found listed at http://git.kernel.org/ and in | ||
| 373 | the MAINTAINERS file. | ||
| 374 | 333 | ||
| 375 | Bug Reporting | 334 | Bug Reporting |
| 376 | ------------- | 335 | ------------- |
diff --git a/Documentation/kobject.txt b/Documentation/kobject.txt index c79ab996dada..bdb13817e1e9 100644 --- a/Documentation/kobject.txt +++ b/Documentation/kobject.txt | |||
| @@ -266,7 +266,7 @@ kobj_type: | |||
| 266 | 266 | ||
| 267 | struct kobj_type { | 267 | struct kobj_type { |
| 268 | void (*release)(struct kobject *); | 268 | void (*release)(struct kobject *); |
| 269 | struct sysfs_ops *sysfs_ops; | 269 | const struct sysfs_ops *sysfs_ops; |
| 270 | struct attribute **default_attrs; | 270 | struct attribute **default_attrs; |
| 271 | }; | 271 | }; |
| 272 | 272 | ||
diff --git a/arch/arm/mach-pxa/corgi_ssp.c b/arch/arm/mach-pxa/corgi_ssp.c index a5ee70735e04..1d9bc118ee32 100644 --- a/arch/arm/mach-pxa/corgi_ssp.c +++ b/arch/arm/mach-pxa/corgi_ssp.c | |||
| @@ -204,7 +204,7 @@ void __init corgi_ssp_set_machinfo(struct corgissp_machinfo *machinfo) | |||
| 204 | ssp_machinfo = machinfo; | 204 | ssp_machinfo = machinfo; |
| 205 | } | 205 | } |
| 206 | 206 | ||
| 207 | static int __init corgi_ssp_probe(struct platform_device *dev) | 207 | static int __devinit corgi_ssp_probe(struct platform_device *dev) |
| 208 | { | 208 | { |
| 209 | int ret; | 209 | int ret; |
| 210 | 210 | ||
diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c index 67229a1ef55c..463d874bb867 100644 --- a/arch/arm/mach-pxa/sharpsl_pm.c +++ b/arch/arm/mach-pxa/sharpsl_pm.c | |||
| @@ -900,7 +900,7 @@ static struct platform_suspend_ops sharpsl_pm_ops = { | |||
| 900 | }; | 900 | }; |
| 901 | #endif | 901 | #endif |
| 902 | 902 | ||
| 903 | static int __init sharpsl_pm_probe(struct platform_device *pdev) | 903 | static int __devinit sharpsl_pm_probe(struct platform_device *pdev) |
| 904 | { | 904 | { |
| 905 | int ret; | 905 | int ret; |
| 906 | 906 | ||
diff --git a/arch/arm/mach-s3c2410/h1940-bluetooth.c b/arch/arm/mach-s3c2410/h1940-bluetooth.c index b7d1f8d27bc2..a3f3c7b1ca38 100644 --- a/arch/arm/mach-s3c2410/h1940-bluetooth.c +++ b/arch/arm/mach-s3c2410/h1940-bluetooth.c | |||
| @@ -56,7 +56,7 @@ static const struct rfkill_ops h1940bt_rfkill_ops = { | |||
| 56 | .set_block = h1940bt_set_block, | 56 | .set_block = h1940bt_set_block, |
| 57 | }; | 57 | }; |
| 58 | 58 | ||
| 59 | static int __init h1940bt_probe(struct platform_device *pdev) | 59 | static int __devinit h1940bt_probe(struct platform_device *pdev) |
| 60 | { | 60 | { |
| 61 | struct rfkill *rfk; | 61 | struct rfkill *rfk; |
| 62 | int ret = 0; | 62 | int ret = 0; |
diff --git a/arch/arm/mach-sa1100/jornada720_ssp.c b/arch/arm/mach-sa1100/jornada720_ssp.c index 506a5e5a9ad5..9b6dee5d16db 100644 --- a/arch/arm/mach-sa1100/jornada720_ssp.c +++ b/arch/arm/mach-sa1100/jornada720_ssp.c | |||
| @@ -130,7 +130,7 @@ void jornada_ssp_end(void) | |||
| 130 | }; | 130 | }; |
| 131 | EXPORT_SYMBOL(jornada_ssp_end); | 131 | EXPORT_SYMBOL(jornada_ssp_end); |
| 132 | 132 | ||
| 133 | static int __init jornada_ssp_probe(struct platform_device *dev) | 133 | static int __devinit jornada_ssp_probe(struct platform_device *dev) |
| 134 | { | 134 | { |
| 135 | int ret; | 135 | int ret; |
| 136 | 136 | ||
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c index 8f060352e129..b3a5818088d9 100644 --- a/arch/ia64/kernel/topology.c +++ b/arch/ia64/kernel/topology.c | |||
| @@ -282,7 +282,7 @@ static ssize_t cache_show(struct kobject * kobj, struct attribute * attr, char * | |||
| 282 | return ret; | 282 | return ret; |
| 283 | } | 283 | } |
| 284 | 284 | ||
| 285 | static struct sysfs_ops cache_sysfs_ops = { | 285 | static const struct sysfs_ops cache_sysfs_ops = { |
| 286 | .show = cache_show | 286 | .show = cache_show |
| 287 | }; | 287 | }; |
| 288 | 288 | ||
diff --git a/arch/mips/txx9/generic/7segled.c b/arch/mips/txx9/generic/7segled.c index 727ab21b6618..7f8416f86222 100644 --- a/arch/mips/txx9/generic/7segled.c +++ b/arch/mips/txx9/generic/7segled.c | |||
| @@ -58,13 +58,16 @@ static ssize_t raw_store(struct sys_device *dev, | |||
| 58 | static SYSDEV_ATTR(ascii, 0200, NULL, ascii_store); | 58 | static SYSDEV_ATTR(ascii, 0200, NULL, ascii_store); |
| 59 | static SYSDEV_ATTR(raw, 0200, NULL, raw_store); | 59 | static SYSDEV_ATTR(raw, 0200, NULL, raw_store); |
| 60 | 60 | ||
| 61 | static ssize_t map_seg7_show(struct sysdev_class *class, char *buf) | 61 | static ssize_t map_seg7_show(struct sysdev_class *class, |
| 62 | struct sysdev_class_attribute *attr, | ||
| 63 | char *buf) | ||
| 62 | { | 64 | { |
| 63 | memcpy(buf, &txx9_seg7map, sizeof(txx9_seg7map)); | 65 | memcpy(buf, &txx9_seg7map, sizeof(txx9_seg7map)); |
| 64 | return sizeof(txx9_seg7map); | 66 | return sizeof(txx9_seg7map); |
| 65 | } | 67 | } |
| 66 | 68 | ||
| 67 | static ssize_t map_seg7_store(struct sysdev_class *class, | 69 | static ssize_t map_seg7_store(struct sysdev_class *class, |
| 70 | struct sysdev_class_attribute *attr, | ||
| 68 | const char *buf, size_t size) | 71 | const char *buf, size_t size) |
| 69 | { | 72 | { |
| 70 | if (size != sizeof(txx9_seg7map)) | 73 | if (size != sizeof(txx9_seg7map)) |
diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c index bb37b1d19a58..01fe9ce28379 100644 --- a/arch/powerpc/kernel/cacheinfo.c +++ b/arch/powerpc/kernel/cacheinfo.c | |||
| @@ -642,7 +642,7 @@ static struct kobj_attribute *cache_index_opt_attrs[] = { | |||
| 642 | &cache_assoc_attr, | 642 | &cache_assoc_attr, |
| 643 | }; | 643 | }; |
| 644 | 644 | ||
| 645 | static struct sysfs_ops cache_index_ops = { | 645 | static const struct sysfs_ops cache_index_ops = { |
| 646 | .show = cache_index_show, | 646 | .show = cache_index_show, |
| 647 | }; | 647 | }; |
| 648 | 648 | ||
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index 8b10127c00ad..29f65bce55e1 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c | |||
| @@ -1020,7 +1020,9 @@ out: | |||
| 1020 | return rc; | 1020 | return rc; |
| 1021 | } | 1021 | } |
| 1022 | 1022 | ||
| 1023 | static ssize_t __ref rescan_store(struct sysdev_class *class, const char *buf, | 1023 | static ssize_t __ref rescan_store(struct sysdev_class *class, |
| 1024 | struct sysdev_class_attribute *attr, | ||
| 1025 | const char *buf, | ||
| 1024 | size_t count) | 1026 | size_t count) |
| 1025 | { | 1027 | { |
| 1026 | int rc; | 1028 | int rc; |
| @@ -1031,7 +1033,9 @@ static ssize_t __ref rescan_store(struct sysdev_class *class, const char *buf, | |||
| 1031 | static SYSDEV_CLASS_ATTR(rescan, 0200, NULL, rescan_store); | 1033 | static SYSDEV_CLASS_ATTR(rescan, 0200, NULL, rescan_store); |
| 1032 | #endif /* CONFIG_HOTPLUG_CPU */ | 1034 | #endif /* CONFIG_HOTPLUG_CPU */ |
| 1033 | 1035 | ||
| 1034 | static ssize_t dispatching_show(struct sysdev_class *class, char *buf) | 1036 | static ssize_t dispatching_show(struct sysdev_class *class, |
| 1037 | struct sysdev_class_attribute *attr, | ||
| 1038 | char *buf) | ||
| 1035 | { | 1039 | { |
| 1036 | ssize_t count; | 1040 | ssize_t count; |
| 1037 | 1041 | ||
| @@ -1041,7 +1045,9 @@ static ssize_t dispatching_show(struct sysdev_class *class, char *buf) | |||
| 1041 | return count; | 1045 | return count; |
| 1042 | } | 1046 | } |
| 1043 | 1047 | ||
| 1044 | static ssize_t dispatching_store(struct sysdev_class *dev, const char *buf, | 1048 | static ssize_t dispatching_store(struct sysdev_class *dev, |
| 1049 | struct sysdev_class_attribute *attr, | ||
| 1050 | const char *buf, | ||
| 1045 | size_t count) | 1051 | size_t count) |
| 1046 | { | 1052 | { |
| 1047 | int val, rc; | 1053 | int val, rc; |
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c index 8b22e7f316bb..aa2483e460f3 100644 --- a/arch/s390/kernel/time.c +++ b/arch/s390/kernel/time.c | |||
| @@ -1116,14 +1116,18 @@ static struct sys_device etr_port1_dev = { | |||
| 1116 | /* | 1116 | /* |
| 1117 | * ETR class attributes | 1117 | * ETR class attributes |
| 1118 | */ | 1118 | */ |
| 1119 | static ssize_t etr_stepping_port_show(struct sysdev_class *class, char *buf) | 1119 | static ssize_t etr_stepping_port_show(struct sysdev_class *class, |
| 1120 | struct sysdev_class_attribute *attr, | ||
| 1121 | char *buf) | ||
| 1120 | { | 1122 | { |
| 1121 | return sprintf(buf, "%i\n", etr_port0.esw.p); | 1123 | return sprintf(buf, "%i\n", etr_port0.esw.p); |
| 1122 | } | 1124 | } |
| 1123 | 1125 | ||
| 1124 | static SYSDEV_CLASS_ATTR(stepping_port, 0400, etr_stepping_port_show, NULL); | 1126 | static SYSDEV_CLASS_ATTR(stepping_port, 0400, etr_stepping_port_show, NULL); |
| 1125 | 1127 | ||
| 1126 | static ssize_t etr_stepping_mode_show(struct sysdev_class *class, char *buf) | 1128 | static ssize_t etr_stepping_mode_show(struct sysdev_class *class, |
| 1129 | struct sysdev_class_attribute *attr, | ||
| 1130 | char *buf) | ||
| 1127 | { | 1131 | { |
| 1128 | char *mode_str; | 1132 | char *mode_str; |
| 1129 | 1133 | ||
| @@ -1584,7 +1588,9 @@ static struct sysdev_class stp_sysclass = { | |||
| 1584 | .name = "stp", | 1588 | .name = "stp", |
| 1585 | }; | 1589 | }; |
| 1586 | 1590 | ||
| 1587 | static ssize_t stp_ctn_id_show(struct sysdev_class *class, char *buf) | 1591 | static ssize_t stp_ctn_id_show(struct sysdev_class *class, |
| 1592 | struct sysdev_class_attribute *attr, | ||
| 1593 | char *buf) | ||
| 1588 | { | 1594 | { |
| 1589 | if (!stp_online) | 1595 | if (!stp_online) |
| 1590 | return -ENODATA; | 1596 | return -ENODATA; |
| @@ -1594,7 +1600,9 @@ static ssize_t stp_ctn_id_show(struct sysdev_class *class, char *buf) | |||
| 1594 | 1600 | ||
| 1595 | static SYSDEV_CLASS_ATTR(ctn_id, 0400, stp_ctn_id_show, NULL); | 1601 | static SYSDEV_CLASS_ATTR(ctn_id, 0400, stp_ctn_id_show, NULL); |
| 1596 | 1602 | ||
| 1597 | static ssize_t stp_ctn_type_show(struct sysdev_class *class, char *buf) | 1603 | static ssize_t stp_ctn_type_show(struct sysdev_class *class, |
| 1604 | struct sysdev_class_attribute *attr, | ||
| 1605 | char *buf) | ||
| 1598 | { | 1606 | { |
| 1599 | if (!stp_online) | 1607 | if (!stp_online) |
| 1600 | return -ENODATA; | 1608 | return -ENODATA; |
| @@ -1603,7 +1611,9 @@ static ssize_t stp_ctn_type_show(struct sysdev_class *class, char *buf) | |||
| 1603 | 1611 | ||
| 1604 | static SYSDEV_CLASS_ATTR(ctn_type, 0400, stp_ctn_type_show, NULL); | 1612 | static SYSDEV_CLASS_ATTR(ctn_type, 0400, stp_ctn_type_show, NULL); |
| 1605 | 1613 | ||
| 1606 | static ssize_t stp_dst_offset_show(struct sysdev_class *class, char *buf) | 1614 | static ssize_t stp_dst_offset_show(struct sysdev_class *class, |
| 1615 | struct sysdev_class_attribute *attr, | ||
| 1616 | char *buf) | ||
| 1607 | { | 1617 | { |
| 1608 | if (!stp_online || !(stp_info.vbits & 0x2000)) | 1618 | if (!stp_online || !(stp_info.vbits & 0x2000)) |
| 1609 | return -ENODATA; | 1619 | return -ENODATA; |
| @@ -1612,7 +1622,9 @@ static ssize_t stp_dst_offset_show(struct sysdev_class *class, char *buf) | |||
| 1612 | 1622 | ||
| 1613 | static SYSDEV_CLASS_ATTR(dst_offset, 0400, stp_dst_offset_show, NULL); | 1623 | static SYSDEV_CLASS_ATTR(dst_offset, 0400, stp_dst_offset_show, NULL); |
| 1614 | 1624 | ||
| 1615 | static ssize_t stp_leap_seconds_show(struct sysdev_class *class, char *buf) | 1625 | static ssize_t stp_leap_seconds_show(struct sysdev_class *class, |
| 1626 | struct sysdev_class_attribute *attr, | ||
| 1627 | char *buf) | ||
| 1616 | { | 1628 | { |
| 1617 | if (!stp_online || !(stp_info.vbits & 0x8000)) | 1629 | if (!stp_online || !(stp_info.vbits & 0x8000)) |
| 1618 | return -ENODATA; | 1630 | return -ENODATA; |
| @@ -1621,7 +1633,9 @@ static ssize_t stp_leap_seconds_show(struct sysdev_class *class, char *buf) | |||
| 1621 | 1633 | ||
| 1622 | static SYSDEV_CLASS_ATTR(leap_seconds, 0400, stp_leap_seconds_show, NULL); | 1634 | static SYSDEV_CLASS_ATTR(leap_seconds, 0400, stp_leap_seconds_show, NULL); |
| 1623 | 1635 | ||
| 1624 | static ssize_t stp_stratum_show(struct sysdev_class *class, char *buf) | 1636 | static ssize_t stp_stratum_show(struct sysdev_class *class, |
| 1637 | struct sysdev_class_attribute *attr, | ||
| 1638 | char *buf) | ||
| 1625 | { | 1639 | { |
| 1626 | if (!stp_online) | 1640 | if (!stp_online) |
| 1627 | return -ENODATA; | 1641 | return -ENODATA; |
| @@ -1630,7 +1644,9 @@ static ssize_t stp_stratum_show(struct sysdev_class *class, char *buf) | |||
| 1630 | 1644 | ||
| 1631 | static SYSDEV_CLASS_ATTR(stratum, 0400, stp_stratum_show, NULL); | 1645 | static SYSDEV_CLASS_ATTR(stratum, 0400, stp_stratum_show, NULL); |
| 1632 | 1646 | ||
| 1633 | static ssize_t stp_time_offset_show(struct sysdev_class *class, char *buf) | 1647 | static ssize_t stp_time_offset_show(struct sysdev_class *class, |
| 1648 | struct sysdev_class_attribute *attr, | ||
| 1649 | char *buf) | ||
| 1634 | { | 1650 | { |
| 1635 | if (!stp_online || !(stp_info.vbits & 0x0800)) | 1651 | if (!stp_online || !(stp_info.vbits & 0x0800)) |
| 1636 | return -ENODATA; | 1652 | return -ENODATA; |
| @@ -1639,7 +1655,9 @@ static ssize_t stp_time_offset_show(struct sysdev_class *class, char *buf) | |||
| 1639 | 1655 | ||
| 1640 | static SYSDEV_CLASS_ATTR(time_offset, 0400, stp_time_offset_show, NULL); | 1656 | static SYSDEV_CLASS_ATTR(time_offset, 0400, stp_time_offset_show, NULL); |
| 1641 | 1657 | ||
| 1642 | static ssize_t stp_time_zone_offset_show(struct sysdev_class *class, char *buf) | 1658 | static ssize_t stp_time_zone_offset_show(struct sysdev_class *class, |
| 1659 | struct sysdev_class_attribute *attr, | ||
| 1660 | char *buf) | ||
| 1643 | { | 1661 | { |
| 1644 | if (!stp_online || !(stp_info.vbits & 0x4000)) | 1662 | if (!stp_online || !(stp_info.vbits & 0x4000)) |
| 1645 | return -ENODATA; | 1663 | return -ENODATA; |
| @@ -1649,7 +1667,9 @@ static ssize_t stp_time_zone_offset_show(struct sysdev_class *class, char *buf) | |||
| 1649 | static SYSDEV_CLASS_ATTR(time_zone_offset, 0400, | 1667 | static SYSDEV_CLASS_ATTR(time_zone_offset, 0400, |
| 1650 | stp_time_zone_offset_show, NULL); | 1668 | stp_time_zone_offset_show, NULL); |
| 1651 | 1669 | ||
| 1652 | static ssize_t stp_timing_mode_show(struct sysdev_class *class, char *buf) | 1670 | static ssize_t stp_timing_mode_show(struct sysdev_class *class, |
| 1671 | struct sysdev_class_attribute *attr, | ||
| 1672 | char *buf) | ||
| 1653 | { | 1673 | { |
| 1654 | if (!stp_online) | 1674 | if (!stp_online) |
| 1655 | return -ENODATA; | 1675 | return -ENODATA; |
| @@ -1658,7 +1678,9 @@ static ssize_t stp_timing_mode_show(struct sysdev_class *class, char *buf) | |||
| 1658 | 1678 | ||
| 1659 | static SYSDEV_CLASS_ATTR(timing_mode, 0400, stp_timing_mode_show, NULL); | 1679 | static SYSDEV_CLASS_ATTR(timing_mode, 0400, stp_timing_mode_show, NULL); |
| 1660 | 1680 | ||
| 1661 | static ssize_t stp_timing_state_show(struct sysdev_class *class, char *buf) | 1681 | static ssize_t stp_timing_state_show(struct sysdev_class *class, |
| 1682 | struct sysdev_class_attribute *attr, | ||
| 1683 | char *buf) | ||
| 1662 | { | 1684 | { |
| 1663 | if (!stp_online) | 1685 | if (!stp_online) |
| 1664 | return -ENODATA; | 1686 | return -ENODATA; |
| @@ -1667,12 +1689,15 @@ static ssize_t stp_timing_state_show(struct sysdev_class *class, char *buf) | |||
| 1667 | 1689 | ||
| 1668 | static SYSDEV_CLASS_ATTR(timing_state, 0400, stp_timing_state_show, NULL); | 1690 | static SYSDEV_CLASS_ATTR(timing_state, 0400, stp_timing_state_show, NULL); |
| 1669 | 1691 | ||
| 1670 | static ssize_t stp_online_show(struct sysdev_class *class, char *buf) | 1692 | static ssize_t stp_online_show(struct sysdev_class *class, |
| 1693 | struct sysdev_class_attribute *attr, | ||
| 1694 | char *buf) | ||
| 1671 | { | 1695 | { |
| 1672 | return sprintf(buf, "%i\n", stp_online); | 1696 | return sprintf(buf, "%i\n", stp_online); |
| 1673 | } | 1697 | } |
| 1674 | 1698 | ||
| 1675 | static ssize_t stp_online_store(struct sysdev_class *class, | 1699 | static ssize_t stp_online_store(struct sysdev_class *class, |
| 1700 | struct sysdev_class_attribute *attr, | ||
| 1676 | const char *buf, size_t count) | 1701 | const char *buf, size_t count) |
| 1677 | { | 1702 | { |
| 1678 | unsigned int value; | 1703 | unsigned int value; |
diff --git a/arch/sh/kernel/cpu/sh4/sq.c b/arch/sh/kernel/cpu/sh4/sq.c index fc065f9da6e5..14726eef1ce0 100644 --- a/arch/sh/kernel/cpu/sh4/sq.c +++ b/arch/sh/kernel/cpu/sh4/sq.c | |||
| @@ -326,7 +326,7 @@ static struct attribute *sq_sysfs_attrs[] = { | |||
| 326 | NULL, | 326 | NULL, |
| 327 | }; | 327 | }; |
| 328 | 328 | ||
| 329 | static struct sysfs_ops sq_sysfs_ops = { | 329 | static const struct sysfs_ops sq_sysfs_ops = { |
| 330 | .show = sq_sysfs_show, | 330 | .show = sq_sysfs_show, |
| 331 | .store = sq_sysfs_store, | 331 | .store = sq_sysfs_store, |
| 332 | }; | 332 | }; |
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c index eddb1bdd1b8f..b3eeb66c0a51 100644 --- a/arch/x86/kernel/cpu/intel_cacheinfo.c +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c | |||
| @@ -903,7 +903,7 @@ static ssize_t store(struct kobject *kobj, struct attribute *attr, | |||
| 903 | return ret; | 903 | return ret; |
| 904 | } | 904 | } |
| 905 | 905 | ||
| 906 | static struct sysfs_ops sysfs_ops = { | 906 | static const struct sysfs_ops sysfs_ops = { |
| 907 | .show = show, | 907 | .show = show, |
| 908 | .store = store, | 908 | .store = store, |
| 909 | }; | 909 | }; |
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index a8aacd4b513c..28cba46bf32c 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c | |||
| @@ -2044,6 +2044,7 @@ static __init void mce_init_banks(void) | |||
| 2044 | struct mce_bank *b = &mce_banks[i]; | 2044 | struct mce_bank *b = &mce_banks[i]; |
| 2045 | struct sysdev_attribute *a = &b->attr; | 2045 | struct sysdev_attribute *a = &b->attr; |
| 2046 | 2046 | ||
| 2047 | sysfs_attr_init(&a->attr); | ||
| 2047 | a->attr.name = b->attrname; | 2048 | a->attr.name = b->attrname; |
| 2048 | snprintf(b->attrname, ATTR_LEN, "bank%d", i); | 2049 | snprintf(b->attrname, ATTR_LEN, "bank%d", i); |
| 2049 | 2050 | ||
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c index 83a3d1f4efca..cda932ca3ade 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_amd.c +++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c | |||
| @@ -388,7 +388,7 @@ static ssize_t store(struct kobject *kobj, struct attribute *attr, | |||
| 388 | return ret; | 388 | return ret; |
| 389 | } | 389 | } |
| 390 | 390 | ||
| 391 | static struct sysfs_ops threshold_ops = { | 391 | static const struct sysfs_ops threshold_ops = { |
| 392 | .show = show, | 392 | .show = show, |
| 393 | .store = store, | 393 | .store = store, |
| 394 | }; | 394 | }; |
diff --git a/block/blk-integrity.c b/block/blk-integrity.c index 15c630813b1c..96e83c2bdb94 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c | |||
| @@ -278,7 +278,7 @@ static struct attribute *integrity_attrs[] = { | |||
| 278 | NULL, | 278 | NULL, |
| 279 | }; | 279 | }; |
| 280 | 280 | ||
| 281 | static struct sysfs_ops integrity_ops = { | 281 | static const struct sysfs_ops integrity_ops = { |
| 282 | .show = &integrity_attr_show, | 282 | .show = &integrity_attr_show, |
| 283 | .store = &integrity_attr_store, | 283 | .store = &integrity_attr_store, |
| 284 | }; | 284 | }; |
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index e85442415db3..2ae2cb3f362f 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c | |||
| @@ -450,7 +450,7 @@ static void blk_release_queue(struct kobject *kobj) | |||
| 450 | kmem_cache_free(blk_requestq_cachep, q); | 450 | kmem_cache_free(blk_requestq_cachep, q); |
| 451 | } | 451 | } |
| 452 | 452 | ||
| 453 | static struct sysfs_ops queue_sysfs_ops = { | 453 | static const struct sysfs_ops queue_sysfs_ops = { |
| 454 | .show = queue_attr_show, | 454 | .show = queue_attr_show, |
| 455 | .store = queue_attr_store, | 455 | .store = queue_attr_store, |
| 456 | }; | 456 | }; |
diff --git a/block/elevator.c b/block/elevator.c index ee3a883840f2..df75676f6671 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
| @@ -892,7 +892,7 @@ elv_attr_store(struct kobject *kobj, struct attribute *attr, | |||
| 892 | return error; | 892 | return error; |
| 893 | } | 893 | } |
| 894 | 894 | ||
| 895 | static struct sysfs_ops elv_sysfs_ops = { | 895 | static const struct sysfs_ops elv_sysfs_ops = { |
| 896 | .show = elv_attr_show, | 896 | .show = elv_attr_show, |
| 897 | .store = elv_attr_store, | 897 | .store = elv_attr_store, |
| 898 | }; | 898 | }; |
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index a206a12da78a..743f2445e2a1 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
| @@ -101,6 +101,7 @@ static void acpi_table_attr_init(struct acpi_table_attr *table_attr, | |||
| 101 | struct acpi_table_header *header = NULL; | 101 | struct acpi_table_header *header = NULL; |
| 102 | struct acpi_table_attr *attr = NULL; | 102 | struct acpi_table_attr *attr = NULL; |
| 103 | 103 | ||
| 104 | sysfs_attr_init(&table_attr->attr.attr); | ||
| 104 | if (table_header->signature[0] != '\0') | 105 | if (table_header->signature[0] != '\0') |
| 105 | memcpy(table_attr->name, table_header->signature, | 106 | memcpy(table_attr->name, table_header->signature, |
| 106 | ACPI_NAME_SIZE); | 107 | ACPI_NAME_SIZE); |
| @@ -475,6 +476,7 @@ void acpi_irq_stats_init(void) | |||
| 475 | goto fail; | 476 | goto fail; |
| 476 | strncpy(name, buffer, strlen(buffer) + 1); | 477 | strncpy(name, buffer, strlen(buffer) + 1); |
| 477 | 478 | ||
| 479 | sysfs_attr_init(&counter_attrs[i].attr); | ||
| 478 | counter_attrs[i].attr.name = name; | 480 | counter_attrs[i].attr.name = name; |
| 479 | counter_attrs[i].attr.mode = 0644; | 481 | counter_attrs[i].attr.mode = 0644; |
| 480 | counter_attrs[i].show = counter_show; | 482 | counter_attrs[i].show = counter_show; |
diff --git a/drivers/auxdisplay/cfag12864bfb.c b/drivers/auxdisplay/cfag12864bfb.c index fe3a865be4e5..b0ca5a47f47d 100644 --- a/drivers/auxdisplay/cfag12864bfb.c +++ b/drivers/auxdisplay/cfag12864bfb.c | |||
| @@ -81,7 +81,7 @@ static struct fb_ops cfag12864bfb_ops = { | |||
| 81 | .fb_mmap = cfag12864bfb_mmap, | 81 | .fb_mmap = cfag12864bfb_mmap, |
| 82 | }; | 82 | }; |
| 83 | 83 | ||
| 84 | static int __init cfag12864bfb_probe(struct platform_device *device) | 84 | static int __devinit cfag12864bfb_probe(struct platform_device *device) |
| 85 | { | 85 | { |
| 86 | int ret = -EINVAL; | 86 | int ret = -EINVAL; |
| 87 | struct fb_info *info = framebuffer_alloc(0, &device->dev); | 87 | struct fb_info *info = framebuffer_alloc(0, &device->dev); |
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index ee377270beb9..fd52c48ee762 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig | |||
| @@ -3,35 +3,50 @@ menu "Generic Driver Options" | |||
| 3 | config UEVENT_HELPER_PATH | 3 | config UEVENT_HELPER_PATH |
| 4 | string "path to uevent helper" | 4 | string "path to uevent helper" |
| 5 | depends on HOTPLUG | 5 | depends on HOTPLUG |
| 6 | default "/sbin/hotplug" | 6 | default "" |
| 7 | help | 7 | help |
| 8 | Path to uevent helper program forked by the kernel for | 8 | Path to uevent helper program forked by the kernel for |
| 9 | every uevent. | 9 | every uevent. |
| 10 | Before the switch to the netlink-based uevent source, this was | ||
| 11 | used to hook hotplug scripts into kernel device events. It | ||
| 12 | usually pointed to a shell script at /sbin/hotplug. | ||
| 13 | This should not be used today, because usual systems create | ||
| 14 | many events at bootup or device discovery in a very short time | ||
| 15 | frame. One forked process per event can create so many processes | ||
| 16 | that it creates a high system load, or on smaller systems | ||
| 17 | it is known to create out-of-memory situations during bootup. | ||
| 10 | 18 | ||
| 11 | config DEVTMPFS | 19 | config DEVTMPFS |
| 12 | bool "Create a kernel maintained /dev tmpfs (EXPERIMENTAL)" | 20 | bool "Maintain a devtmpfs filesystem to mount at /dev" |
| 13 | depends on HOTPLUG && SHMEM && TMPFS | 21 | depends on HOTPLUG && SHMEM && TMPFS |
| 14 | help | 22 | help |
| 15 | This creates a tmpfs filesystem, and mounts it at bootup | 23 | This creates a tmpfs filesystem instance early at bootup. |
| 16 | and mounts it at /dev. The kernel driver core creates device | 24 | In this filesystem, the kernel driver core maintains device |
| 17 | nodes for all registered devices in that filesystem. All device | 25 | nodes with their default names and permissions for all |
| 18 | nodes are owned by root and have the default mode of 0600. | 26 | registered devices with an assigned major/minor number. |
| 19 | Userspace can add and delete the nodes as needed. This is | 27 | Userspace can modify the filesystem content as needed, add |
| 20 | intended to simplify bootup, and make it possible to delay | 28 | symlinks, and apply needed permissions. |
| 21 | the initial coldplug at bootup done by udev in userspace. | 29 | It provides a fully functional /dev directory, where usually |
| 22 | It should also provide a simpler way for rescue systems | 30 | udev runs on top, managing permissions and adding meaningful |
| 23 | to bring up a kernel with dynamic major/minor numbers. | 31 | symlinks. |
| 24 | Meaningful symlinks, permissions and device ownership must | 32 | In very limited environments, it may provide a sufficient |
| 25 | still be handled by userspace. | 33 | functional /dev without any further help. It also allows simple |
| 26 | If unsure, say N here. | 34 | rescue systems, and reliably handles dynamic major/minor numbers. |
| 27 | 35 | ||
| 28 | config DEVTMPFS_MOUNT | 36 | config DEVTMPFS_MOUNT |
| 29 | bool "Automount devtmpfs at /dev" | 37 | bool "Automount devtmpfs at /dev, after the kernel mounted the rootfs" |
| 30 | depends on DEVTMPFS | 38 | depends on DEVTMPFS |
| 31 | help | 39 | help |
| 32 | This will mount devtmpfs at /dev if the kernel mounts the root | 40 | This will instruct the kernel to automatically mount the |
| 33 | filesystem. It will not affect initramfs based mounting. | 41 | devtmpfs filesystem at /dev, directly after the kernel has |
| 34 | If unsure, say N here. | 42 | mounted the root filesystem. The behavior can be overridden |
| 43 | with the commandline parameter: devtmpfs.mount=0|1. | ||
| 44 | This option does not affect initramfs based booting, here | ||
| 45 | the devtmpfs filesystem always needs to be mounted manually | ||
| 46 | after the roots is mounted. | ||
| 47 | With this option enabled, it allows to bring up a system in | ||
| 48 | rescue mode with init=/bin/sh, even when the /dev directory | ||
| 49 | on the rootfs is completely empty. | ||
| 35 | 50 | ||
| 36 | config STANDALONE | 51 | config STANDALONE |
| 37 | bool "Select only drivers that don't need compile-time external firmware" if EXPERIMENTAL | 52 | bool "Select only drivers that don't need compile-time external firmware" if EXPERIMENTAL |
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index c0c5a43d9fb3..71f6af5c8b0b 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
| @@ -70,7 +70,7 @@ static ssize_t drv_attr_store(struct kobject *kobj, struct attribute *attr, | |||
| 70 | return ret; | 70 | return ret; |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | static struct sysfs_ops driver_sysfs_ops = { | 73 | static const struct sysfs_ops driver_sysfs_ops = { |
| 74 | .show = drv_attr_show, | 74 | .show = drv_attr_show, |
| 75 | .store = drv_attr_store, | 75 | .store = drv_attr_store, |
| 76 | }; | 76 | }; |
| @@ -115,7 +115,7 @@ static ssize_t bus_attr_store(struct kobject *kobj, struct attribute *attr, | |||
| 115 | return ret; | 115 | return ret; |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | static struct sysfs_ops bus_sysfs_ops = { | 118 | static const struct sysfs_ops bus_sysfs_ops = { |
| 119 | .show = bus_attr_show, | 119 | .show = bus_attr_show, |
| 120 | .store = bus_attr_store, | 120 | .store = bus_attr_store, |
| 121 | }; | 121 | }; |
| @@ -154,7 +154,7 @@ static int bus_uevent_filter(struct kset *kset, struct kobject *kobj) | |||
| 154 | return 0; | 154 | return 0; |
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | static struct kset_uevent_ops bus_uevent_ops = { | 157 | static const struct kset_uevent_ops bus_uevent_ops = { |
| 158 | .filter = bus_uevent_filter, | 158 | .filter = bus_uevent_filter, |
| 159 | }; | 159 | }; |
| 160 | 160 | ||
| @@ -173,10 +173,10 @@ static ssize_t driver_unbind(struct device_driver *drv, | |||
| 173 | dev = bus_find_device_by_name(bus, NULL, buf); | 173 | dev = bus_find_device_by_name(bus, NULL, buf); |
| 174 | if (dev && dev->driver == drv) { | 174 | if (dev && dev->driver == drv) { |
| 175 | if (dev->parent) /* Needed for USB */ | 175 | if (dev->parent) /* Needed for USB */ |
| 176 | down(&dev->parent->sem); | 176 | device_lock(dev->parent); |
| 177 | device_release_driver(dev); | 177 | device_release_driver(dev); |
| 178 | if (dev->parent) | 178 | if (dev->parent) |
| 179 | up(&dev->parent->sem); | 179 | device_unlock(dev->parent); |
| 180 | err = count; | 180 | err = count; |
| 181 | } | 181 | } |
| 182 | put_device(dev); | 182 | put_device(dev); |
| @@ -200,12 +200,12 @@ static ssize_t driver_bind(struct device_driver *drv, | |||
| 200 | dev = bus_find_device_by_name(bus, NULL, buf); | 200 | dev = bus_find_device_by_name(bus, NULL, buf); |
| 201 | if (dev && dev->driver == NULL && driver_match_device(drv, dev)) { | 201 | if (dev && dev->driver == NULL && driver_match_device(drv, dev)) { |
| 202 | if (dev->parent) /* Needed for USB */ | 202 | if (dev->parent) /* Needed for USB */ |
| 203 | down(&dev->parent->sem); | 203 | device_lock(dev->parent); |
| 204 | down(&dev->sem); | 204 | device_lock(dev); |
| 205 | err = driver_probe_device(drv, dev); | 205 | err = driver_probe_device(drv, dev); |
| 206 | up(&dev->sem); | 206 | device_unlock(dev); |
| 207 | if (dev->parent) | 207 | if (dev->parent) |
| 208 | up(&dev->parent->sem); | 208 | device_unlock(dev->parent); |
| 209 | 209 | ||
| 210 | if (err > 0) { | 210 | if (err > 0) { |
| 211 | /* success */ | 211 | /* success */ |
| @@ -744,10 +744,10 @@ static int __must_check bus_rescan_devices_helper(struct device *dev, | |||
| 744 | 744 | ||
| 745 | if (!dev->driver) { | 745 | if (!dev->driver) { |
| 746 | if (dev->parent) /* Needed for USB */ | 746 | if (dev->parent) /* Needed for USB */ |
| 747 | down(&dev->parent->sem); | 747 | device_lock(dev->parent); |
| 748 | ret = device_attach(dev); | 748 | ret = device_attach(dev); |
| 749 | if (dev->parent) | 749 | if (dev->parent) |
| 750 | up(&dev->parent->sem); | 750 | device_unlock(dev->parent); |
| 751 | } | 751 | } |
| 752 | return ret < 0 ? ret : 0; | 752 | return ret < 0 ? ret : 0; |
| 753 | } | 753 | } |
| @@ -779,10 +779,10 @@ int device_reprobe(struct device *dev) | |||
| 779 | { | 779 | { |
| 780 | if (dev->driver) { | 780 | if (dev->driver) { |
| 781 | if (dev->parent) /* Needed for USB */ | 781 | if (dev->parent) /* Needed for USB */ |
| 782 | down(&dev->parent->sem); | 782 | device_lock(dev->parent); |
| 783 | device_release_driver(dev); | 783 | device_release_driver(dev); |
| 784 | if (dev->parent) | 784 | if (dev->parent) |
| 785 | up(&dev->parent->sem); | 785 | device_unlock(dev->parent); |
| 786 | } | 786 | } |
| 787 | return bus_rescan_devices_helper(dev, NULL); | 787 | return bus_rescan_devices_helper(dev, NULL); |
| 788 | } | 788 | } |
diff --git a/drivers/base/class.c b/drivers/base/class.c index 6e2c3b064f53..0147f476b8a9 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c | |||
| @@ -31,7 +31,7 @@ static ssize_t class_attr_show(struct kobject *kobj, struct attribute *attr, | |||
| 31 | ssize_t ret = -EIO; | 31 | ssize_t ret = -EIO; |
| 32 | 32 | ||
| 33 | if (class_attr->show) | 33 | if (class_attr->show) |
| 34 | ret = class_attr->show(cp->class, buf); | 34 | ret = class_attr->show(cp->class, class_attr, buf); |
| 35 | return ret; | 35 | return ret; |
| 36 | } | 36 | } |
| 37 | 37 | ||
| @@ -43,7 +43,7 @@ static ssize_t class_attr_store(struct kobject *kobj, struct attribute *attr, | |||
| 43 | ssize_t ret = -EIO; | 43 | ssize_t ret = -EIO; |
| 44 | 44 | ||
| 45 | if (class_attr->store) | 45 | if (class_attr->store) |
| 46 | ret = class_attr->store(cp->class, buf, count); | 46 | ret = class_attr->store(cp->class, class_attr, buf, count); |
| 47 | return ret; | 47 | return ret; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| @@ -63,7 +63,7 @@ static void class_release(struct kobject *kobj) | |||
| 63 | kfree(cp); | 63 | kfree(cp); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | static struct sysfs_ops class_sysfs_ops = { | 66 | static const struct sysfs_ops class_sysfs_ops = { |
| 67 | .show = class_attr_show, | 67 | .show = class_attr_show, |
| 68 | .store = class_attr_store, | 68 | .store = class_attr_store, |
| 69 | }; | 69 | }; |
| @@ -490,6 +490,16 @@ void class_interface_unregister(struct class_interface *class_intf) | |||
| 490 | class_put(parent); | 490 | class_put(parent); |
| 491 | } | 491 | } |
| 492 | 492 | ||
| 493 | ssize_t show_class_attr_string(struct class *class, struct class_attribute *attr, | ||
| 494 | char *buf) | ||
| 495 | { | ||
| 496 | struct class_attribute_string *cs; | ||
| 497 | cs = container_of(attr, struct class_attribute_string, attr); | ||
| 498 | return snprintf(buf, PAGE_SIZE, "%s\n", cs->str); | ||
| 499 | } | ||
| 500 | |||
| 501 | EXPORT_SYMBOL_GPL(show_class_attr_string); | ||
| 502 | |||
| 493 | struct class_compat { | 503 | struct class_compat { |
| 494 | struct kobject *kobj; | 504 | struct kobject *kobj; |
| 495 | }; | 505 | }; |
diff --git a/drivers/base/core.c b/drivers/base/core.c index 282025770429..ef55df34ddd0 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
| @@ -100,7 +100,7 @@ static ssize_t dev_attr_store(struct kobject *kobj, struct attribute *attr, | |||
| 100 | return ret; | 100 | return ret; |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | static struct sysfs_ops dev_sysfs_ops = { | 103 | static const struct sysfs_ops dev_sysfs_ops = { |
| 104 | .show = dev_attr_show, | 104 | .show = dev_attr_show, |
| 105 | .store = dev_attr_store, | 105 | .store = dev_attr_store, |
| 106 | }; | 106 | }; |
| @@ -252,7 +252,7 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj, | |||
| 252 | return retval; | 252 | return retval; |
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | static struct kset_uevent_ops device_uevent_ops = { | 255 | static const struct kset_uevent_ops device_uevent_ops = { |
| 256 | .filter = dev_uevent_filter, | 256 | .filter = dev_uevent_filter, |
| 257 | .name = dev_uevent_name, | 257 | .name = dev_uevent_name, |
| 258 | .uevent = dev_uevent, | 258 | .uevent = dev_uevent, |
| @@ -306,15 +306,10 @@ static ssize_t store_uevent(struct device *dev, struct device_attribute *attr, | |||
| 306 | { | 306 | { |
| 307 | enum kobject_action action; | 307 | enum kobject_action action; |
| 308 | 308 | ||
| 309 | if (kobject_action_type(buf, count, &action) == 0) { | 309 | if (kobject_action_type(buf, count, &action) == 0) |
| 310 | kobject_uevent(&dev->kobj, action); | 310 | kobject_uevent(&dev->kobj, action); |
| 311 | goto out; | 311 | else |
| 312 | } | 312 | dev_err(dev, "uevent: unknown action-string\n"); |
| 313 | |||
| 314 | dev_err(dev, "uevent: unsupported action-string; this will " | ||
| 315 | "be ignored in a future kernel version\n"); | ||
| 316 | kobject_uevent(&dev->kobj, KOBJ_ADD); | ||
| 317 | out: | ||
| 318 | return count; | 313 | return count; |
| 319 | } | 314 | } |
| 320 | 315 | ||
| @@ -607,6 +602,7 @@ static struct kobject *get_device_parent(struct device *dev, | |||
| 607 | int retval; | 602 | int retval; |
| 608 | 603 | ||
| 609 | if (dev->class) { | 604 | if (dev->class) { |
| 605 | static DEFINE_MUTEX(gdp_mutex); | ||
| 610 | struct kobject *kobj = NULL; | 606 | struct kobject *kobj = NULL; |
| 611 | struct kobject *parent_kobj; | 607 | struct kobject *parent_kobj; |
| 612 | struct kobject *k; | 608 | struct kobject *k; |
| @@ -623,6 +619,8 @@ static struct kobject *get_device_parent(struct device *dev, | |||
| 623 | else | 619 | else |
| 624 | parent_kobj = &parent->kobj; | 620 | parent_kobj = &parent->kobj; |
| 625 | 621 | ||
| 622 | mutex_lock(&gdp_mutex); | ||
| 623 | |||
| 626 | /* find our class-directory at the parent and reference it */ | 624 | /* find our class-directory at the parent and reference it */ |
| 627 | spin_lock(&dev->class->p->class_dirs.list_lock); | 625 | spin_lock(&dev->class->p->class_dirs.list_lock); |
| 628 | list_for_each_entry(k, &dev->class->p->class_dirs.list, entry) | 626 | list_for_each_entry(k, &dev->class->p->class_dirs.list, entry) |
| @@ -631,20 +629,26 @@ static struct kobject *get_device_parent(struct device *dev, | |||
| 631 | break; | 629 | break; |
| 632 | } | 630 | } |
| 633 | spin_unlock(&dev->class->p->class_dirs.list_lock); | 631 | spin_unlock(&dev->class->p->class_dirs.list_lock); |
| 634 | if (kobj) | 632 | if (kobj) { |
| 633 | mutex_unlock(&gdp_mutex); | ||
| 635 | return kobj; | 634 | return kobj; |
| 635 | } | ||
| 636 | 636 | ||
| 637 | /* or create a new class-directory at the parent device */ | 637 | /* or create a new class-directory at the parent device */ |
| 638 | k = kobject_create(); | 638 | k = kobject_create(); |
| 639 | if (!k) | 639 | if (!k) { |
| 640 | mutex_unlock(&gdp_mutex); | ||
| 640 | return NULL; | 641 | return NULL; |
| 642 | } | ||
| 641 | k->kset = &dev->class->p->class_dirs; | 643 | k->kset = &dev->class->p->class_dirs; |
| 642 | retval = kobject_add(k, parent_kobj, "%s", dev->class->name); | 644 | retval = kobject_add(k, parent_kobj, "%s", dev->class->name); |
| 643 | if (retval < 0) { | 645 | if (retval < 0) { |
| 646 | mutex_unlock(&gdp_mutex); | ||
| 644 | kobject_put(k); | 647 | kobject_put(k); |
| 645 | return NULL; | 648 | return NULL; |
| 646 | } | 649 | } |
| 647 | /* do not emit an uevent for this simple "glue" directory */ | 650 | /* do not emit an uevent for this simple "glue" directory */ |
| 651 | mutex_unlock(&gdp_mutex); | ||
| 648 | return k; | 652 | return k; |
| 649 | } | 653 | } |
| 650 | 654 | ||
| @@ -1574,22 +1578,16 @@ int device_rename(struct device *dev, char *new_name) | |||
| 1574 | if (old_class_name) { | 1578 | if (old_class_name) { |
| 1575 | new_class_name = make_class_name(dev->class->name, &dev->kobj); | 1579 | new_class_name = make_class_name(dev->class->name, &dev->kobj); |
| 1576 | if (new_class_name) { | 1580 | if (new_class_name) { |
| 1577 | error = sysfs_create_link_nowarn(&dev->parent->kobj, | 1581 | error = sysfs_rename_link(&dev->parent->kobj, |
| 1578 | &dev->kobj, | 1582 | &dev->kobj, |
| 1579 | new_class_name); | 1583 | old_class_name, |
| 1580 | if (error) | 1584 | new_class_name); |
| 1581 | goto out; | ||
| 1582 | sysfs_remove_link(&dev->parent->kobj, old_class_name); | ||
| 1583 | } | 1585 | } |
| 1584 | } | 1586 | } |
| 1585 | #else | 1587 | #else |
| 1586 | if (dev->class) { | 1588 | if (dev->class) { |
| 1587 | error = sysfs_create_link_nowarn(&dev->class->p->class_subsys.kobj, | 1589 | error = sysfs_rename_link(&dev->class->p->class_subsys.kobj, |
| 1588 | &dev->kobj, dev_name(dev)); | 1590 | &dev->kobj, old_device_name, new_name); |
| 1589 | if (error) | ||
| 1590 | goto out; | ||
| 1591 | sysfs_remove_link(&dev->class->p->class_subsys.kobj, | ||
| 1592 | old_device_name); | ||
| 1593 | } | 1591 | } |
| 1594 | #endif | 1592 | #endif |
| 1595 | 1593 | ||
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 958bd1540c30..7036e8e96ab8 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
| @@ -13,8 +13,11 @@ | |||
| 13 | 13 | ||
| 14 | #include "base.h" | 14 | #include "base.h" |
| 15 | 15 | ||
| 16 | static struct sysdev_class_attribute *cpu_sysdev_class_attrs[]; | ||
| 17 | |||
| 16 | struct sysdev_class cpu_sysdev_class = { | 18 | struct sysdev_class cpu_sysdev_class = { |
| 17 | .name = "cpu", | 19 | .name = "cpu", |
| 20 | .attrs = cpu_sysdev_class_attrs, | ||
| 18 | }; | 21 | }; |
| 19 | EXPORT_SYMBOL(cpu_sysdev_class); | 22 | EXPORT_SYMBOL(cpu_sysdev_class); |
| 20 | 23 | ||
| @@ -76,34 +79,24 @@ void unregister_cpu(struct cpu *cpu) | |||
| 76 | } | 79 | } |
| 77 | 80 | ||
| 78 | #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE | 81 | #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE |
| 79 | static ssize_t cpu_probe_store(struct class *class, const char *buf, | 82 | static ssize_t cpu_probe_store(struct sys_device *dev, |
| 83 | struct sysdev_attribute *attr, | ||
| 84 | const char *buf, | ||
| 80 | size_t count) | 85 | size_t count) |
| 81 | { | 86 | { |
| 82 | return arch_cpu_probe(buf, count); | 87 | return arch_cpu_probe(buf, count); |
| 83 | } | 88 | } |
| 84 | 89 | ||
| 85 | static ssize_t cpu_release_store(struct class *class, const char *buf, | 90 | static ssize_t cpu_release_store(struct sys_device *dev, |
| 91 | struct sysdev_attribute *attr, | ||
| 92 | const char *buf, | ||
| 86 | size_t count) | 93 | size_t count) |
| 87 | { | 94 | { |
| 88 | return arch_cpu_release(buf, count); | 95 | return arch_cpu_release(buf, count); |
| 89 | } | 96 | } |
| 90 | 97 | ||
| 91 | static CLASS_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); | 98 | static SYSDEV_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); |
| 92 | static CLASS_ATTR(release, S_IWUSR, NULL, cpu_release_store); | 99 | static SYSDEV_ATTR(release, S_IWUSR, NULL, cpu_release_store); |
| 93 | |||
| 94 | int __init cpu_probe_release_init(void) | ||
| 95 | { | ||
| 96 | int rc; | ||
| 97 | |||
| 98 | rc = sysfs_create_file(&cpu_sysdev_class.kset.kobj, | ||
| 99 | &class_attr_probe.attr); | ||
| 100 | if (!rc) | ||
| 101 | rc = sysfs_create_file(&cpu_sysdev_class.kset.kobj, | ||
| 102 | &class_attr_release.attr); | ||
| 103 | |||
| 104 | return rc; | ||
| 105 | } | ||
| 106 | device_initcall(cpu_probe_release_init); | ||
| 107 | #endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */ | 100 | #endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */ |
| 108 | 101 | ||
| 109 | #else /* ... !CONFIG_HOTPLUG_CPU */ | 102 | #else /* ... !CONFIG_HOTPLUG_CPU */ |
| @@ -141,31 +134,39 @@ static SYSDEV_ATTR(crash_notes, 0400, show_crash_notes, NULL); | |||
| 141 | /* | 134 | /* |
| 142 | * Print cpu online, possible, present, and system maps | 135 | * Print cpu online, possible, present, and system maps |
| 143 | */ | 136 | */ |
| 144 | static ssize_t print_cpus_map(char *buf, const struct cpumask *map) | 137 | |
| 138 | struct cpu_attr { | ||
| 139 | struct sysdev_class_attribute attr; | ||
| 140 | const struct cpumask *const * const map; | ||
| 141 | }; | ||
| 142 | |||
| 143 | static ssize_t show_cpus_attr(struct sysdev_class *class, | ||
| 144 | struct sysdev_class_attribute *attr, | ||
| 145 | char *buf) | ||
| 145 | { | 146 | { |
| 146 | int n = cpulist_scnprintf(buf, PAGE_SIZE-2, map); | 147 | struct cpu_attr *ca = container_of(attr, struct cpu_attr, attr); |
| 148 | int n = cpulist_scnprintf(buf, PAGE_SIZE-2, *(ca->map)); | ||
| 147 | 149 | ||
| 148 | buf[n++] = '\n'; | 150 | buf[n++] = '\n'; |
| 149 | buf[n] = '\0'; | 151 | buf[n] = '\0'; |
| 150 | return n; | 152 | return n; |
| 151 | } | 153 | } |
| 152 | 154 | ||
| 153 | #define print_cpus_func(type) \ | 155 | #define _CPU_ATTR(name, map) \ |
| 154 | static ssize_t print_cpus_##type(struct sysdev_class *class, char *buf) \ | 156 | { _SYSDEV_CLASS_ATTR(name, 0444, show_cpus_attr, NULL), map } |
| 155 | { \ | ||
| 156 | return print_cpus_map(buf, cpu_##type##_mask); \ | ||
| 157 | } \ | ||
| 158 | static struct sysdev_class_attribute attr_##type##_map = \ | ||
| 159 | _SYSDEV_CLASS_ATTR(type, 0444, print_cpus_##type, NULL) | ||
| 160 | 157 | ||
| 161 | print_cpus_func(online); | 158 | /* Keep in sync with cpu_sysdev_class_attrs */ |
| 162 | print_cpus_func(possible); | 159 | static struct cpu_attr cpu_attrs[] = { |
| 163 | print_cpus_func(present); | 160 | _CPU_ATTR(online, &cpu_online_mask), |
| 161 | _CPU_ATTR(possible, &cpu_possible_mask), | ||
| 162 | _CPU_ATTR(present, &cpu_present_mask), | ||
| 163 | }; | ||
| 164 | 164 | ||
| 165 | /* | 165 | /* |
| 166 | * Print values for NR_CPUS and offlined cpus | 166 | * Print values for NR_CPUS and offlined cpus |
| 167 | */ | 167 | */ |
| 168 | static ssize_t print_cpus_kernel_max(struct sysdev_class *class, char *buf) | 168 | static ssize_t print_cpus_kernel_max(struct sysdev_class *class, |
| 169 | struct sysdev_class_attribute *attr, char *buf) | ||
| 169 | { | 170 | { |
| 170 | int n = snprintf(buf, PAGE_SIZE-2, "%d\n", NR_CPUS - 1); | 171 | int n = snprintf(buf, PAGE_SIZE-2, "%d\n", NR_CPUS - 1); |
| 171 | return n; | 172 | return n; |
| @@ -175,7 +176,8 @@ static SYSDEV_CLASS_ATTR(kernel_max, 0444, print_cpus_kernel_max, NULL); | |||
| 175 | /* arch-optional setting to enable display of offline cpus >= nr_cpu_ids */ | 176 | /* arch-optional setting to enable display of offline cpus >= nr_cpu_ids */ |
| 176 | unsigned int total_cpus; | 177 | unsigned int total_cpus; |
| 177 | 178 | ||
| 178 | static ssize_t print_cpus_offline(struct sysdev_class *class, char *buf) | 179 | static ssize_t print_cpus_offline(struct sysdev_class *class, |
| 180 | struct sysdev_class_attribute *attr, char *buf) | ||
| 179 | { | 181 | { |
| 180 | int n = 0, len = PAGE_SIZE-2; | 182 | int n = 0, len = PAGE_SIZE-2; |
| 181 | cpumask_var_t offline; | 183 | cpumask_var_t offline; |
| @@ -204,29 +206,6 @@ static ssize_t print_cpus_offline(struct sysdev_class *class, char *buf) | |||
| 204 | } | 206 | } |
| 205 | static SYSDEV_CLASS_ATTR(offline, 0444, print_cpus_offline, NULL); | 207 | static SYSDEV_CLASS_ATTR(offline, 0444, print_cpus_offline, NULL); |
| 206 | 208 | ||
| 207 | static struct sysdev_class_attribute *cpu_state_attr[] = { | ||
| 208 | &attr_online_map, | ||
| 209 | &attr_possible_map, | ||
| 210 | &attr_present_map, | ||
| 211 | &attr_kernel_max, | ||
| 212 | &attr_offline, | ||
| 213 | }; | ||
| 214 | |||
| 215 | static int cpu_states_init(void) | ||
| 216 | { | ||
| 217 | int i; | ||
| 218 | int err = 0; | ||
| 219 | |||
| 220 | for (i = 0; i < ARRAY_SIZE(cpu_state_attr); i++) { | ||
| 221 | int ret; | ||
| 222 | ret = sysdev_class_create_file(&cpu_sysdev_class, | ||
| 223 | cpu_state_attr[i]); | ||
| 224 | if (!err) | ||
| 225 | err = ret; | ||
| 226 | } | ||
| 227 | return err; | ||
| 228 | } | ||
| 229 | |||
| 230 | /* | 209 | /* |
| 231 | * register_cpu - Setup a sysfs device for a CPU. | 210 | * register_cpu - Setup a sysfs device for a CPU. |
| 232 | * @cpu - cpu->hotpluggable field set to 1 will generate a control file in | 211 | * @cpu - cpu->hotpluggable field set to 1 will generate a control file in |
| @@ -272,9 +251,6 @@ int __init cpu_dev_init(void) | |||
| 272 | int err; | 251 | int err; |
| 273 | 252 | ||
| 274 | err = sysdev_class_register(&cpu_sysdev_class); | 253 | err = sysdev_class_register(&cpu_sysdev_class); |
| 275 | if (!err) | ||
| 276 | err = cpu_states_init(); | ||
| 277 | |||
| 278 | #if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT) | 254 | #if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT) |
| 279 | if (!err) | 255 | if (!err) |
| 280 | err = sched_create_sysfs_power_savings_entries(&cpu_sysdev_class); | 256 | err = sched_create_sysfs_power_savings_entries(&cpu_sysdev_class); |
| @@ -282,3 +258,16 @@ int __init cpu_dev_init(void) | |||
| 282 | 258 | ||
| 283 | return err; | 259 | return err; |
| 284 | } | 260 | } |
| 261 | |||
| 262 | static struct sysdev_class_attribute *cpu_sysdev_class_attrs[] = { | ||
| 263 | #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE | ||
| 264 | &attr_probe, | ||
| 265 | &attr_release, | ||
| 266 | #endif | ||
| 267 | &cpu_attrs[0].attr, | ||
| 268 | &cpu_attrs[1].attr, | ||
| 269 | &cpu_attrs[2].attr, | ||
| 270 | &attr_kernel_max, | ||
| 271 | &attr_offline, | ||
| 272 | NULL | ||
| 273 | }; | ||
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index ee95c76bfd3d..c89291f8a16b 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c | |||
| @@ -85,7 +85,7 @@ static void driver_sysfs_remove(struct device *dev) | |||
| 85 | * for before calling this. (It is ok to call with no other effort | 85 | * for before calling this. (It is ok to call with no other effort |
| 86 | * from a driver's probe() method.) | 86 | * from a driver's probe() method.) |
| 87 | * | 87 | * |
| 88 | * This function must be called with @dev->sem held. | 88 | * This function must be called with the device lock held. |
| 89 | */ | 89 | */ |
| 90 | int device_bind_driver(struct device *dev) | 90 | int device_bind_driver(struct device *dev) |
| 91 | { | 91 | { |
| @@ -190,8 +190,8 @@ EXPORT_SYMBOL_GPL(wait_for_device_probe); | |||
| 190 | * This function returns -ENODEV if the device is not registered, | 190 | * This function returns -ENODEV if the device is not registered, |
| 191 | * 1 if the device is bound successfully and 0 otherwise. | 191 | * 1 if the device is bound successfully and 0 otherwise. |
| 192 | * | 192 | * |
| 193 | * This function must be called with @dev->sem held. When called for a | 193 | * This function must be called with @dev lock held. When called for a |
| 194 | * USB interface, @dev->parent->sem must be held as well. | 194 | * USB interface, @dev->parent lock must be held as well. |
| 195 | */ | 195 | */ |
| 196 | int driver_probe_device(struct device_driver *drv, struct device *dev) | 196 | int driver_probe_device(struct device_driver *drv, struct device *dev) |
| 197 | { | 197 | { |
| @@ -233,13 +233,13 @@ static int __device_attach(struct device_driver *drv, void *data) | |||
| 233 | * 0 if no matching driver was found; | 233 | * 0 if no matching driver was found; |
| 234 | * -ENODEV if the device is not registered. | 234 | * -ENODEV if the device is not registered. |
| 235 | * | 235 | * |
| 236 | * When called for a USB interface, @dev->parent->sem must be held. | 236 | * When called for a USB interface, @dev->parent lock must be held. |
| 237 | */ | 237 | */ |
| 238 | int device_attach(struct device *dev) | 238 | int device_attach(struct device *dev) |
| 239 | { | 239 | { |
| 240 | int ret = 0; | 240 | int ret = 0; |
| 241 | 241 | ||
| 242 | down(&dev->sem); | 242 | device_lock(dev); |
| 243 | if (dev->driver) { | 243 | if (dev->driver) { |
| 244 | ret = device_bind_driver(dev); | 244 | ret = device_bind_driver(dev); |
| 245 | if (ret == 0) | 245 | if (ret == 0) |
| @@ -253,7 +253,7 @@ int device_attach(struct device *dev) | |||
| 253 | ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach); | 253 | ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach); |
| 254 | pm_runtime_put_sync(dev); | 254 | pm_runtime_put_sync(dev); |
| 255 | } | 255 | } |
| 256 | up(&dev->sem); | 256 | device_unlock(dev); |
| 257 | return ret; | 257 | return ret; |
| 258 | } | 258 | } |
| 259 | EXPORT_SYMBOL_GPL(device_attach); | 259 | EXPORT_SYMBOL_GPL(device_attach); |
| @@ -276,13 +276,13 @@ static int __driver_attach(struct device *dev, void *data) | |||
| 276 | return 0; | 276 | return 0; |
| 277 | 277 | ||
| 278 | if (dev->parent) /* Needed for USB */ | 278 | if (dev->parent) /* Needed for USB */ |
| 279 | down(&dev->parent->sem); | 279 | device_lock(dev->parent); |
| 280 | down(&dev->sem); | 280 | device_lock(dev); |
| 281 | if (!dev->driver) | 281 | if (!dev->driver) |
| 282 | driver_probe_device(drv, dev); | 282 | driver_probe_device(drv, dev); |
| 283 | up(&dev->sem); | 283 | device_unlock(dev); |
| 284 | if (dev->parent) | 284 | if (dev->parent) |
| 285 | up(&dev->parent->sem); | 285 | device_unlock(dev->parent); |
| 286 | 286 | ||
| 287 | return 0; | 287 | return 0; |
| 288 | } | 288 | } |
| @@ -303,8 +303,8 @@ int driver_attach(struct device_driver *drv) | |||
| 303 | EXPORT_SYMBOL_GPL(driver_attach); | 303 | EXPORT_SYMBOL_GPL(driver_attach); |
| 304 | 304 | ||
| 305 | /* | 305 | /* |
| 306 | * __device_release_driver() must be called with @dev->sem held. | 306 | * __device_release_driver() must be called with @dev lock held. |
| 307 | * When called for a USB interface, @dev->parent->sem must be held as well. | 307 | * When called for a USB interface, @dev->parent lock must be held as well. |
| 308 | */ | 308 | */ |
| 309 | static void __device_release_driver(struct device *dev) | 309 | static void __device_release_driver(struct device *dev) |
| 310 | { | 310 | { |
| @@ -343,7 +343,7 @@ static void __device_release_driver(struct device *dev) | |||
| 343 | * @dev: device. | 343 | * @dev: device. |
| 344 | * | 344 | * |
| 345 | * Manually detach device from driver. | 345 | * Manually detach device from driver. |
| 346 | * When called for a USB interface, @dev->parent->sem must be held. | 346 | * When called for a USB interface, @dev->parent lock must be held. |
| 347 | */ | 347 | */ |
| 348 | void device_release_driver(struct device *dev) | 348 | void device_release_driver(struct device *dev) |
| 349 | { | 349 | { |
| @@ -352,9 +352,9 @@ void device_release_driver(struct device *dev) | |||
| 352 | * within their ->remove callback for the same device, they | 352 | * within their ->remove callback for the same device, they |
| 353 | * will deadlock right here. | 353 | * will deadlock right here. |
| 354 | */ | 354 | */ |
| 355 | down(&dev->sem); | 355 | device_lock(dev); |
| 356 | __device_release_driver(dev); | 356 | __device_release_driver(dev); |
| 357 | up(&dev->sem); | 357 | device_unlock(dev); |
| 358 | } | 358 | } |
| 359 | EXPORT_SYMBOL_GPL(device_release_driver); | 359 | EXPORT_SYMBOL_GPL(device_release_driver); |
| 360 | 360 | ||
| @@ -381,13 +381,13 @@ void driver_detach(struct device_driver *drv) | |||
| 381 | spin_unlock(&drv->p->klist_devices.k_lock); | 381 | spin_unlock(&drv->p->klist_devices.k_lock); |
| 382 | 382 | ||
| 383 | if (dev->parent) /* Needed for USB */ | 383 | if (dev->parent) /* Needed for USB */ |
| 384 | down(&dev->parent->sem); | 384 | device_lock(dev->parent); |
| 385 | down(&dev->sem); | 385 | device_lock(dev); |
| 386 | if (dev->driver == drv) | 386 | if (dev->driver == drv) |
| 387 | __device_release_driver(dev); | 387 | __device_release_driver(dev); |
| 388 | up(&dev->sem); | 388 | device_unlock(dev); |
| 389 | if (dev->parent) | 389 | if (dev->parent) |
| 390 | up(&dev->parent->sem); | 390 | device_unlock(dev->parent); |
| 391 | put_device(dev); | 391 | put_device(dev); |
| 392 | } | 392 | } |
| 393 | } | 393 | } |
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c index 42ae452b36b0..dac478c6e460 100644 --- a/drivers/base/devtmpfs.c +++ b/drivers/base/devtmpfs.c | |||
| @@ -301,6 +301,19 @@ int devtmpfs_delete_node(struct device *dev) | |||
| 301 | if (dentry->d_inode) { | 301 | if (dentry->d_inode) { |
| 302 | err = vfs_getattr(nd.path.mnt, dentry, &stat); | 302 | err = vfs_getattr(nd.path.mnt, dentry, &stat); |
| 303 | if (!err && dev_mynode(dev, dentry->d_inode, &stat)) { | 303 | if (!err && dev_mynode(dev, dentry->d_inode, &stat)) { |
| 304 | struct iattr newattrs; | ||
| 305 | /* | ||
| 306 | * before unlinking this node, reset permissions | ||
| 307 | * of possible references like hardlinks | ||
| 308 | */ | ||
| 309 | newattrs.ia_uid = 0; | ||
| 310 | newattrs.ia_gid = 0; | ||
| 311 | newattrs.ia_mode = stat.mode & ~0777; | ||
| 312 | newattrs.ia_valid = | ||
| 313 | ATTR_UID|ATTR_GID|ATTR_MODE; | ||
| 314 | mutex_lock(&dentry->d_inode->i_mutex); | ||
| 315 | notify_change(dentry, &newattrs); | ||
| 316 | mutex_unlock(&dentry->d_inode->i_mutex); | ||
| 304 | err = vfs_unlink(nd.path.dentry->d_inode, | 317 | err = vfs_unlink(nd.path.dentry->d_inode, |
| 305 | dentry); | 318 | dentry); |
| 306 | if (!err || err == -ENOENT) | 319 | if (!err || err == -ENOENT) |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index a95024166b66..d0dc26ad5387 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
| @@ -19,7 +19,6 @@ | |||
| 19 | #include <linux/kthread.h> | 19 | #include <linux/kthread.h> |
| 20 | #include <linux/highmem.h> | 20 | #include <linux/highmem.h> |
| 21 | #include <linux/firmware.h> | 21 | #include <linux/firmware.h> |
| 22 | #include "base.h" | ||
| 23 | 22 | ||
| 24 | #define to_dev(obj) container_of(obj, struct device, kobj) | 23 | #define to_dev(obj) container_of(obj, struct device, kobj) |
| 25 | 24 | ||
| @@ -69,7 +68,9 @@ fw_load_abort(struct firmware_priv *fw_priv) | |||
| 69 | } | 68 | } |
| 70 | 69 | ||
| 71 | static ssize_t | 70 | static ssize_t |
| 72 | firmware_timeout_show(struct class *class, char *buf) | 71 | firmware_timeout_show(struct class *class, |
| 72 | struct class_attribute *attr, | ||
| 73 | char *buf) | ||
| 73 | { | 74 | { |
| 74 | return sprintf(buf, "%d\n", loading_timeout); | 75 | return sprintf(buf, "%d\n", loading_timeout); |
| 75 | } | 76 | } |
| @@ -87,7 +88,9 @@ firmware_timeout_show(struct class *class, char *buf) | |||
| 87 | * Note: zero means 'wait forever'. | 88 | * Note: zero means 'wait forever'. |
| 88 | **/ | 89 | **/ |
| 89 | static ssize_t | 90 | static ssize_t |
| 90 | firmware_timeout_store(struct class *class, const char *buf, size_t count) | 91 | firmware_timeout_store(struct class *class, |
| 92 | struct class_attribute *attr, | ||
| 93 | const char *buf, size_t count) | ||
| 91 | { | 94 | { |
| 92 | loading_timeout = simple_strtol(buf, NULL, 10); | 95 | loading_timeout = simple_strtol(buf, NULL, 10); |
| 93 | if (loading_timeout < 0) | 96 | if (loading_timeout < 0) |
| @@ -610,7 +613,7 @@ request_firmware_work_func(void *arg) | |||
| 610 | } | 613 | } |
| 611 | 614 | ||
| 612 | /** | 615 | /** |
| 613 | * request_firmware_nowait: asynchronous version of request_firmware | 616 | * request_firmware_nowait - asynchronous version of request_firmware |
| 614 | * @module: module requesting the firmware | 617 | * @module: module requesting the firmware |
| 615 | * @uevent: sends uevent to copy the firmware image if this flag | 618 | * @uevent: sends uevent to copy the firmware image if this flag |
| 616 | * is non-zero else the firmware copy must be done manually. | 619 | * is non-zero else the firmware copy must be done manually. |
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index bd025059711f..2f8691511190 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c | |||
| @@ -44,7 +44,7 @@ static int memory_uevent(struct kset *kset, struct kobject *obj, struct kobj_uev | |||
| 44 | return retval; | 44 | return retval; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | static struct kset_uevent_ops memory_uevent_ops = { | 47 | static const struct kset_uevent_ops memory_uevent_ops = { |
| 48 | .name = memory_uevent_name, | 48 | .name = memory_uevent_name, |
| 49 | .uevent = memory_uevent, | 49 | .uevent = memory_uevent, |
| 50 | }; | 50 | }; |
| @@ -309,17 +309,18 @@ static SYSDEV_ATTR(removable, 0444, show_mem_removable, NULL); | |||
| 309 | * Block size attribute stuff | 309 | * Block size attribute stuff |
| 310 | */ | 310 | */ |
| 311 | static ssize_t | 311 | static ssize_t |
| 312 | print_block_size(struct class *class, char *buf) | 312 | print_block_size(struct sysdev_class *class, struct sysdev_class_attribute *attr, |
| 313 | char *buf) | ||
| 313 | { | 314 | { |
| 314 | return sprintf(buf, "%#lx\n", (unsigned long)PAGES_PER_SECTION * PAGE_SIZE); | 315 | return sprintf(buf, "%#lx\n", (unsigned long)PAGES_PER_SECTION * PAGE_SIZE); |
| 315 | } | 316 | } |
| 316 | 317 | ||
| 317 | static CLASS_ATTR(block_size_bytes, 0444, print_block_size, NULL); | 318 | static SYSDEV_CLASS_ATTR(block_size_bytes, 0444, print_block_size, NULL); |
| 318 | 319 | ||
| 319 | static int block_size_init(void) | 320 | static int block_size_init(void) |
| 320 | { | 321 | { |
| 321 | return sysfs_create_file(&memory_sysdev_class.kset.kobj, | 322 | return sysfs_create_file(&memory_sysdev_class.kset.kobj, |
| 322 | &class_attr_block_size_bytes.attr); | 323 | &attr_block_size_bytes.attr); |
| 323 | } | 324 | } |
| 324 | 325 | ||
| 325 | /* | 326 | /* |
| @@ -330,7 +331,8 @@ static int block_size_init(void) | |||
| 330 | */ | 331 | */ |
| 331 | #ifdef CONFIG_ARCH_MEMORY_PROBE | 332 | #ifdef CONFIG_ARCH_MEMORY_PROBE |
| 332 | static ssize_t | 333 | static ssize_t |
| 333 | memory_probe_store(struct class *class, const char *buf, size_t count) | 334 | memory_probe_store(struct class *class, struct class_attribute *attr, |
| 335 | const char *buf, size_t count) | ||
| 334 | { | 336 | { |
| 335 | u64 phys_addr; | 337 | u64 phys_addr; |
| 336 | int nid; | 338 | int nid; |
| @@ -367,7 +369,9 @@ static inline int memory_probe_init(void) | |||
| 367 | 369 | ||
| 368 | /* Soft offline a page */ | 370 | /* Soft offline a page */ |
| 369 | static ssize_t | 371 | static ssize_t |
| 370 | store_soft_offline_page(struct class *class, const char *buf, size_t count) | 372 | store_soft_offline_page(struct class *class, |
| 373 | struct class_attribute *attr, | ||
| 374 | const char *buf, size_t count) | ||
| 371 | { | 375 | { |
| 372 | int ret; | 376 | int ret; |
| 373 | u64 pfn; | 377 | u64 pfn; |
| @@ -384,7 +388,9 @@ store_soft_offline_page(struct class *class, const char *buf, size_t count) | |||
| 384 | 388 | ||
| 385 | /* Forcibly offline a page, including killing processes. */ | 389 | /* Forcibly offline a page, including killing processes. */ |
| 386 | static ssize_t | 390 | static ssize_t |
| 387 | store_hard_offline_page(struct class *class, const char *buf, size_t count) | 391 | store_hard_offline_page(struct class *class, |
| 392 | struct class_attribute *attr, | ||
| 393 | const char *buf, size_t count) | ||
| 388 | { | 394 | { |
| 389 | int ret; | 395 | int ret; |
| 390 | u64 pfn; | 396 | u64 pfn; |
diff --git a/drivers/base/node.c b/drivers/base/node.c index 70122791683d..ad43185ec15a 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c | |||
| @@ -16,8 +16,11 @@ | |||
| 16 | #include <linux/device.h> | 16 | #include <linux/device.h> |
| 17 | #include <linux/swap.h> | 17 | #include <linux/swap.h> |
| 18 | 18 | ||
| 19 | static struct sysdev_class_attribute *node_state_attrs[]; | ||
| 20 | |||
| 19 | static struct sysdev_class node_class = { | 21 | static struct sysdev_class node_class = { |
| 20 | .name = "node", | 22 | .name = "node", |
| 23 | .attrs = node_state_attrs, | ||
| 21 | }; | 24 | }; |
| 22 | 25 | ||
| 23 | 26 | ||
| @@ -544,76 +547,52 @@ static ssize_t print_nodes_state(enum node_states state, char *buf) | |||
| 544 | return n; | 547 | return n; |
| 545 | } | 548 | } |
| 546 | 549 | ||
| 547 | static ssize_t print_nodes_possible(struct sysdev_class *class, char *buf) | 550 | struct node_attr { |
| 548 | { | 551 | struct sysdev_class_attribute attr; |
| 549 | return print_nodes_state(N_POSSIBLE, buf); | 552 | enum node_states state; |
| 550 | } | 553 | }; |
| 551 | |||
| 552 | static ssize_t print_nodes_online(struct sysdev_class *class, char *buf) | ||
| 553 | { | ||
| 554 | return print_nodes_state(N_ONLINE, buf); | ||
| 555 | } | ||
| 556 | |||
| 557 | static ssize_t print_nodes_has_normal_memory(struct sysdev_class *class, | ||
| 558 | char *buf) | ||
| 559 | { | ||
| 560 | return print_nodes_state(N_NORMAL_MEMORY, buf); | ||
| 561 | } | ||
| 562 | 554 | ||
| 563 | static ssize_t print_nodes_has_cpu(struct sysdev_class *class, char *buf) | 555 | static ssize_t show_node_state(struct sysdev_class *class, |
| 556 | struct sysdev_class_attribute *attr, char *buf) | ||
| 564 | { | 557 | { |
| 565 | return print_nodes_state(N_CPU, buf); | 558 | struct node_attr *na = container_of(attr, struct node_attr, attr); |
| 559 | return print_nodes_state(na->state, buf); | ||
| 566 | } | 560 | } |
| 567 | 561 | ||
| 568 | static SYSDEV_CLASS_ATTR(possible, 0444, print_nodes_possible, NULL); | 562 | #define _NODE_ATTR(name, state) \ |
| 569 | static SYSDEV_CLASS_ATTR(online, 0444, print_nodes_online, NULL); | 563 | { _SYSDEV_CLASS_ATTR(name, 0444, show_node_state, NULL), state } |
| 570 | static SYSDEV_CLASS_ATTR(has_normal_memory, 0444, print_nodes_has_normal_memory, | ||
| 571 | NULL); | ||
| 572 | static SYSDEV_CLASS_ATTR(has_cpu, 0444, print_nodes_has_cpu, NULL); | ||
| 573 | 564 | ||
| 565 | static struct node_attr node_state_attr[] = { | ||
| 566 | _NODE_ATTR(possible, N_POSSIBLE), | ||
| 567 | _NODE_ATTR(online, N_ONLINE), | ||
| 568 | _NODE_ATTR(has_normal_memory, N_NORMAL_MEMORY), | ||
| 569 | _NODE_ATTR(has_cpu, N_CPU), | ||
| 574 | #ifdef CONFIG_HIGHMEM | 570 | #ifdef CONFIG_HIGHMEM |
| 575 | static ssize_t print_nodes_has_high_memory(struct sysdev_class *class, | 571 | _NODE_ATTR(has_high_memory, N_HIGH_MEMORY), |
| 576 | char *buf) | ||
| 577 | { | ||
| 578 | return print_nodes_state(N_HIGH_MEMORY, buf); | ||
| 579 | } | ||
| 580 | |||
| 581 | static SYSDEV_CLASS_ATTR(has_high_memory, 0444, print_nodes_has_high_memory, | ||
| 582 | NULL); | ||
| 583 | #endif | 572 | #endif |
| 573 | }; | ||
| 584 | 574 | ||
| 585 | struct sysdev_class_attribute *node_state_attr[] = { | 575 | static struct sysdev_class_attribute *node_state_attrs[] = { |
| 586 | &attr_possible, | 576 | &node_state_attr[0].attr, |
| 587 | &attr_online, | 577 | &node_state_attr[1].attr, |
| 588 | &attr_has_normal_memory, | 578 | &node_state_attr[2].attr, |
| 579 | &node_state_attr[3].attr, | ||
| 589 | #ifdef CONFIG_HIGHMEM | 580 | #ifdef CONFIG_HIGHMEM |
| 590 | &attr_has_high_memory, | 581 | &node_state_attr[4].attr, |
| 591 | #endif | 582 | #endif |
| 592 | &attr_has_cpu, | 583 | NULL |
| 593 | }; | 584 | }; |
| 594 | 585 | ||
| 595 | static int node_states_init(void) | ||
| 596 | { | ||
| 597 | int i; | ||
| 598 | int err = 0; | ||
| 599 | |||
| 600 | for (i = 0; i < NR_NODE_STATES; i++) { | ||
| 601 | int ret; | ||
| 602 | ret = sysdev_class_create_file(&node_class, node_state_attr[i]); | ||
| 603 | if (!err) | ||
| 604 | err = ret; | ||
| 605 | } | ||
| 606 | return err; | ||
| 607 | } | ||
| 608 | |||
| 609 | #define NODE_CALLBACK_PRI 2 /* lower than SLAB */ | 586 | #define NODE_CALLBACK_PRI 2 /* lower than SLAB */ |
| 610 | static int __init register_node_type(void) | 587 | static int __init register_node_type(void) |
| 611 | { | 588 | { |
| 612 | int ret; | 589 | int ret; |
| 613 | 590 | ||
| 591 | BUILD_BUG_ON(ARRAY_SIZE(node_state_attr) != NR_NODE_STATES); | ||
| 592 | BUILD_BUG_ON(ARRAY_SIZE(node_state_attrs)-1 != NR_NODE_STATES); | ||
| 593 | |||
| 614 | ret = sysdev_class_register(&node_class); | 594 | ret = sysdev_class_register(&node_class); |
| 615 | if (!ret) { | 595 | if (!ret) { |
| 616 | ret = node_states_init(); | ||
| 617 | hotplug_memory_notifier(node_memory_callback, | 596 | hotplug_memory_notifier(node_memory_callback, |
| 618 | NODE_CALLBACK_PRI); | 597 | NODE_CALLBACK_PRI); |
| 619 | } | 598 | } |
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 58efaf2f1259..1ba9d617d241 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
| @@ -128,7 +128,7 @@ struct platform_object { | |||
| 128 | }; | 128 | }; |
| 129 | 129 | ||
| 130 | /** | 130 | /** |
| 131 | * platform_device_put | 131 | * platform_device_put - destroy a platform device |
| 132 | * @pdev: platform device to free | 132 | * @pdev: platform device to free |
| 133 | * | 133 | * |
| 134 | * Free all memory associated with a platform device. This function must | 134 | * Free all memory associated with a platform device. This function must |
| @@ -152,7 +152,7 @@ static void platform_device_release(struct device *dev) | |||
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | /** | 154 | /** |
| 155 | * platform_device_alloc | 155 | * platform_device_alloc - create a platform device |
| 156 | * @name: base name of the device we're adding | 156 | * @name: base name of the device we're adding |
| 157 | * @id: instance id | 157 | * @id: instance id |
| 158 | * | 158 | * |
| @@ -177,7 +177,7 @@ struct platform_device *platform_device_alloc(const char *name, int id) | |||
| 177 | EXPORT_SYMBOL_GPL(platform_device_alloc); | 177 | EXPORT_SYMBOL_GPL(platform_device_alloc); |
| 178 | 178 | ||
| 179 | /** | 179 | /** |
| 180 | * platform_device_add_resources | 180 | * platform_device_add_resources - add resources to a platform device |
| 181 | * @pdev: platform device allocated by platform_device_alloc to add resources to | 181 | * @pdev: platform device allocated by platform_device_alloc to add resources to |
| 182 | * @res: set of resources that needs to be allocated for the device | 182 | * @res: set of resources that needs to be allocated for the device |
| 183 | * @num: number of resources | 183 | * @num: number of resources |
| @@ -202,7 +202,7 @@ int platform_device_add_resources(struct platform_device *pdev, | |||
| 202 | EXPORT_SYMBOL_GPL(platform_device_add_resources); | 202 | EXPORT_SYMBOL_GPL(platform_device_add_resources); |
| 203 | 203 | ||
| 204 | /** | 204 | /** |
| 205 | * platform_device_add_data | 205 | * platform_device_add_data - add platform-specific data to a platform device |
| 206 | * @pdev: platform device allocated by platform_device_alloc to add resources to | 206 | * @pdev: platform device allocated by platform_device_alloc to add resources to |
| 207 | * @data: platform specific data for this platform device | 207 | * @data: platform specific data for this platform device |
| 208 | * @size: size of platform specific data | 208 | * @size: size of platform specific data |
| @@ -344,7 +344,7 @@ void platform_device_unregister(struct platform_device *pdev) | |||
| 344 | EXPORT_SYMBOL_GPL(platform_device_unregister); | 344 | EXPORT_SYMBOL_GPL(platform_device_unregister); |
| 345 | 345 | ||
| 346 | /** | 346 | /** |
| 347 | * platform_device_register_simple | 347 | * platform_device_register_simple - add a platform-level device and its resources |
| 348 | * @name: base name of the device we're adding | 348 | * @name: base name of the device we're adding |
| 349 | * @id: instance id | 349 | * @id: instance id |
| 350 | * @res: set of resources that needs to be allocated for the device | 350 | * @res: set of resources that needs to be allocated for the device |
| @@ -396,7 +396,7 @@ error: | |||
| 396 | EXPORT_SYMBOL_GPL(platform_device_register_simple); | 396 | EXPORT_SYMBOL_GPL(platform_device_register_simple); |
| 397 | 397 | ||
| 398 | /** | 398 | /** |
| 399 | * platform_device_register_data | 399 | * platform_device_register_data - add a platform-level device with platform-specific data |
| 400 | * @parent: parent device for the device we're adding | 400 | * @parent: parent device for the device we're adding |
| 401 | * @name: base name of the device we're adding | 401 | * @name: base name of the device we're adding |
| 402 | * @id: instance id | 402 | * @id: instance id |
| @@ -473,7 +473,7 @@ static void platform_drv_shutdown(struct device *_dev) | |||
| 473 | } | 473 | } |
| 474 | 474 | ||
| 475 | /** | 475 | /** |
| 476 | * platform_driver_register | 476 | * platform_driver_register - register a driver for platform-level devices |
| 477 | * @drv: platform driver structure | 477 | * @drv: platform driver structure |
| 478 | */ | 478 | */ |
| 479 | int platform_driver_register(struct platform_driver *drv) | 479 | int platform_driver_register(struct platform_driver *drv) |
| @@ -491,7 +491,7 @@ int platform_driver_register(struct platform_driver *drv) | |||
| 491 | EXPORT_SYMBOL_GPL(platform_driver_register); | 491 | EXPORT_SYMBOL_GPL(platform_driver_register); |
| 492 | 492 | ||
| 493 | /** | 493 | /** |
| 494 | * platform_driver_unregister | 494 | * platform_driver_unregister - unregister a driver for platform-level devices |
| 495 | * @drv: platform driver structure | 495 | * @drv: platform driver structure |
| 496 | */ | 496 | */ |
| 497 | void platform_driver_unregister(struct platform_driver *drv) | 497 | void platform_driver_unregister(struct platform_driver *drv) |
| @@ -548,6 +548,64 @@ int __init_or_module platform_driver_probe(struct platform_driver *drv, | |||
| 548 | } | 548 | } |
| 549 | EXPORT_SYMBOL_GPL(platform_driver_probe); | 549 | EXPORT_SYMBOL_GPL(platform_driver_probe); |
| 550 | 550 | ||
| 551 | /** | ||
| 552 | * platform_create_bundle - register driver and create corresponding device | ||
| 553 | * @driver: platform driver structure | ||
| 554 | * @probe: the driver probe routine, probably from an __init section | ||
| 555 | * @res: set of resources that needs to be allocated for the device | ||
| 556 | * @n_res: number of resources | ||
| 557 | * @data: platform specific data for this platform device | ||
| 558 | * @size: size of platform specific data | ||
| 559 | * | ||
| 560 | * Use this in legacy-style modules that probe hardware directly and | ||
| 561 | * register a single platform device and corresponding platform driver. | ||
| 562 | */ | ||
| 563 | struct platform_device * __init_or_module platform_create_bundle( | ||
| 564 | struct platform_driver *driver, | ||
| 565 | int (*probe)(struct platform_device *), | ||
| 566 | struct resource *res, unsigned int n_res, | ||
| 567 | const void *data, size_t size) | ||
| 568 | { | ||
| 569 | struct platform_device *pdev; | ||
| 570 | int error; | ||
| 571 | |||
| 572 | pdev = platform_device_alloc(driver->driver.name, -1); | ||
| 573 | if (!pdev) { | ||
| 574 | error = -ENOMEM; | ||
| 575 | goto err_out; | ||
| 576 | } | ||
| 577 | |||
| 578 | if (res) { | ||
| 579 | error = platform_device_add_resources(pdev, res, n_res); | ||
| 580 | if (error) | ||
| 581 | goto err_pdev_put; | ||
| 582 | } | ||
| 583 | |||
| 584 | if (data) { | ||
| 585 | error = platform_device_add_data(pdev, data, size); | ||
| 586 | if (error) | ||
| 587 | goto err_pdev_put; | ||
| 588 | } | ||
| 589 | |||
| 590 | error = platform_device_add(pdev); | ||
| 591 | if (error) | ||
| 592 | goto err_pdev_put; | ||
| 593 | |||
| 594 | error = platform_driver_probe(driver, probe); | ||
| 595 | if (error) | ||
| 596 | goto err_pdev_del; | ||
| 597 | |||
| 598 | return pdev; | ||
| 599 | |||
| 600 | err_pdev_del: | ||
| 601 | platform_device_del(pdev); | ||
| 602 | err_pdev_put: | ||
| 603 | platform_device_put(pdev); | ||
| 604 | err_out: | ||
| 605 | return ERR_PTR(error); | ||
| 606 | } | ||
| 607 | EXPORT_SYMBOL_GPL(platform_create_bundle); | ||
| 608 | |||
| 551 | /* modalias support enables more hands-off userspace setup: | 609 | /* modalias support enables more hands-off userspace setup: |
| 552 | * (a) environment variable lets new-style hotplug events work once system is | 610 | * (a) environment variable lets new-style hotplug events work once system is |
| 553 | * fully running: "modprobe $MODALIAS" | 611 | * fully running: "modprobe $MODALIAS" |
| @@ -578,7 +636,7 @@ static int platform_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
| 578 | } | 636 | } |
| 579 | 637 | ||
| 580 | static const struct platform_device_id *platform_match_id( | 638 | static const struct platform_device_id *platform_match_id( |
| 581 | struct platform_device_id *id, | 639 | const struct platform_device_id *id, |
| 582 | struct platform_device *pdev) | 640 | struct platform_device *pdev) |
| 583 | { | 641 | { |
| 584 | while (id->name[0]) { | 642 | while (id->name[0]) { |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 0e26a6f6fd48..d477f4dc5e51 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
| @@ -35,8 +35,8 @@ | |||
| 35 | * because children are guaranteed to be discovered after parents, and | 35 | * because children are guaranteed to be discovered after parents, and |
| 36 | * are inserted at the back of the list on discovery. | 36 | * are inserted at the back of the list on discovery. |
| 37 | * | 37 | * |
| 38 | * Since device_pm_add() may be called with a device semaphore held, | 38 | * Since device_pm_add() may be called with a device lock held, |
| 39 | * we must never try to acquire a device semaphore while holding | 39 | * we must never try to acquire a device lock while holding |
| 40 | * dpm_list_mutex. | 40 | * dpm_list_mutex. |
| 41 | */ | 41 | */ |
| 42 | 42 | ||
| @@ -508,7 +508,7 @@ static int device_resume(struct device *dev, pm_message_t state, bool async) | |||
| 508 | TRACE_RESUME(0); | 508 | TRACE_RESUME(0); |
| 509 | 509 | ||
| 510 | dpm_wait(dev->parent, async); | 510 | dpm_wait(dev->parent, async); |
| 511 | down(&dev->sem); | 511 | device_lock(dev); |
| 512 | 512 | ||
| 513 | dev->power.status = DPM_RESUMING; | 513 | dev->power.status = DPM_RESUMING; |
| 514 | 514 | ||
| @@ -543,7 +543,7 @@ static int device_resume(struct device *dev, pm_message_t state, bool async) | |||
| 543 | } | 543 | } |
| 544 | } | 544 | } |
| 545 | End: | 545 | End: |
| 546 | up(&dev->sem); | 546 | device_unlock(dev); |
| 547 | complete_all(&dev->power.completion); | 547 | complete_all(&dev->power.completion); |
| 548 | 548 | ||
| 549 | TRACE_RESUME(error); | 549 | TRACE_RESUME(error); |
| @@ -629,7 +629,7 @@ static void dpm_resume(pm_message_t state) | |||
| 629 | */ | 629 | */ |
| 630 | static void device_complete(struct device *dev, pm_message_t state) | 630 | static void device_complete(struct device *dev, pm_message_t state) |
| 631 | { | 631 | { |
| 632 | down(&dev->sem); | 632 | device_lock(dev); |
| 633 | 633 | ||
| 634 | if (dev->class && dev->class->pm && dev->class->pm->complete) { | 634 | if (dev->class && dev->class->pm && dev->class->pm->complete) { |
| 635 | pm_dev_dbg(dev, state, "completing class "); | 635 | pm_dev_dbg(dev, state, "completing class "); |
| @@ -646,7 +646,7 @@ static void device_complete(struct device *dev, pm_message_t state) | |||
| 646 | dev->bus->pm->complete(dev); | 646 | dev->bus->pm->complete(dev); |
| 647 | } | 647 | } |
| 648 | 648 | ||
| 649 | up(&dev->sem); | 649 | device_unlock(dev); |
| 650 | } | 650 | } |
| 651 | 651 | ||
| 652 | /** | 652 | /** |
| @@ -809,7 +809,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) | |||
| 809 | int error = 0; | 809 | int error = 0; |
| 810 | 810 | ||
| 811 | dpm_wait_for_children(dev, async); | 811 | dpm_wait_for_children(dev, async); |
| 812 | down(&dev->sem); | 812 | device_lock(dev); |
| 813 | 813 | ||
| 814 | if (async_error) | 814 | if (async_error) |
| 815 | goto End; | 815 | goto End; |
| @@ -849,7 +849,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) | |||
| 849 | dev->power.status = DPM_OFF; | 849 | dev->power.status = DPM_OFF; |
| 850 | 850 | ||
| 851 | End: | 851 | End: |
| 852 | up(&dev->sem); | 852 | device_unlock(dev); |
| 853 | complete_all(&dev->power.completion); | 853 | complete_all(&dev->power.completion); |
| 854 | 854 | ||
| 855 | return error; | 855 | return error; |
| @@ -938,7 +938,7 @@ static int device_prepare(struct device *dev, pm_message_t state) | |||
| 938 | { | 938 | { |
| 939 | int error = 0; | 939 | int error = 0; |
| 940 | 940 | ||
| 941 | down(&dev->sem); | 941 | device_lock(dev); |
| 942 | 942 | ||
| 943 | if (dev->bus && dev->bus->pm && dev->bus->pm->prepare) { | 943 | if (dev->bus && dev->bus->pm && dev->bus->pm->prepare) { |
| 944 | pm_dev_dbg(dev, state, "preparing "); | 944 | pm_dev_dbg(dev, state, "preparing "); |
| @@ -962,7 +962,7 @@ static int device_prepare(struct device *dev, pm_message_t state) | |||
| 962 | suspend_report_result(dev->class->pm->prepare, error); | 962 | suspend_report_result(dev->class->pm->prepare, error); |
| 963 | } | 963 | } |
| 964 | End: | 964 | End: |
| 965 | up(&dev->sem); | 965 | device_unlock(dev); |
| 966 | 966 | ||
| 967 | return error; | 967 | return error; |
| 968 | } | 968 | } |
diff --git a/drivers/base/sys.c b/drivers/base/sys.c index 0d903909af7e..8980feec5d14 100644 --- a/drivers/base/sys.c +++ b/drivers/base/sys.c | |||
| @@ -54,7 +54,7 @@ sysdev_store(struct kobject *kobj, struct attribute *attr, | |||
| 54 | return -EIO; | 54 | return -EIO; |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | static struct sysfs_ops sysfs_ops = { | 57 | static const struct sysfs_ops sysfs_ops = { |
| 58 | .show = sysdev_show, | 58 | .show = sysdev_show, |
| 59 | .store = sysdev_store, | 59 | .store = sysdev_store, |
| 60 | }; | 60 | }; |
| @@ -89,7 +89,7 @@ static ssize_t sysdev_class_show(struct kobject *kobj, struct attribute *attr, | |||
| 89 | struct sysdev_class_attribute *class_attr = to_sysdev_class_attr(attr); | 89 | struct sysdev_class_attribute *class_attr = to_sysdev_class_attr(attr); |
| 90 | 90 | ||
| 91 | if (class_attr->show) | 91 | if (class_attr->show) |
| 92 | return class_attr->show(class, buffer); | 92 | return class_attr->show(class, class_attr, buffer); |
| 93 | return -EIO; | 93 | return -EIO; |
| 94 | } | 94 | } |
| 95 | 95 | ||
| @@ -100,11 +100,11 @@ static ssize_t sysdev_class_store(struct kobject *kobj, struct attribute *attr, | |||
| 100 | struct sysdev_class_attribute *class_attr = to_sysdev_class_attr(attr); | 100 | struct sysdev_class_attribute *class_attr = to_sysdev_class_attr(attr); |
| 101 | 101 | ||
| 102 | if (class_attr->store) | 102 | if (class_attr->store) |
| 103 | return class_attr->store(class, buffer, count); | 103 | return class_attr->store(class, class_attr, buffer, count); |
| 104 | return -EIO; | 104 | return -EIO; |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | static struct sysfs_ops sysfs_class_ops = { | 107 | static const struct sysfs_ops sysfs_class_ops = { |
| 108 | .show = sysdev_class_show, | 108 | .show = sysdev_class_show, |
| 109 | .store = sysdev_class_store, | 109 | .store = sysdev_class_store, |
| 110 | }; | 110 | }; |
| @@ -145,13 +145,20 @@ int sysdev_class_register(struct sysdev_class *cls) | |||
| 145 | if (retval) | 145 | if (retval) |
| 146 | return retval; | 146 | return retval; |
| 147 | 147 | ||
| 148 | return kset_register(&cls->kset); | 148 | retval = kset_register(&cls->kset); |
| 149 | if (!retval && cls->attrs) | ||
| 150 | retval = sysfs_create_files(&cls->kset.kobj, | ||
| 151 | (const struct attribute **)cls->attrs); | ||
| 152 | return retval; | ||
| 149 | } | 153 | } |
| 150 | 154 | ||
| 151 | void sysdev_class_unregister(struct sysdev_class *cls) | 155 | void sysdev_class_unregister(struct sysdev_class *cls) |
| 152 | { | 156 | { |
| 153 | pr_debug("Unregistering sysdev class '%s'\n", | 157 | pr_debug("Unregistering sysdev class '%s'\n", |
| 154 | kobject_name(&cls->kset.kobj)); | 158 | kobject_name(&cls->kset.kobj)); |
| 159 | if (cls->attrs) | ||
| 160 | sysfs_remove_files(&cls->kset.kobj, | ||
| 161 | (const struct attribute **)cls->attrs); | ||
| 155 | kset_unregister(&cls->kset); | 162 | kset_unregister(&cls->kset); |
| 156 | } | 163 | } |
| 157 | 164 | ||
diff --git a/drivers/block/osdblk.c b/drivers/block/osdblk.c index a808b1530b3b..eb2091aa1c19 100644 --- a/drivers/block/osdblk.c +++ b/drivers/block/osdblk.c | |||
| @@ -476,7 +476,9 @@ static void class_osdblk_release(struct class *cls) | |||
| 476 | kfree(cls); | 476 | kfree(cls); |
| 477 | } | 477 | } |
| 478 | 478 | ||
| 479 | static ssize_t class_osdblk_list(struct class *c, char *data) | 479 | static ssize_t class_osdblk_list(struct class *c, |
| 480 | struct class_attribute *attr, | ||
| 481 | char *data) | ||
| 480 | { | 482 | { |
| 481 | int n = 0; | 483 | int n = 0; |
| 482 | struct list_head *tmp; | 484 | struct list_head *tmp; |
| @@ -500,7 +502,9 @@ static ssize_t class_osdblk_list(struct class *c, char *data) | |||
| 500 | return n; | 502 | return n; |
| 501 | } | 503 | } |
| 502 | 504 | ||
| 503 | static ssize_t class_osdblk_add(struct class *c, const char *buf, size_t count) | 505 | static ssize_t class_osdblk_add(struct class *c, |
| 506 | struct class_attribute *attr, | ||
| 507 | const char *buf, size_t count) | ||
| 504 | { | 508 | { |
| 505 | struct osdblk_device *osdev; | 509 | struct osdblk_device *osdev; |
| 506 | ssize_t rc; | 510 | ssize_t rc; |
| @@ -592,7 +596,9 @@ err_out_mod: | |||
| 592 | return rc; | 596 | return rc; |
| 593 | } | 597 | } |
| 594 | 598 | ||
| 595 | static ssize_t class_osdblk_remove(struct class *c, const char *buf, | 599 | static ssize_t class_osdblk_remove(struct class *c, |
| 600 | struct class_attribute *attr, | ||
| 601 | const char *buf, | ||
| 596 | size_t count) | 602 | size_t count) |
| 597 | { | 603 | { |
| 598 | struct osdblk_device *osdev = NULL; | 604 | struct osdblk_device *osdev = NULL; |
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index b72935b8f203..39c8514442eb 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
| @@ -284,7 +284,7 @@ static ssize_t kobj_pkt_store(struct kobject *kobj, | |||
| 284 | return len; | 284 | return len; |
| 285 | } | 285 | } |
| 286 | 286 | ||
| 287 | static struct sysfs_ops kobj_pkt_ops = { | 287 | static const struct sysfs_ops kobj_pkt_ops = { |
| 288 | .show = kobj_pkt_show, | 288 | .show = kobj_pkt_show, |
| 289 | .store = kobj_pkt_store | 289 | .store = kobj_pkt_store |
| 290 | }; | 290 | }; |
| @@ -337,7 +337,9 @@ static void class_pktcdvd_release(struct class *cls) | |||
| 337 | { | 337 | { |
| 338 | kfree(cls); | 338 | kfree(cls); |
| 339 | } | 339 | } |
| 340 | static ssize_t class_pktcdvd_show_map(struct class *c, char *data) | 340 | static ssize_t class_pktcdvd_show_map(struct class *c, |
| 341 | struct class_attribute *attr, | ||
| 342 | char *data) | ||
| 341 | { | 343 | { |
| 342 | int n = 0; | 344 | int n = 0; |
| 343 | int idx; | 345 | int idx; |
| @@ -356,7 +358,9 @@ static ssize_t class_pktcdvd_show_map(struct class *c, char *data) | |||
| 356 | return n; | 358 | return n; |
| 357 | } | 359 | } |
| 358 | 360 | ||
| 359 | static ssize_t class_pktcdvd_store_add(struct class *c, const char *buf, | 361 | static ssize_t class_pktcdvd_store_add(struct class *c, |
| 362 | struct class_attribute *attr, | ||
| 363 | const char *buf, | ||
| 360 | size_t count) | 364 | size_t count) |
| 361 | { | 365 | { |
| 362 | unsigned int major, minor; | 366 | unsigned int major, minor; |
| @@ -376,7 +380,9 @@ static ssize_t class_pktcdvd_store_add(struct class *c, const char *buf, | |||
| 376 | return -EINVAL; | 380 | return -EINVAL; |
| 377 | } | 381 | } |
| 378 | 382 | ||
| 379 | static ssize_t class_pktcdvd_store_remove(struct class *c, const char *buf, | 383 | static ssize_t class_pktcdvd_store_remove(struct class *c, |
| 384 | struct class_attribute *attr, | ||
| 385 | const char *buf, | ||
| 380 | size_t count) | 386 | size_t count) |
| 381 | { | 387 | { |
| 382 | unsigned int major, minor; | 388 | unsigned int major, minor; |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 67bc2ece7b4b..2d5d575e889d 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
| @@ -766,7 +766,7 @@ static void cpufreq_sysfs_release(struct kobject *kobj) | |||
| 766 | complete(&policy->kobj_unregister); | 766 | complete(&policy->kobj_unregister); |
| 767 | } | 767 | } |
| 768 | 768 | ||
| 769 | static struct sysfs_ops sysfs_ops = { | 769 | static const struct sysfs_ops sysfs_ops = { |
| 770 | .show = show, | 770 | .show = show, |
| 771 | .store = store, | 771 | .store = store, |
| 772 | }; | 772 | }; |
diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c index 97b003839fb6..8719b36e1a4d 100644 --- a/drivers/cpuidle/sysfs.c +++ b/drivers/cpuidle/sysfs.c | |||
| @@ -22,6 +22,7 @@ static int __init cpuidle_sysfs_setup(char *unused) | |||
| 22 | __setup("cpuidle_sysfs_switch", cpuidle_sysfs_setup); | 22 | __setup("cpuidle_sysfs_switch", cpuidle_sysfs_setup); |
| 23 | 23 | ||
| 24 | static ssize_t show_available_governors(struct sysdev_class *class, | 24 | static ssize_t show_available_governors(struct sysdev_class *class, |
| 25 | struct sysdev_class_attribute *attr, | ||
| 25 | char *buf) | 26 | char *buf) |
| 26 | { | 27 | { |
| 27 | ssize_t i = 0; | 28 | ssize_t i = 0; |
| @@ -41,6 +42,7 @@ out: | |||
| 41 | } | 42 | } |
| 42 | 43 | ||
| 43 | static ssize_t show_current_driver(struct sysdev_class *class, | 44 | static ssize_t show_current_driver(struct sysdev_class *class, |
| 45 | struct sysdev_class_attribute *attr, | ||
| 44 | char *buf) | 46 | char *buf) |
| 45 | { | 47 | { |
| 46 | ssize_t ret; | 48 | ssize_t ret; |
| @@ -56,6 +58,7 @@ static ssize_t show_current_driver(struct sysdev_class *class, | |||
| 56 | } | 58 | } |
| 57 | 59 | ||
| 58 | static ssize_t show_current_governor(struct sysdev_class *class, | 60 | static ssize_t show_current_governor(struct sysdev_class *class, |
| 61 | struct sysdev_class_attribute *attr, | ||
| 59 | char *buf) | 62 | char *buf) |
| 60 | { | 63 | { |
| 61 | ssize_t ret; | 64 | ssize_t ret; |
| @@ -71,6 +74,7 @@ static ssize_t show_current_governor(struct sysdev_class *class, | |||
| 71 | } | 74 | } |
| 72 | 75 | ||
| 73 | static ssize_t store_current_governor(struct sysdev_class *class, | 76 | static ssize_t store_current_governor(struct sysdev_class *class, |
| 77 | struct sysdev_class_attribute *attr, | ||
| 74 | const char *buf, size_t count) | 78 | const char *buf, size_t count) |
| 75 | { | 79 | { |
| 76 | char gov_name[CPUIDLE_NAME_LEN]; | 80 | char gov_name[CPUIDLE_NAME_LEN]; |
| @@ -191,7 +195,7 @@ static ssize_t cpuidle_store(struct kobject * kobj, struct attribute * attr, | |||
| 191 | return ret; | 195 | return ret; |
| 192 | } | 196 | } |
| 193 | 197 | ||
| 194 | static struct sysfs_ops cpuidle_sysfs_ops = { | 198 | static const struct sysfs_ops cpuidle_sysfs_ops = { |
| 195 | .show = cpuidle_show, | 199 | .show = cpuidle_show, |
| 196 | .store = cpuidle_store, | 200 | .store = cpuidle_store, |
| 197 | }; | 201 | }; |
| @@ -277,7 +281,7 @@ static ssize_t cpuidle_state_show(struct kobject * kobj, | |||
| 277 | return ret; | 281 | return ret; |
| 278 | } | 282 | } |
| 279 | 283 | ||
| 280 | static struct sysfs_ops cpuidle_state_sysfs_ops = { | 284 | static const struct sysfs_ops cpuidle_state_sysfs_ops = { |
| 281 | .show = cpuidle_state_show, | 285 | .show = cpuidle_state_show, |
| 282 | }; | 286 | }; |
| 283 | 287 | ||
diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c index af14c9a5b8d4..0099340b9616 100644 --- a/drivers/dma/ioat/dma.c +++ b/drivers/dma/ioat/dma.c | |||
| @@ -1138,7 +1138,7 @@ ioat_attr_show(struct kobject *kobj, struct attribute *attr, char *page) | |||
| 1138 | return entry->show(&chan->common, page); | 1138 | return entry->show(&chan->common, page); |
| 1139 | } | 1139 | } |
| 1140 | 1140 | ||
| 1141 | struct sysfs_ops ioat_sysfs_ops = { | 1141 | const struct sysfs_ops ioat_sysfs_ops = { |
| 1142 | .show = ioat_attr_show, | 1142 | .show = ioat_attr_show, |
| 1143 | }; | 1143 | }; |
| 1144 | 1144 | ||
diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h index 4f747a254074..86b97ac8774e 100644 --- a/drivers/dma/ioat/dma.h +++ b/drivers/dma/ioat/dma.h | |||
| @@ -346,7 +346,7 @@ bool ioat_cleanup_preamble(struct ioat_chan_common *chan, | |||
| 346 | unsigned long *phys_complete); | 346 | unsigned long *phys_complete); |
| 347 | void ioat_kobject_add(struct ioatdma_device *device, struct kobj_type *type); | 347 | void ioat_kobject_add(struct ioatdma_device *device, struct kobj_type *type); |
| 348 | void ioat_kobject_del(struct ioatdma_device *device); | 348 | void ioat_kobject_del(struct ioatdma_device *device); |
| 349 | extern struct sysfs_ops ioat_sysfs_ops; | 349 | extern const struct sysfs_ops ioat_sysfs_ops; |
| 350 | extern struct ioat_sysfs_entry ioat_version_attr; | 350 | extern struct ioat_sysfs_entry ioat_version_attr; |
| 351 | extern struct ioat_sysfs_entry ioat_cap_attr; | 351 | extern struct ioat_sysfs_entry ioat_cap_attr; |
| 352 | #endif /* IOATDMA_H */ | 352 | #endif /* IOATDMA_H */ |
diff --git a/drivers/edac/edac_device_sysfs.c b/drivers/edac/edac_device_sysfs.c index 53764577035f..5fdedbc0f545 100644 --- a/drivers/edac/edac_device_sysfs.c +++ b/drivers/edac/edac_device_sysfs.c | |||
| @@ -137,7 +137,7 @@ static ssize_t edac_dev_ctl_info_store(struct kobject *kobj, | |||
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | /* edac_dev file operations for an 'ctl_info' */ | 139 | /* edac_dev file operations for an 'ctl_info' */ |
| 140 | static struct sysfs_ops device_ctl_info_ops = { | 140 | static const struct sysfs_ops device_ctl_info_ops = { |
| 141 | .show = edac_dev_ctl_info_show, | 141 | .show = edac_dev_ctl_info_show, |
| 142 | .store = edac_dev_ctl_info_store | 142 | .store = edac_dev_ctl_info_store |
| 143 | }; | 143 | }; |
| @@ -373,7 +373,7 @@ static ssize_t edac_dev_instance_store(struct kobject *kobj, | |||
| 373 | } | 373 | } |
| 374 | 374 | ||
| 375 | /* edac_dev file operations for an 'instance' */ | 375 | /* edac_dev file operations for an 'instance' */ |
| 376 | static struct sysfs_ops device_instance_ops = { | 376 | static const struct sysfs_ops device_instance_ops = { |
| 377 | .show = edac_dev_instance_show, | 377 | .show = edac_dev_instance_show, |
| 378 | .store = edac_dev_instance_store | 378 | .store = edac_dev_instance_store |
| 379 | }; | 379 | }; |
| @@ -476,7 +476,7 @@ static ssize_t edac_dev_block_store(struct kobject *kobj, | |||
| 476 | } | 476 | } |
| 477 | 477 | ||
| 478 | /* edac_dev file operations for a 'block' */ | 478 | /* edac_dev file operations for a 'block' */ |
| 479 | static struct sysfs_ops device_block_ops = { | 479 | static const struct sysfs_ops device_block_ops = { |
| 480 | .show = edac_dev_block_show, | 480 | .show = edac_dev_block_show, |
| 481 | .store = edac_dev_block_store | 481 | .store = edac_dev_block_store |
| 482 | }; | 482 | }; |
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c index e1d4ce083481..88840e9fa3e0 100644 --- a/drivers/edac/edac_mc_sysfs.c +++ b/drivers/edac/edac_mc_sysfs.c | |||
| @@ -245,7 +245,7 @@ static ssize_t csrowdev_store(struct kobject *kobj, struct attribute *attr, | |||
| 245 | return -EIO; | 245 | return -EIO; |
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | static struct sysfs_ops csrowfs_ops = { | 248 | static const struct sysfs_ops csrowfs_ops = { |
| 249 | .show = csrowdev_show, | 249 | .show = csrowdev_show, |
| 250 | .store = csrowdev_store | 250 | .store = csrowdev_store |
| 251 | }; | 251 | }; |
| @@ -575,7 +575,7 @@ static ssize_t mcidev_store(struct kobject *kobj, struct attribute *attr, | |||
| 575 | } | 575 | } |
| 576 | 576 | ||
| 577 | /* Intermediate show/store table */ | 577 | /* Intermediate show/store table */ |
| 578 | static struct sysfs_ops mci_ops = { | 578 | static const struct sysfs_ops mci_ops = { |
| 579 | .show = mcidev_show, | 579 | .show = mcidev_show, |
| 580 | .store = mcidev_store | 580 | .store = mcidev_store |
| 581 | }; | 581 | }; |
diff --git a/drivers/edac/edac_pci_sysfs.c b/drivers/edac/edac_pci_sysfs.c index fb60a877d768..bef94e3d9944 100644 --- a/drivers/edac/edac_pci_sysfs.c +++ b/drivers/edac/edac_pci_sysfs.c | |||
| @@ -121,7 +121,7 @@ static ssize_t edac_pci_instance_store(struct kobject *kobj, | |||
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | /* fs_ops table */ | 123 | /* fs_ops table */ |
| 124 | static struct sysfs_ops pci_instance_ops = { | 124 | static const struct sysfs_ops pci_instance_ops = { |
| 125 | .show = edac_pci_instance_show, | 125 | .show = edac_pci_instance_show, |
| 126 | .store = edac_pci_instance_store | 126 | .store = edac_pci_instance_store |
| 127 | }; | 127 | }; |
| @@ -261,7 +261,7 @@ static ssize_t edac_pci_dev_store(struct kobject *kobj, | |||
| 261 | return -EIO; | 261 | return -EIO; |
| 262 | } | 262 | } |
| 263 | 263 | ||
| 264 | static struct sysfs_ops edac_pci_sysfs_ops = { | 264 | static const struct sysfs_ops edac_pci_sysfs_ops = { |
| 265 | .show = edac_pci_dev_show, | 265 | .show = edac_pci_dev_show, |
| 266 | .store = edac_pci_dev_store | 266 | .store = edac_pci_dev_store |
| 267 | }; | 267 | }; |
diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c index 014cabd3afda..5db0518c66da 100644 --- a/drivers/firewire/core-device.c +++ b/drivers/firewire/core-device.c | |||
| @@ -33,7 +33,6 @@ | |||
| 33 | #include <linux/module.h> | 33 | #include <linux/module.h> |
| 34 | #include <linux/mutex.h> | 34 | #include <linux/mutex.h> |
| 35 | #include <linux/rwsem.h> | 35 | #include <linux/rwsem.h> |
| 36 | #include <linux/semaphore.h> | ||
| 37 | #include <linux/spinlock.h> | 36 | #include <linux/spinlock.h> |
| 38 | #include <linux/string.h> | 37 | #include <linux/string.h> |
| 39 | #include <linux/workqueue.h> | 38 | #include <linux/workqueue.h> |
| @@ -828,9 +827,9 @@ static int update_unit(struct device *dev, void *data) | |||
| 828 | struct fw_driver *driver = (struct fw_driver *)dev->driver; | 827 | struct fw_driver *driver = (struct fw_driver *)dev->driver; |
| 829 | 828 | ||
| 830 | if (is_fw_unit(dev) && driver != NULL && driver->update != NULL) { | 829 | if (is_fw_unit(dev) && driver != NULL && driver->update != NULL) { |
| 831 | down(&dev->sem); | 830 | device_lock(dev); |
| 832 | driver->update(unit); | 831 | driver->update(unit); |
| 833 | up(&dev->sem); | 832 | device_unlock(dev); |
| 834 | } | 833 | } |
| 835 | 834 | ||
| 836 | return 0; | 835 | return 0; |
diff --git a/drivers/firmware/edd.c b/drivers/firmware/edd.c index 9e4f59dc7f1e..110e24e50883 100644 --- a/drivers/firmware/edd.c +++ b/drivers/firmware/edd.c | |||
| @@ -122,7 +122,7 @@ edd_attr_show(struct kobject * kobj, struct attribute *attr, char *buf) | |||
| 122 | return ret; | 122 | return ret; |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | static struct sysfs_ops edd_attr_ops = { | 125 | static const struct sysfs_ops edd_attr_ops = { |
| 126 | .show = edd_attr_show, | 126 | .show = edd_attr_show, |
| 127 | }; | 127 | }; |
| 128 | 128 | ||
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index f4f709d1370b..082f06ecd327 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c | |||
| @@ -362,7 +362,7 @@ static ssize_t efivar_attr_store(struct kobject *kobj, struct attribute *attr, | |||
| 362 | return ret; | 362 | return ret; |
| 363 | } | 363 | } |
| 364 | 364 | ||
| 365 | static struct sysfs_ops efivar_attr_ops = { | 365 | static const struct sysfs_ops efivar_attr_ops = { |
| 366 | .show = efivar_attr_show, | 366 | .show = efivar_attr_show, |
| 367 | .store = efivar_attr_store, | 367 | .store = efivar_attr_store, |
| 368 | }; | 368 | }; |
diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c index a3600e3ed0fa..ed2801c378de 100644 --- a/drivers/firmware/iscsi_ibft.c +++ b/drivers/firmware/iscsi_ibft.c | |||
| @@ -519,7 +519,7 @@ static ssize_t ibft_show_attribute(struct kobject *kobj, | |||
| 519 | return ret; | 519 | return ret; |
| 520 | } | 520 | } |
| 521 | 521 | ||
| 522 | static struct sysfs_ops ibft_attr_ops = { | 522 | static const struct sysfs_ops ibft_attr_ops = { |
| 523 | .show = ibft_show_attribute, | 523 | .show = ibft_show_attribute, |
| 524 | }; | 524 | }; |
| 525 | 525 | ||
diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c index 20f645743ead..d59f7cad2269 100644 --- a/drivers/firmware/memmap.c +++ b/drivers/firmware/memmap.c | |||
| @@ -74,7 +74,7 @@ static struct attribute *def_attrs[] = { | |||
| 74 | NULL | 74 | NULL |
| 75 | }; | 75 | }; |
| 76 | 76 | ||
| 77 | static struct sysfs_ops memmap_attr_ops = { | 77 | static const struct sysfs_ops memmap_attr_ops = { |
| 78 | .show = memmap_attr_show, | 78 | .show = memmap_attr_show, |
| 79 | }; | 79 | }; |
| 80 | 80 | ||
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 9006fdb26fea..6d1b86661e63 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
| @@ -623,7 +623,9 @@ static const struct attribute_group gpiochip_attr_group = { | |||
| 623 | * /sys/class/gpio/unexport ... write-only | 623 | * /sys/class/gpio/unexport ... write-only |
| 624 | * integer N ... number of GPIO to unexport | 624 | * integer N ... number of GPIO to unexport |
| 625 | */ | 625 | */ |
| 626 | static ssize_t export_store(struct class *class, const char *buf, size_t len) | 626 | static ssize_t export_store(struct class *class, |
| 627 | struct class_attribute *attr, | ||
| 628 | const char *buf, size_t len) | ||
| 627 | { | 629 | { |
| 628 | long gpio; | 630 | long gpio; |
| 629 | int status; | 631 | int status; |
| @@ -653,7 +655,9 @@ done: | |||
| 653 | return status ? : len; | 655 | return status ? : len; |
| 654 | } | 656 | } |
| 655 | 657 | ||
| 656 | static ssize_t unexport_store(struct class *class, const char *buf, size_t len) | 658 | static ssize_t unexport_store(struct class *class, |
| 659 | struct class_attribute *attr, | ||
| 660 | const char *buf, size_t len) | ||
| 657 | { | 661 | { |
| 658 | long gpio; | 662 | long gpio; |
| 659 | int status; | 663 | int status; |
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index 7e42b7e9d43a..014ce24761b9 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c | |||
| @@ -70,19 +70,17 @@ static int drm_class_resume(struct device *dev) | |||
| 70 | return 0; | 70 | return 0; |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | /* Display the version of drm_core. This doesn't work right in current design */ | ||
| 74 | static ssize_t version_show(struct class *dev, char *buf) | ||
| 75 | { | ||
| 76 | return sprintf(buf, "%s %d.%d.%d %s\n", CORE_NAME, CORE_MAJOR, | ||
| 77 | CORE_MINOR, CORE_PATCHLEVEL, CORE_DATE); | ||
| 78 | } | ||
| 79 | |||
| 80 | static char *drm_devnode(struct device *dev, mode_t *mode) | 73 | static char *drm_devnode(struct device *dev, mode_t *mode) |
| 81 | { | 74 | { |
| 82 | return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev)); | 75 | return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev)); |
| 83 | } | 76 | } |
| 84 | 77 | ||
| 85 | static CLASS_ATTR(version, S_IRUGO, version_show, NULL); | 78 | static CLASS_ATTR_STRING(version, S_IRUGO, |
| 79 | CORE_NAME " " | ||
| 80 | __stringify(CORE_MAJOR) "." | ||
| 81 | __stringify(CORE_MINOR) "." | ||
| 82 | __stringify(CORE_PATCHLEVEL) " " | ||
| 83 | CORE_DATE); | ||
| 86 | 84 | ||
| 87 | /** | 85 | /** |
| 88 | * drm_sysfs_create - create a struct drm_sysfs_class structure | 86 | * drm_sysfs_create - create a struct drm_sysfs_class structure |
| @@ -109,7 +107,7 @@ struct class *drm_sysfs_create(struct module *owner, char *name) | |||
| 109 | class->suspend = drm_class_suspend; | 107 | class->suspend = drm_class_suspend; |
| 110 | class->resume = drm_class_resume; | 108 | class->resume = drm_class_resume; |
| 111 | 109 | ||
| 112 | err = class_create_file(class, &class_attr_version); | 110 | err = class_create_file(class, &class_attr_version.attr); |
| 113 | if (err) | 111 | if (err) |
| 114 | goto err_out_class; | 112 | goto err_out_class; |
| 115 | 113 | ||
| @@ -132,7 +130,7 @@ void drm_sysfs_destroy(void) | |||
| 132 | { | 130 | { |
| 133 | if ((drm_class == NULL) || (IS_ERR(drm_class))) | 131 | if ((drm_class == NULL) || (IS_ERR(drm_class))) |
| 134 | return; | 132 | return; |
| 135 | class_remove_file(drm_class, &class_attr_version); | 133 | class_remove_file(drm_class, &class_attr_version.attr); |
| 136 | class_destroy(drm_class); | 134 | class_destroy(drm_class); |
| 137 | } | 135 | } |
| 138 | 136 | ||
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index c7320ce4567d..89c38c49066f 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
| @@ -128,7 +128,7 @@ static struct attribute *ttm_bo_global_attrs[] = { | |||
| 128 | NULL | 128 | NULL |
| 129 | }; | 129 | }; |
| 130 | 130 | ||
| 131 | static struct sysfs_ops ttm_bo_global_ops = { | 131 | static const struct sysfs_ops ttm_bo_global_ops = { |
| 132 | .show = &ttm_bo_global_show | 132 | .show = &ttm_bo_global_show |
| 133 | }; | 133 | }; |
| 134 | 134 | ||
diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c index f5245c02b8fd..eb143e04d402 100644 --- a/drivers/gpu/drm/ttm/ttm_memory.c +++ b/drivers/gpu/drm/ttm/ttm_memory.c | |||
| @@ -152,7 +152,7 @@ static struct attribute *ttm_mem_zone_attrs[] = { | |||
| 152 | NULL | 152 | NULL |
| 153 | }; | 153 | }; |
| 154 | 154 | ||
| 155 | static struct sysfs_ops ttm_mem_zone_ops = { | 155 | static const struct sysfs_ops ttm_mem_zone_ops = { |
| 156 | .show = &ttm_mem_zone_show, | 156 | .show = &ttm_mem_zone_show, |
| 157 | .store = &ttm_mem_zone_store | 157 | .store = &ttm_mem_zone_store |
| 158 | }; | 158 | }; |
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 913abd7c172f..c7c237537f81 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
| @@ -850,7 +850,7 @@ static const struct i2c_algorithm omap_i2c_algo = { | |||
| 850 | .functionality = omap_i2c_func, | 850 | .functionality = omap_i2c_func, |
| 851 | }; | 851 | }; |
| 852 | 852 | ||
| 853 | static int __init | 853 | static int __devinit |
| 854 | omap_i2c_probe(struct platform_device *pdev) | 854 | omap_i2c_probe(struct platform_device *pdev) |
| 855 | { | 855 | { |
| 856 | struct omap_i2c_dev *dev; | 856 | struct omap_i2c_dev *dev; |
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c index 5122b5a8aa2d..18350213479e 100644 --- a/drivers/ieee1394/nodemgr.c +++ b/drivers/ieee1394/nodemgr.c | |||
| @@ -19,7 +19,6 @@ | |||
| 19 | #include <linux/moduleparam.h> | 19 | #include <linux/moduleparam.h> |
| 20 | #include <linux/mutex.h> | 20 | #include <linux/mutex.h> |
| 21 | #include <linux/freezer.h> | 21 | #include <linux/freezer.h> |
| 22 | #include <linux/semaphore.h> | ||
| 23 | #include <asm/atomic.h> | 22 | #include <asm/atomic.h> |
| 24 | 23 | ||
| 25 | #include "csr.h" | 24 | #include "csr.h" |
| @@ -1397,9 +1396,9 @@ static int update_pdrv(struct device *dev, void *data) | |||
| 1397 | pdrv = container_of(drv, struct hpsb_protocol_driver, | 1396 | pdrv = container_of(drv, struct hpsb_protocol_driver, |
| 1398 | driver); | 1397 | driver); |
| 1399 | if (pdrv->update) { | 1398 | if (pdrv->update) { |
| 1400 | down(&ud->device.sem); | 1399 | device_lock(&ud->device); |
| 1401 | error = pdrv->update(ud); | 1400 | error = pdrv->update(ud); |
| 1402 | up(&ud->device.sem); | 1401 | device_unlock(&ud->device); |
| 1403 | } | 1402 | } |
| 1404 | if (error) | 1403 | if (error) |
| 1405 | device_release_driver(&ud->device); | 1404 | device_release_driver(&ud->device); |
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index 5130fc55b8e2..764787ebe8d8 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c | |||
| @@ -3597,7 +3597,7 @@ static ssize_t cm_show_counter(struct kobject *obj, struct attribute *attr, | |||
| 3597 | atomic_long_read(&group->counter[cm_attr->index])); | 3597 | atomic_long_read(&group->counter[cm_attr->index])); |
| 3598 | } | 3598 | } |
| 3599 | 3599 | ||
| 3600 | static struct sysfs_ops cm_counter_ops = { | 3600 | static const struct sysfs_ops cm_counter_ops = { |
| 3601 | .show = cm_show_counter | 3601 | .show = cm_show_counter |
| 3602 | }; | 3602 | }; |
| 3603 | 3603 | ||
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index 158a214da2f7..1558bb7fc74d 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c | |||
| @@ -79,7 +79,7 @@ static ssize_t port_attr_show(struct kobject *kobj, | |||
| 79 | return port_attr->show(p, port_attr, buf); | 79 | return port_attr->show(p, port_attr, buf); |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | static struct sysfs_ops port_sysfs_ops = { | 82 | static const struct sysfs_ops port_sysfs_ops = { |
| 83 | .show = port_attr_show | 83 | .show = port_attr_show |
| 84 | }; | 84 | }; |
| 85 | 85 | ||
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c index 1b09b735c5a8..017d6e24448f 100644 --- a/drivers/infiniband/core/ucm.c +++ b/drivers/infiniband/core/ucm.c | |||
| @@ -1336,11 +1336,8 @@ static void ib_ucm_remove_one(struct ib_device *device) | |||
| 1336 | device_unregister(&ucm_dev->dev); | 1336 | device_unregister(&ucm_dev->dev); |
| 1337 | } | 1337 | } |
| 1338 | 1338 | ||
| 1339 | static ssize_t show_abi_version(struct class *class, char *buf) | 1339 | static CLASS_ATTR_STRING(abi_version, S_IRUGO, |
| 1340 | { | 1340 | __stringify(IB_USER_CM_ABI_VERSION)); |
| 1341 | return sprintf(buf, "%d\n", IB_USER_CM_ABI_VERSION); | ||
| 1342 | } | ||
| 1343 | static CLASS_ATTR(abi_version, S_IRUGO, show_abi_version, NULL); | ||
| 1344 | 1341 | ||
| 1345 | static int __init ib_ucm_init(void) | 1342 | static int __init ib_ucm_init(void) |
| 1346 | { | 1343 | { |
| @@ -1353,7 +1350,7 @@ static int __init ib_ucm_init(void) | |||
| 1353 | goto error1; | 1350 | goto error1; |
| 1354 | } | 1351 | } |
| 1355 | 1352 | ||
| 1356 | ret = class_create_file(&cm_class, &class_attr_abi_version); | 1353 | ret = class_create_file(&cm_class, &class_attr_abi_version.attr); |
| 1357 | if (ret) { | 1354 | if (ret) { |
| 1358 | printk(KERN_ERR "ucm: couldn't create abi_version attribute\n"); | 1355 | printk(KERN_ERR "ucm: couldn't create abi_version attribute\n"); |
| 1359 | goto error2; | 1356 | goto error2; |
| @@ -1367,7 +1364,7 @@ static int __init ib_ucm_init(void) | |||
| 1367 | return 0; | 1364 | return 0; |
| 1368 | 1365 | ||
| 1369 | error3: | 1366 | error3: |
| 1370 | class_remove_file(&cm_class, &class_attr_abi_version); | 1367 | class_remove_file(&cm_class, &class_attr_abi_version.attr); |
| 1371 | error2: | 1368 | error2: |
| 1372 | unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_MAX_DEVICES); | 1369 | unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_MAX_DEVICES); |
| 1373 | error1: | 1370 | error1: |
| @@ -1377,7 +1374,7 @@ error1: | |||
| 1377 | static void __exit ib_ucm_cleanup(void) | 1374 | static void __exit ib_ucm_cleanup(void) |
| 1378 | { | 1375 | { |
| 1379 | ib_unregister_client(&ucm_client); | 1376 | ib_unregister_client(&ucm_client); |
| 1380 | class_remove_file(&cm_class, &class_attr_abi_version); | 1377 | class_remove_file(&cm_class, &class_attr_abi_version.attr); |
| 1381 | unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_MAX_DEVICES); | 1378 | unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_MAX_DEVICES); |
| 1382 | if (overflow_maj) | 1379 | if (overflow_maj) |
| 1383 | unregister_chrdev_region(overflow_maj, IB_UCM_MAX_DEVICES); | 1380 | unregister_chrdev_region(overflow_maj, IB_UCM_MAX_DEVICES); |
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index 02d360cfc2f7..04b585e86cb2 100644 --- a/drivers/infiniband/core/user_mad.c +++ b/drivers/infiniband/core/user_mad.c | |||
| @@ -965,11 +965,8 @@ static ssize_t show_port(struct device *dev, struct device_attribute *attr, | |||
| 965 | } | 965 | } |
| 966 | static DEVICE_ATTR(port, S_IRUGO, show_port, NULL); | 966 | static DEVICE_ATTR(port, S_IRUGO, show_port, NULL); |
| 967 | 967 | ||
| 968 | static ssize_t show_abi_version(struct class *class, char *buf) | 968 | static CLASS_ATTR_STRING(abi_version, S_IRUGO, |
| 969 | { | 969 | __stringify(IB_USER_MAD_ABI_VERSION)); |
| 970 | return sprintf(buf, "%d\n", IB_USER_MAD_ABI_VERSION); | ||
| 971 | } | ||
| 972 | static CLASS_ATTR(abi_version, S_IRUGO, show_abi_version, NULL); | ||
| 973 | 970 | ||
| 974 | static dev_t overflow_maj; | 971 | static dev_t overflow_maj; |
| 975 | static DECLARE_BITMAP(overflow_map, IB_UMAD_MAX_PORTS); | 972 | static DECLARE_BITMAP(overflow_map, IB_UMAD_MAX_PORTS); |
| @@ -1194,7 +1191,7 @@ static int __init ib_umad_init(void) | |||
| 1194 | goto out_chrdev; | 1191 | goto out_chrdev; |
| 1195 | } | 1192 | } |
| 1196 | 1193 | ||
| 1197 | ret = class_create_file(umad_class, &class_attr_abi_version); | 1194 | ret = class_create_file(umad_class, &class_attr_abi_version.attr); |
| 1198 | if (ret) { | 1195 | if (ret) { |
| 1199 | printk(KERN_ERR "user_mad: couldn't create abi_version attribute\n"); | 1196 | printk(KERN_ERR "user_mad: couldn't create abi_version attribute\n"); |
| 1200 | goto out_class; | 1197 | goto out_class; |
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index 4fa2e6516441..d805cf365c8d 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c | |||
| @@ -691,11 +691,8 @@ static ssize_t show_dev_abi_version(struct device *device, | |||
| 691 | } | 691 | } |
| 692 | static DEVICE_ATTR(abi_version, S_IRUGO, show_dev_abi_version, NULL); | 692 | static DEVICE_ATTR(abi_version, S_IRUGO, show_dev_abi_version, NULL); |
| 693 | 693 | ||
| 694 | static ssize_t show_abi_version(struct class *class, char *buf) | 694 | static CLASS_ATTR_STRING(abi_version, S_IRUGO, |
| 695 | { | 695 | __stringify(IB_USER_VERBS_ABI_VERSION)); |
| 696 | return sprintf(buf, "%d\n", IB_USER_VERBS_ABI_VERSION); | ||
| 697 | } | ||
| 698 | static CLASS_ATTR(abi_version, S_IRUGO, show_abi_version, NULL); | ||
| 699 | 696 | ||
| 700 | static dev_t overflow_maj; | 697 | static dev_t overflow_maj; |
| 701 | static DECLARE_BITMAP(overflow_map, IB_UVERBS_MAX_DEVICES); | 698 | static DECLARE_BITMAP(overflow_map, IB_UVERBS_MAX_DEVICES); |
| @@ -841,7 +838,7 @@ static int __init ib_uverbs_init(void) | |||
| 841 | goto out_chrdev; | 838 | goto out_chrdev; |
| 842 | } | 839 | } |
| 843 | 840 | ||
| 844 | ret = class_create_file(uverbs_class, &class_attr_abi_version); | 841 | ret = class_create_file(uverbs_class, &class_attr_abi_version.attr); |
| 845 | if (ret) { | 842 | if (ret) { |
| 846 | printk(KERN_ERR "user_verbs: couldn't create abi_version attribute\n"); | 843 | printk(KERN_ERR "user_verbs: couldn't create abi_version attribute\n"); |
| 847 | goto out_class; | 844 | goto out_class; |
diff --git a/drivers/macintosh/windfarm_core.c b/drivers/macintosh/windfarm_core.c index 437f55c5d18d..419795f4a2aa 100644 --- a/drivers/macintosh/windfarm_core.c +++ b/drivers/macintosh/windfarm_core.c | |||
| @@ -321,6 +321,7 @@ int wf_register_sensor(struct wf_sensor *new_sr) | |||
| 321 | kref_init(&new_sr->ref); | 321 | kref_init(&new_sr->ref); |
| 322 | list_add(&new_sr->link, &wf_sensors); | 322 | list_add(&new_sr->link, &wf_sensors); |
| 323 | 323 | ||
| 324 | sysfs_attr_init(&new_sr->attr.attr); | ||
| 324 | new_sr->attr.attr.name = new_sr->name; | 325 | new_sr->attr.attr.name = new_sr->name; |
| 325 | new_sr->attr.attr.mode = 0444; | 326 | new_sr->attr.attr.mode = 0444; |
| 326 | new_sr->attr.show = wf_show_sensor; | 327 | new_sr->attr.show = wf_show_sensor; |
diff --git a/drivers/macintosh/windfarm_smu_controls.c b/drivers/macintosh/windfarm_smu_controls.c index 6c68b9e5f5c4..43137b421f92 100644 --- a/drivers/macintosh/windfarm_smu_controls.c +++ b/drivers/macintosh/windfarm_smu_controls.c | |||
| @@ -173,6 +173,7 @@ static struct smu_fan_control *smu_fan_create(struct device_node *node, | |||
| 173 | 173 | ||
| 174 | fct->fan_type = pwm_fan; | 174 | fct->fan_type = pwm_fan; |
| 175 | fct->ctrl.type = pwm_fan ? WF_CONTROL_PWM_FAN : WF_CONTROL_RPM_FAN; | 175 | fct->ctrl.type = pwm_fan ? WF_CONTROL_PWM_FAN : WF_CONTROL_RPM_FAN; |
| 176 | sysfs_attr_init(&fct->ctrl.attr.attr); | ||
| 176 | 177 | ||
| 177 | /* We use the name & location here the same way we do for SMU sensors, | 178 | /* We use the name & location here the same way we do for SMU sensors, |
| 178 | * see the comment in windfarm_smu_sensors.c. The locations are a bit | 179 | * see the comment in windfarm_smu_sensors.c. The locations are a bit |
diff --git a/drivers/md/dm-sysfs.c b/drivers/md/dm-sysfs.c index f91b40942e07..84d2b91e4efb 100644 --- a/drivers/md/dm-sysfs.c +++ b/drivers/md/dm-sysfs.c | |||
| @@ -75,7 +75,7 @@ static struct attribute *dm_attrs[] = { | |||
| 75 | NULL, | 75 | NULL, |
| 76 | }; | 76 | }; |
| 77 | 77 | ||
| 78 | static struct sysfs_ops dm_sysfs_ops = { | 78 | static const struct sysfs_ops dm_sysfs_ops = { |
| 79 | .show = dm_attr_show, | 79 | .show = dm_attr_show, |
| 80 | }; | 80 | }; |
| 81 | 81 | ||
diff --git a/drivers/md/md.c b/drivers/md/md.c index a20a71e5efd3..fdc1890b6ac5 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
| @@ -2642,7 +2642,7 @@ static void rdev_free(struct kobject *ko) | |||
| 2642 | mdk_rdev_t *rdev = container_of(ko, mdk_rdev_t, kobj); | 2642 | mdk_rdev_t *rdev = container_of(ko, mdk_rdev_t, kobj); |
| 2643 | kfree(rdev); | 2643 | kfree(rdev); |
| 2644 | } | 2644 | } |
| 2645 | static struct sysfs_ops rdev_sysfs_ops = { | 2645 | static const struct sysfs_ops rdev_sysfs_ops = { |
| 2646 | .show = rdev_attr_show, | 2646 | .show = rdev_attr_show, |
| 2647 | .store = rdev_attr_store, | 2647 | .store = rdev_attr_store, |
| 2648 | }; | 2648 | }; |
| @@ -4059,7 +4059,7 @@ static void md_free(struct kobject *ko) | |||
| 4059 | kfree(mddev); | 4059 | kfree(mddev); |
| 4060 | } | 4060 | } |
| 4061 | 4061 | ||
| 4062 | static struct sysfs_ops md_sysfs_ops = { | 4062 | static const struct sysfs_ops md_sysfs_ops = { |
| 4063 | .show = md_attr_show, | 4063 | .show = md_attr_show, |
| 4064 | .store = md_attr_store, | 4064 | .store = md_attr_store, |
| 4065 | }; | 4065 | }; |
diff --git a/drivers/media/video/omap24xxcam.c b/drivers/media/video/omap24xxcam.c index 7400eacb4d64..142c327afb32 100644 --- a/drivers/media/video/omap24xxcam.c +++ b/drivers/media/video/omap24xxcam.c | |||
| @@ -1735,7 +1735,7 @@ static struct v4l2_int_device omap24xxcam = { | |||
| 1735 | * | 1735 | * |
| 1736 | */ | 1736 | */ |
| 1737 | 1737 | ||
| 1738 | static int __init omap24xxcam_probe(struct platform_device *pdev) | 1738 | static int __devinit omap24xxcam_probe(struct platform_device *pdev) |
| 1739 | { | 1739 | { |
| 1740 | struct omap24xxcam_device *cam; | 1740 | struct omap24xxcam_device *cam; |
| 1741 | struct resource *mem; | 1741 | struct resource *mem; |
diff --git a/drivers/misc/phantom.c b/drivers/misc/phantom.c index 04c27266f567..779aa8ebe4cf 100644 --- a/drivers/misc/phantom.c +++ b/drivers/misc/phantom.c | |||
| @@ -497,12 +497,7 @@ static struct pci_driver phantom_pci_driver = { | |||
| 497 | .resume = phantom_resume | 497 | .resume = phantom_resume |
| 498 | }; | 498 | }; |
| 499 | 499 | ||
| 500 | static ssize_t phantom_show_version(struct class *cls, char *buf) | 500 | static CLASS_ATTR_STRING(version, 0444, PHANTOM_VERSION); |
| 501 | { | ||
| 502 | return sprintf(buf, PHANTOM_VERSION "\n"); | ||
| 503 | } | ||
| 504 | |||
| 505 | static CLASS_ATTR(version, 0444, phantom_show_version, NULL); | ||
| 506 | 501 | ||
| 507 | static int __init phantom_init(void) | 502 | static int __init phantom_init(void) |
| 508 | { | 503 | { |
| @@ -515,7 +510,7 @@ static int __init phantom_init(void) | |||
| 515 | printk(KERN_ERR "phantom: can't register phantom class\n"); | 510 | printk(KERN_ERR "phantom: can't register phantom class\n"); |
| 516 | goto err; | 511 | goto err; |
| 517 | } | 512 | } |
| 518 | retval = class_create_file(phantom_class, &class_attr_version); | 513 | retval = class_create_file(phantom_class, &class_attr_version.attr); |
| 519 | if (retval) { | 514 | if (retval) { |
| 520 | printk(KERN_ERR "phantom: can't create sysfs version file\n"); | 515 | printk(KERN_ERR "phantom: can't create sysfs version file\n"); |
| 521 | goto err_class; | 516 | goto err_class; |
| @@ -541,7 +536,7 @@ static int __init phantom_init(void) | |||
| 541 | err_unchr: | 536 | err_unchr: |
| 542 | unregister_chrdev_region(dev, PHANTOM_MAX_MINORS); | 537 | unregister_chrdev_region(dev, PHANTOM_MAX_MINORS); |
| 543 | err_attr: | 538 | err_attr: |
| 544 | class_remove_file(phantom_class, &class_attr_version); | 539 | class_remove_file(phantom_class, &class_attr_version.attr); |
| 545 | err_class: | 540 | err_class: |
| 546 | class_destroy(phantom_class); | 541 | class_destroy(phantom_class); |
| 547 | err: | 542 | err: |
| @@ -554,7 +549,7 @@ static void __exit phantom_exit(void) | |||
| 554 | 549 | ||
| 555 | unregister_chrdev_region(MKDEV(phantom_major, 0), PHANTOM_MAX_MINORS); | 550 | unregister_chrdev_region(MKDEV(phantom_major, 0), PHANTOM_MAX_MINORS); |
| 556 | 551 | ||
| 557 | class_remove_file(phantom_class, &class_attr_version); | 552 | class_remove_file(phantom_class, &class_attr_version.attr); |
| 558 | class_destroy(phantom_class); | 553 | class_destroy(phantom_class); |
| 559 | 554 | ||
| 560 | pr_debug("phantom: module successfully removed\n"); | 555 | pr_debug("phantom: module successfully removed\n"); |
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index bc45ef9af17d..fad40aa6f099 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c | |||
| @@ -89,7 +89,8 @@ DEFINE_MUTEX(ubi_devices_mutex); | |||
| 89 | static DEFINE_SPINLOCK(ubi_devices_lock); | 89 | static DEFINE_SPINLOCK(ubi_devices_lock); |
| 90 | 90 | ||
| 91 | /* "Show" method for files in '/<sysfs>/class/ubi/' */ | 91 | /* "Show" method for files in '/<sysfs>/class/ubi/' */ |
| 92 | static ssize_t ubi_version_show(struct class *class, char *buf) | 92 | static ssize_t ubi_version_show(struct class *class, struct class_attribute *attr, |
| 93 | char *buf) | ||
| 93 | { | 94 | { |
| 94 | return sprintf(buf, "%d\n", UBI_VERSION); | 95 | return sprintf(buf, "%d\n", UBI_VERSION); |
| 95 | } | 96 | } |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 5acd557cea9b..b8bec086daa1 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
| @@ -51,7 +51,9 @@ | |||
| 51 | * "show" function for the bond_masters attribute. | 51 | * "show" function for the bond_masters attribute. |
| 52 | * The class parameter is ignored. | 52 | * The class parameter is ignored. |
| 53 | */ | 53 | */ |
| 54 | static ssize_t bonding_show_bonds(struct class *cls, char *buf) | 54 | static ssize_t bonding_show_bonds(struct class *cls, |
| 55 | struct class_attribute *attr, | ||
| 56 | char *buf) | ||
| 55 | { | 57 | { |
| 56 | struct net *net = current->nsproxy->net_ns; | 58 | struct net *net = current->nsproxy->net_ns; |
| 57 | struct bond_net *bn = net_generic(net, bond_net_id); | 59 | struct bond_net *bn = net_generic(net, bond_net_id); |
| @@ -98,6 +100,7 @@ static struct net_device *bond_get_by_name(struct net *net, const char *ifname) | |||
| 98 | */ | 100 | */ |
| 99 | 101 | ||
| 100 | static ssize_t bonding_store_bonds(struct class *cls, | 102 | static ssize_t bonding_store_bonds(struct class *cls, |
| 103 | struct class_attribute *attr, | ||
| 101 | const char *buffer, size_t count) | 104 | const char *buffer, size_t count) |
| 102 | { | 105 | { |
| 103 | struct net *net = current->nsproxy->net_ns; | 106 | struct net *net = current->nsproxy->net_ns; |
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index f2b937966950..0bc777bac9b4 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
| @@ -1577,7 +1577,7 @@ static struct attribute * veth_pool_attrs[] = { | |||
| 1577 | NULL, | 1577 | NULL, |
| 1578 | }; | 1578 | }; |
| 1579 | 1579 | ||
| 1580 | static struct sysfs_ops veth_pool_ops = { | 1580 | static const struct sysfs_ops veth_pool_ops = { |
| 1581 | .show = veth_pool_show, | 1581 | .show = veth_pool_show, |
| 1582 | .store = veth_pool_store, | 1582 | .store = veth_pool_store, |
| 1583 | }; | 1583 | }; |
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c index 966de5d69521..e6e972d9b7ca 100644 --- a/drivers/net/iseries_veth.c +++ b/drivers/net/iseries_veth.c | |||
| @@ -384,7 +384,7 @@ static struct attribute *veth_cnx_default_attrs[] = { | |||
| 384 | NULL | 384 | NULL |
| 385 | }; | 385 | }; |
| 386 | 386 | ||
| 387 | static struct sysfs_ops veth_cnx_sysfs_ops = { | 387 | static const struct sysfs_ops veth_cnx_sysfs_ops = { |
| 388 | .show = veth_cnx_attribute_show | 388 | .show = veth_cnx_attribute_show |
| 389 | }; | 389 | }; |
| 390 | 390 | ||
| @@ -441,7 +441,7 @@ static struct attribute *veth_port_default_attrs[] = { | |||
| 441 | NULL | 441 | NULL |
| 442 | }; | 442 | }; |
| 443 | 443 | ||
| 444 | static struct sysfs_ops veth_port_sysfs_ops = { | 444 | static const struct sysfs_ops veth_port_sysfs_ops = { |
| 445 | .show = veth_port_attribute_show | 445 | .show = veth_port_attribute_show |
| 446 | }; | 446 | }; |
| 447 | 447 | ||
diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c index 0bc5d474b168..1062b8ffe244 100644 --- a/drivers/parisc/pdc_stable.c +++ b/drivers/parisc/pdc_stable.c | |||
| @@ -481,7 +481,7 @@ pdcspath_attr_store(struct kobject *kobj, struct attribute *attr, | |||
| 481 | return ret; | 481 | return ret; |
| 482 | } | 482 | } |
| 483 | 483 | ||
| 484 | static struct sysfs_ops pdcspath_attr_ops = { | 484 | static const struct sysfs_ops pdcspath_attr_ops = { |
| 485 | .show = pdcspath_attr_show, | 485 | .show = pdcspath_attr_show, |
| 486 | .store = pdcspath_attr_store, | 486 | .store = pdcspath_attr_store, |
| 487 | }; | 487 | }; |
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 712250f5874a..26301cb25e7f 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c | |||
| @@ -288,9 +288,9 @@ void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *), | |||
| 288 | next = dev->bus_list.next; | 288 | next = dev->bus_list.next; |
| 289 | 289 | ||
| 290 | /* Run device routines with the device locked */ | 290 | /* Run device routines with the device locked */ |
| 291 | down(&dev->dev.sem); | 291 | device_lock(&dev->dev); |
| 292 | retval = cb(dev, userdata); | 292 | retval = cb(dev, userdata); |
| 293 | up(&dev->dev.sem); | 293 | device_unlock(&dev->dev); |
| 294 | if (retval) | 294 | if (retval) |
| 295 | break; | 295 | break; |
| 296 | } | 296 | } |
diff --git a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c index 6151389fd903..0a894efd4b9b 100644 --- a/drivers/pci/hotplug/fakephp.c +++ b/drivers/pci/hotplug/fakephp.c | |||
| @@ -73,7 +73,7 @@ static void legacy_release(struct kobject *kobj) | |||
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | static struct kobj_type legacy_ktype = { | 75 | static struct kobj_type legacy_ktype = { |
| 76 | .sysfs_ops = &(struct sysfs_ops){ | 76 | .sysfs_ops = &(const struct sysfs_ops){ |
| 77 | .store = legacy_store, .show = legacy_show | 77 | .store = legacy_store, .show = legacy_show |
| 78 | }, | 78 | }, |
| 79 | .release = &legacy_release, | 79 | .release = &legacy_release, |
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 807224ec8351..de296452c957 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
| @@ -642,6 +642,7 @@ void pci_create_legacy_files(struct pci_bus *b) | |||
| 642 | if (!b->legacy_io) | 642 | if (!b->legacy_io) |
| 643 | goto kzalloc_err; | 643 | goto kzalloc_err; |
| 644 | 644 | ||
| 645 | sysfs_bin_attr_init(b->legacy_io); | ||
| 645 | b->legacy_io->attr.name = "legacy_io"; | 646 | b->legacy_io->attr.name = "legacy_io"; |
| 646 | b->legacy_io->size = 0xffff; | 647 | b->legacy_io->size = 0xffff; |
| 647 | b->legacy_io->attr.mode = S_IRUSR | S_IWUSR; | 648 | b->legacy_io->attr.mode = S_IRUSR | S_IWUSR; |
| @@ -654,6 +655,7 @@ void pci_create_legacy_files(struct pci_bus *b) | |||
| 654 | goto legacy_io_err; | 655 | goto legacy_io_err; |
| 655 | 656 | ||
| 656 | /* Allocated above after the legacy_io struct */ | 657 | /* Allocated above after the legacy_io struct */ |
| 658 | sysfs_bin_attr_init(b->legacy_mem); | ||
| 657 | b->legacy_mem = b->legacy_io + 1; | 659 | b->legacy_mem = b->legacy_io + 1; |
| 658 | b->legacy_mem->attr.name = "legacy_mem"; | 660 | b->legacy_mem->attr.name = "legacy_mem"; |
| 659 | b->legacy_mem->size = 1024*1024; | 661 | b->legacy_mem->size = 1024*1024; |
| @@ -800,6 +802,7 @@ static int pci_create_attr(struct pci_dev *pdev, int num, int write_combine) | |||
| 800 | if (res_attr) { | 802 | if (res_attr) { |
| 801 | char *res_attr_name = (char *)(res_attr + 1); | 803 | char *res_attr_name = (char *)(res_attr + 1); |
| 802 | 804 | ||
| 805 | sysfs_bin_attr_init(res_attr); | ||
| 803 | if (write_combine) { | 806 | if (write_combine) { |
| 804 | pdev->res_attr_wc[num] = res_attr; | 807 | pdev->res_attr_wc[num] = res_attr; |
| 805 | sprintf(res_attr_name, "resource%d_wc", num); | 808 | sprintf(res_attr_name, "resource%d_wc", num); |
| @@ -972,6 +975,7 @@ static int pci_create_capabilities_sysfs(struct pci_dev *dev) | |||
| 972 | if (!attr) | 975 | if (!attr) |
| 973 | return -ENOMEM; | 976 | return -ENOMEM; |
| 974 | 977 | ||
| 978 | sysfs_bin_attr_init(attr); | ||
| 975 | attr->size = dev->vpd->len; | 979 | attr->size = dev->vpd->len; |
| 976 | attr->attr.name = "vpd"; | 980 | attr->attr.name = "vpd"; |
| 977 | attr->attr.mode = S_IRUSR | S_IWUSR; | 981 | attr->attr.mode = S_IRUSR | S_IWUSR; |
| @@ -1038,6 +1042,7 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) | |||
| 1038 | retval = -ENOMEM; | 1042 | retval = -ENOMEM; |
| 1039 | goto err_resource_files; | 1043 | goto err_resource_files; |
| 1040 | } | 1044 | } |
| 1045 | sysfs_bin_attr_init(attr); | ||
| 1041 | attr->size = rom_size; | 1046 | attr->size = rom_size; |
| 1042 | attr->attr.name = "rom"; | 1047 | attr->attr.name = "rom"; |
| 1043 | attr->attr.mode = S_IRUSR; | 1048 | attr->attr.mode = S_IRUSR; |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 77b493b3d97b..897fa5ccdb78 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
| @@ -2486,7 +2486,7 @@ static int pci_dev_reset(struct pci_dev *dev, int probe) | |||
| 2486 | if (!probe) { | 2486 | if (!probe) { |
| 2487 | pci_block_user_cfg_access(dev); | 2487 | pci_block_user_cfg_access(dev); |
| 2488 | /* block PM suspend, driver probe, etc. */ | 2488 | /* block PM suspend, driver probe, etc. */ |
| 2489 | down(&dev->dev.sem); | 2489 | device_lock(&dev->dev); |
| 2490 | } | 2490 | } |
| 2491 | 2491 | ||
| 2492 | rc = pci_dev_specific_reset(dev, probe); | 2492 | rc = pci_dev_specific_reset(dev, probe); |
| @@ -2508,7 +2508,7 @@ static int pci_dev_reset(struct pci_dev *dev, int probe) | |||
| 2508 | rc = pci_parent_bus_reset(dev, probe); | 2508 | rc = pci_parent_bus_reset(dev, probe); |
| 2509 | done: | 2509 | done: |
| 2510 | if (!probe) { | 2510 | if (!probe) { |
| 2511 | up(&dev->dev.sem); | 2511 | device_unlock(&dev->dev); |
| 2512 | pci_unblock_user_cfg_access(dev); | 2512 | pci_unblock_user_cfg_access(dev); |
| 2513 | } | 2513 | } |
| 2514 | 2514 | ||
diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c index 49c9e6c9779a..f75a44d37fbe 100644 --- a/drivers/pci/slot.c +++ b/drivers/pci/slot.c | |||
| @@ -29,7 +29,7 @@ static ssize_t pci_slot_attr_store(struct kobject *kobj, | |||
| 29 | return attribute->store ? attribute->store(slot, buf, len) : -EIO; | 29 | return attribute->store ? attribute->store(slot, buf, len) : -EIO; |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | static struct sysfs_ops pci_slot_sysfs_ops = { | 32 | static const struct sysfs_ops pci_slot_sysfs_ops = { |
| 33 | .show = pci_slot_attr_show, | 33 | .show = pci_slot_attr_show, |
| 34 | .store = pci_slot_attr_store, | 34 | .store = pci_slot_attr_store, |
| 35 | }; | 35 | }; |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 0f98be4450b7..ad93ebd7b2a2 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
| @@ -971,9 +971,9 @@ static int runtime_suspend(struct device *dev) | |||
| 971 | { | 971 | { |
| 972 | int rc; | 972 | int rc; |
| 973 | 973 | ||
| 974 | down(&dev->sem); | 974 | device_lock(dev); |
| 975 | rc = pcmcia_dev_suspend(dev, PMSG_SUSPEND); | 975 | rc = pcmcia_dev_suspend(dev, PMSG_SUSPEND); |
| 976 | up(&dev->sem); | 976 | device_unlock(dev); |
| 977 | return rc; | 977 | return rc; |
| 978 | } | 978 | } |
| 979 | 979 | ||
| @@ -981,9 +981,9 @@ static int runtime_resume(struct device *dev) | |||
| 981 | { | 981 | { |
| 982 | int rc; | 982 | int rc; |
| 983 | 983 | ||
| 984 | down(&dev->sem); | 984 | device_lock(dev); |
| 985 | rc = pcmcia_dev_resume(dev); | 985 | rc = pcmcia_dev_resume(dev); |
| 986 | up(&dev->sem); | 986 | device_unlock(dev); |
| 987 | return rc; | 987 | return rc; |
| 988 | } | 988 | } |
| 989 | 989 | ||
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index cd2ee6fce1b4..e631dbeafd79 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig | |||
| @@ -150,6 +150,7 @@ config MSI_LAPTOP | |||
| 150 | tristate "MSI Laptop Extras" | 150 | tristate "MSI Laptop Extras" |
| 151 | depends on ACPI | 151 | depends on ACPI |
| 152 | depends on BACKLIGHT_CLASS_DEVICE | 152 | depends on BACKLIGHT_CLASS_DEVICE |
| 153 | depends on RFKILL | ||
| 153 | ---help--- | 154 | ---help--- |
| 154 | This is a driver for laptops built by MSI (MICRO-STAR | 155 | This is a driver for laptops built by MSI (MICRO-STAR |
| 155 | INTERNATIONAL): | 156 | INTERNATIONAL): |
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index 3aa57da8b43b..7ccf33c08967 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c | |||
| @@ -57,7 +57,7 @@ enum hp_wmi_radio { | |||
| 57 | HPWMI_WWAN = 2, | 57 | HPWMI_WWAN = 2, |
| 58 | }; | 58 | }; |
| 59 | 59 | ||
| 60 | static int __init hp_wmi_bios_setup(struct platform_device *device); | 60 | static int __devinit hp_wmi_bios_setup(struct platform_device *device); |
| 61 | static int __exit hp_wmi_bios_remove(struct platform_device *device); | 61 | static int __exit hp_wmi_bios_remove(struct platform_device *device); |
| 62 | static int hp_wmi_resume_handler(struct device *device); | 62 | static int hp_wmi_resume_handler(struct device *device); |
| 63 | 63 | ||
| @@ -447,7 +447,7 @@ static void cleanup_sysfs(struct platform_device *device) | |||
| 447 | device_remove_file(&device->dev, &dev_attr_tablet); | 447 | device_remove_file(&device->dev, &dev_attr_tablet); |
| 448 | } | 448 | } |
| 449 | 449 | ||
| 450 | static int __init hp_wmi_bios_setup(struct platform_device *device) | 450 | static int __devinit hp_wmi_bios_setup(struct platform_device *device) |
| 451 | { | 451 | { |
| 452 | int err; | 452 | int err; |
| 453 | int wireless = hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 0, 0); | 453 | int wireless = hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 0, 0); |
diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c index 759763d18e4c..c2b05da4289a 100644 --- a/drivers/platform/x86/msi-laptop.c +++ b/drivers/platform/x86/msi-laptop.c | |||
| @@ -58,6 +58,7 @@ | |||
| 58 | #include <linux/dmi.h> | 58 | #include <linux/dmi.h> |
| 59 | #include <linux/backlight.h> | 59 | #include <linux/backlight.h> |
| 60 | #include <linux/platform_device.h> | 60 | #include <linux/platform_device.h> |
| 61 | #include <linux/rfkill.h> | ||
| 61 | 62 | ||
| 62 | #define MSI_DRIVER_VERSION "0.5" | 63 | #define MSI_DRIVER_VERSION "0.5" |
| 63 | 64 | ||
| @@ -66,6 +67,20 @@ | |||
| 66 | #define MSI_EC_COMMAND_WIRELESS 0x10 | 67 | #define MSI_EC_COMMAND_WIRELESS 0x10 |
| 67 | #define MSI_EC_COMMAND_LCD_LEVEL 0x11 | 68 | #define MSI_EC_COMMAND_LCD_LEVEL 0x11 |
| 68 | 69 | ||
| 70 | #define MSI_STANDARD_EC_COMMAND_ADDRESS 0x2e | ||
| 71 | #define MSI_STANDARD_EC_BLUETOOTH_MASK (1 << 0) | ||
| 72 | #define MSI_STANDARD_EC_WEBCAM_MASK (1 << 1) | ||
| 73 | #define MSI_STANDARD_EC_WLAN_MASK (1 << 3) | ||
| 74 | #define MSI_STANDARD_EC_3G_MASK (1 << 4) | ||
| 75 | |||
| 76 | /* For set SCM load flag to disable BIOS fn key */ | ||
| 77 | #define MSI_STANDARD_EC_SCM_LOAD_ADDRESS 0x2d | ||
| 78 | #define MSI_STANDARD_EC_SCM_LOAD_MASK (1 << 0) | ||
| 79 | |||
| 80 | static int msi_laptop_resume(struct platform_device *device); | ||
| 81 | |||
| 82 | #define MSI_STANDARD_EC_DEVICES_EXISTS_ADDRESS 0x2f | ||
| 83 | |||
| 69 | static int force; | 84 | static int force; |
| 70 | module_param(force, bool, 0); | 85 | module_param(force, bool, 0); |
| 71 | MODULE_PARM_DESC(force, "Force driver load, ignore DMI data"); | 86 | MODULE_PARM_DESC(force, "Force driver load, ignore DMI data"); |
| @@ -74,6 +89,23 @@ static int auto_brightness; | |||
| 74 | module_param(auto_brightness, int, 0); | 89 | module_param(auto_brightness, int, 0); |
| 75 | MODULE_PARM_DESC(auto_brightness, "Enable automatic brightness control (0: disabled; 1: enabled; 2: don't touch)"); | 90 | MODULE_PARM_DESC(auto_brightness, "Enable automatic brightness control (0: disabled; 1: enabled; 2: don't touch)"); |
| 76 | 91 | ||
| 92 | static bool old_ec_model; | ||
| 93 | static int wlan_s, bluetooth_s, threeg_s; | ||
| 94 | static int threeg_exists; | ||
| 95 | |||
| 96 | /* Some MSI 3G netbook only have one fn key to control Wlan/Bluetooth/3G, | ||
| 97 | * those netbook will load the SCM (windows app) to disable the original | ||
| 98 | * Wlan/Bluetooth control by BIOS when user press fn key, then control | ||
| 99 | * Wlan/Bluetooth/3G by SCM (software control by OS). Without SCM, user | ||
| 100 | * cann't on/off 3G module on those 3G netbook. | ||
| 101 | * On Linux, msi-laptop driver will do the same thing to disable the | ||
| 102 | * original BIOS control, then might need use HAL or other userland | ||
| 103 | * application to do the software control that simulate with SCM. | ||
| 104 | * e.g. MSI N034 netbook | ||
| 105 | */ | ||
| 106 | static bool load_scm_model; | ||
| 107 | static struct rfkill *rfk_wlan, *rfk_bluetooth, *rfk_threeg; | ||
| 108 | |||
| 77 | /* Hardware access */ | 109 | /* Hardware access */ |
| 78 | 110 | ||
| 79 | static int set_lcd_level(int level) | 111 | static int set_lcd_level(int level) |
| @@ -130,6 +162,35 @@ static int set_auto_brightness(int enable) | |||
| 130 | return ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, wdata, 2, NULL, 0, 1); | 162 | return ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, wdata, 2, NULL, 0, 1); |
| 131 | } | 163 | } |
| 132 | 164 | ||
| 165 | static ssize_t set_device_state(const char *buf, size_t count, u8 mask) | ||
| 166 | { | ||
| 167 | int status; | ||
| 168 | u8 wdata = 0, rdata; | ||
| 169 | int result; | ||
| 170 | |||
| 171 | if (sscanf(buf, "%i", &status) != 1 || (status < 0 || status > 1)) | ||
| 172 | return -EINVAL; | ||
| 173 | |||
| 174 | /* read current device state */ | ||
| 175 | result = ec_read(MSI_STANDARD_EC_COMMAND_ADDRESS, &rdata); | ||
| 176 | if (result < 0) | ||
| 177 | return -EINVAL; | ||
| 178 | |||
| 179 | if (!!(rdata & mask) != status) { | ||
| 180 | /* reverse device bit */ | ||
| 181 | if (rdata & mask) | ||
| 182 | wdata = rdata & ~mask; | ||
| 183 | else | ||
| 184 | wdata = rdata | mask; | ||
| 185 | |||
| 186 | result = ec_write(MSI_STANDARD_EC_COMMAND_ADDRESS, wdata); | ||
| 187 | if (result < 0) | ||
| 188 | return -EINVAL; | ||
| 189 | } | ||
| 190 | |||
| 191 | return count; | ||
| 192 | } | ||
| 193 | |||
| 133 | static int get_wireless_state(int *wlan, int *bluetooth) | 194 | static int get_wireless_state(int *wlan, int *bluetooth) |
| 134 | { | 195 | { |
| 135 | u8 wdata = 0, rdata; | 196 | u8 wdata = 0, rdata; |
| @@ -148,6 +209,38 @@ static int get_wireless_state(int *wlan, int *bluetooth) | |||
| 148 | return 0; | 209 | return 0; |
| 149 | } | 210 | } |
| 150 | 211 | ||
| 212 | static int get_wireless_state_ec_standard(void) | ||
| 213 | { | ||
| 214 | u8 rdata; | ||
| 215 | int result; | ||
| 216 | |||
| 217 | result = ec_read(MSI_STANDARD_EC_COMMAND_ADDRESS, &rdata); | ||
| 218 | if (result < 0) | ||
| 219 | return -1; | ||
| 220 | |||
| 221 | wlan_s = !!(rdata & MSI_STANDARD_EC_WLAN_MASK); | ||
| 222 | |||
| 223 | bluetooth_s = !!(rdata & MSI_STANDARD_EC_BLUETOOTH_MASK); | ||
| 224 | |||
| 225 | threeg_s = !!(rdata & MSI_STANDARD_EC_3G_MASK); | ||
| 226 | |||
| 227 | return 0; | ||
| 228 | } | ||
| 229 | |||
| 230 | static int get_threeg_exists(void) | ||
| 231 | { | ||
| 232 | u8 rdata; | ||
| 233 | int result; | ||
| 234 | |||
| 235 | result = ec_read(MSI_STANDARD_EC_DEVICES_EXISTS_ADDRESS, &rdata); | ||
| 236 | if (result < 0) | ||
| 237 | return -1; | ||
| 238 | |||
| 239 | threeg_exists = !!(rdata & MSI_STANDARD_EC_3G_MASK); | ||
| 240 | |||
| 241 | return 0; | ||
| 242 | } | ||
| 243 | |||
| 151 | /* Backlight device stuff */ | 244 | /* Backlight device stuff */ |
| 152 | 245 | ||
| 153 | static int bl_get_brightness(struct backlight_device *b) | 246 | static int bl_get_brightness(struct backlight_device *b) |
| @@ -176,26 +269,71 @@ static ssize_t show_wlan(struct device *dev, | |||
| 176 | 269 | ||
| 177 | int ret, enabled; | 270 | int ret, enabled; |
| 178 | 271 | ||
| 179 | ret = get_wireless_state(&enabled, NULL); | 272 | if (old_ec_model) { |
| 273 | ret = get_wireless_state(&enabled, NULL); | ||
| 274 | } else { | ||
| 275 | ret = get_wireless_state_ec_standard(); | ||
| 276 | enabled = wlan_s; | ||
| 277 | } | ||
| 180 | if (ret < 0) | 278 | if (ret < 0) |
| 181 | return ret; | 279 | return ret; |
| 182 | 280 | ||
| 183 | return sprintf(buf, "%i\n", enabled); | 281 | return sprintf(buf, "%i\n", enabled); |
| 184 | } | 282 | } |
| 185 | 283 | ||
| 284 | static ssize_t store_wlan(struct device *dev, | ||
| 285 | struct device_attribute *attr, const char *buf, size_t count) | ||
| 286 | { | ||
| 287 | return set_device_state(buf, count, MSI_STANDARD_EC_WLAN_MASK); | ||
| 288 | } | ||
| 289 | |||
| 186 | static ssize_t show_bluetooth(struct device *dev, | 290 | static ssize_t show_bluetooth(struct device *dev, |
| 187 | struct device_attribute *attr, char *buf) | 291 | struct device_attribute *attr, char *buf) |
| 188 | { | 292 | { |
| 189 | 293 | ||
| 190 | int ret, enabled; | 294 | int ret, enabled; |
| 191 | 295 | ||
| 192 | ret = get_wireless_state(NULL, &enabled); | 296 | if (old_ec_model) { |
| 297 | ret = get_wireless_state(NULL, &enabled); | ||
| 298 | } else { | ||
| 299 | ret = get_wireless_state_ec_standard(); | ||
| 300 | enabled = bluetooth_s; | ||
| 301 | } | ||
| 193 | if (ret < 0) | 302 | if (ret < 0) |
| 194 | return ret; | 303 | return ret; |
| 195 | 304 | ||
| 196 | return sprintf(buf, "%i\n", enabled); | 305 | return sprintf(buf, "%i\n", enabled); |
| 197 | } | 306 | } |
| 198 | 307 | ||
| 308 | static ssize_t store_bluetooth(struct device *dev, | ||
| 309 | struct device_attribute *attr, const char *buf, size_t count) | ||
| 310 | { | ||
| 311 | return set_device_state(buf, count, MSI_STANDARD_EC_BLUETOOTH_MASK); | ||
| 312 | } | ||
| 313 | |||
| 314 | static ssize_t show_threeg(struct device *dev, | ||
| 315 | struct device_attribute *attr, char *buf) | ||
| 316 | { | ||
| 317 | |||
| 318 | int ret; | ||
| 319 | |||
| 320 | /* old msi ec not support 3G */ | ||
| 321 | if (old_ec_model) | ||
| 322 | return -1; | ||
| 323 | |||
| 324 | ret = get_wireless_state_ec_standard(); | ||
| 325 | if (ret < 0) | ||
| 326 | return ret; | ||
| 327 | |||
| 328 | return sprintf(buf, "%i\n", threeg_s); | ||
| 329 | } | ||
| 330 | |||
| 331 | static ssize_t store_threeg(struct device *dev, | ||
| 332 | struct device_attribute *attr, const char *buf, size_t count) | ||
| 333 | { | ||
| 334 | return set_device_state(buf, count, MSI_STANDARD_EC_3G_MASK); | ||
| 335 | } | ||
| 336 | |||
| 199 | static ssize_t show_lcd_level(struct device *dev, | 337 | static ssize_t show_lcd_level(struct device *dev, |
| 200 | struct device_attribute *attr, char *buf) | 338 | struct device_attribute *attr, char *buf) |
| 201 | { | 339 | { |
| @@ -258,6 +396,7 @@ static DEVICE_ATTR(lcd_level, 0644, show_lcd_level, store_lcd_level); | |||
| 258 | static DEVICE_ATTR(auto_brightness, 0644, show_auto_brightness, store_auto_brightness); | 396 | static DEVICE_ATTR(auto_brightness, 0644, show_auto_brightness, store_auto_brightness); |
| 259 | static DEVICE_ATTR(bluetooth, 0444, show_bluetooth, NULL); | 397 | static DEVICE_ATTR(bluetooth, 0444, show_bluetooth, NULL); |
| 260 | static DEVICE_ATTR(wlan, 0444, show_wlan, NULL); | 398 | static DEVICE_ATTR(wlan, 0444, show_wlan, NULL); |
| 399 | static DEVICE_ATTR(threeg, 0444, show_threeg, NULL); | ||
| 261 | 400 | ||
| 262 | static struct attribute *msipf_attributes[] = { | 401 | static struct attribute *msipf_attributes[] = { |
| 263 | &dev_attr_lcd_level.attr, | 402 | &dev_attr_lcd_level.attr, |
| @@ -275,7 +414,8 @@ static struct platform_driver msipf_driver = { | |||
| 275 | .driver = { | 414 | .driver = { |
| 276 | .name = "msi-laptop-pf", | 415 | .name = "msi-laptop-pf", |
| 277 | .owner = THIS_MODULE, | 416 | .owner = THIS_MODULE, |
| 278 | } | 417 | }, |
| 418 | .resume = msi_laptop_resume, | ||
| 279 | }; | 419 | }; |
| 280 | 420 | ||
| 281 | static struct platform_device *msipf_device; | 421 | static struct platform_device *msipf_device; |
| @@ -332,6 +472,192 @@ static struct dmi_system_id __initdata msi_dmi_table[] = { | |||
| 332 | { } | 472 | { } |
| 333 | }; | 473 | }; |
| 334 | 474 | ||
| 475 | static struct dmi_system_id __initdata msi_load_scm_models_dmi_table[] = { | ||
| 476 | { | ||
| 477 | .ident = "MSI N034", | ||
| 478 | .matches = { | ||
| 479 | DMI_MATCH(DMI_SYS_VENDOR, | ||
| 480 | "MICRO-STAR INTERNATIONAL CO., LTD"), | ||
| 481 | DMI_MATCH(DMI_PRODUCT_NAME, "MS-N034"), | ||
| 482 | DMI_MATCH(DMI_CHASSIS_VENDOR, | ||
| 483 | "MICRO-STAR INTERNATIONAL CO., LTD") | ||
| 484 | }, | ||
| 485 | .callback = dmi_check_cb | ||
| 486 | }, | ||
| 487 | { } | ||
| 488 | }; | ||
| 489 | |||
| 490 | static int rfkill_bluetooth_set(void *data, bool blocked) | ||
| 491 | { | ||
| 492 | /* Do something with blocked...*/ | ||
| 493 | /* | ||
| 494 | * blocked == false is on | ||
| 495 | * blocked == true is off | ||
| 496 | */ | ||
| 497 | if (blocked) | ||
| 498 | set_device_state("0", 0, MSI_STANDARD_EC_BLUETOOTH_MASK); | ||
| 499 | else | ||
| 500 | set_device_state("1", 0, MSI_STANDARD_EC_BLUETOOTH_MASK); | ||
| 501 | |||
| 502 | return 0; | ||
| 503 | } | ||
| 504 | |||
| 505 | static int rfkill_wlan_set(void *data, bool blocked) | ||
| 506 | { | ||
| 507 | if (blocked) | ||
| 508 | set_device_state("0", 0, MSI_STANDARD_EC_WLAN_MASK); | ||
| 509 | else | ||
| 510 | set_device_state("1", 0, MSI_STANDARD_EC_WLAN_MASK); | ||
| 511 | |||
| 512 | return 0; | ||
| 513 | } | ||
| 514 | |||
| 515 | static int rfkill_threeg_set(void *data, bool blocked) | ||
| 516 | { | ||
| 517 | if (blocked) | ||
| 518 | set_device_state("0", 0, MSI_STANDARD_EC_3G_MASK); | ||
| 519 | else | ||
| 520 | set_device_state("1", 0, MSI_STANDARD_EC_3G_MASK); | ||
| 521 | |||
| 522 | return 0; | ||
| 523 | } | ||
| 524 | |||
| 525 | static struct rfkill_ops rfkill_bluetooth_ops = { | ||
| 526 | .set_block = rfkill_bluetooth_set | ||
| 527 | }; | ||
| 528 | |||
| 529 | static struct rfkill_ops rfkill_wlan_ops = { | ||
| 530 | .set_block = rfkill_wlan_set | ||
| 531 | }; | ||
| 532 | |||
| 533 | static struct rfkill_ops rfkill_threeg_ops = { | ||
| 534 | .set_block = rfkill_threeg_set | ||
| 535 | }; | ||
| 536 | |||
| 537 | static void rfkill_cleanup(void) | ||
| 538 | { | ||
| 539 | if (rfk_bluetooth) { | ||
| 540 | rfkill_unregister(rfk_bluetooth); | ||
| 541 | rfkill_destroy(rfk_bluetooth); | ||
| 542 | } | ||
| 543 | |||
| 544 | if (rfk_threeg) { | ||
| 545 | rfkill_unregister(rfk_threeg); | ||
| 546 | rfkill_destroy(rfk_threeg); | ||
| 547 | } | ||
| 548 | |||
| 549 | if (rfk_wlan) { | ||
| 550 | rfkill_unregister(rfk_wlan); | ||
| 551 | rfkill_destroy(rfk_wlan); | ||
| 552 | } | ||
| 553 | } | ||
| 554 | |||
| 555 | static int rfkill_init(struct platform_device *sdev) | ||
| 556 | { | ||
| 557 | /* add rfkill */ | ||
| 558 | int retval; | ||
| 559 | |||
| 560 | rfk_bluetooth = rfkill_alloc("msi-bluetooth", &sdev->dev, | ||
| 561 | RFKILL_TYPE_BLUETOOTH, | ||
| 562 | &rfkill_bluetooth_ops, NULL); | ||
| 563 | if (!rfk_bluetooth) { | ||
| 564 | retval = -ENOMEM; | ||
| 565 | goto err_bluetooth; | ||
| 566 | } | ||
| 567 | retval = rfkill_register(rfk_bluetooth); | ||
| 568 | if (retval) | ||
| 569 | goto err_bluetooth; | ||
| 570 | |||
| 571 | rfk_wlan = rfkill_alloc("msi-wlan", &sdev->dev, RFKILL_TYPE_WLAN, | ||
| 572 | &rfkill_wlan_ops, NULL); | ||
| 573 | if (!rfk_wlan) { | ||
| 574 | retval = -ENOMEM; | ||
| 575 | goto err_wlan; | ||
| 576 | } | ||
| 577 | retval = rfkill_register(rfk_wlan); | ||
| 578 | if (retval) | ||
| 579 | goto err_wlan; | ||
| 580 | |||
| 581 | if (threeg_exists) { | ||
| 582 | rfk_threeg = rfkill_alloc("msi-threeg", &sdev->dev, | ||
| 583 | RFKILL_TYPE_WWAN, &rfkill_threeg_ops, NULL); | ||
| 584 | if (!rfk_threeg) { | ||
| 585 | retval = -ENOMEM; | ||
| 586 | goto err_threeg; | ||
| 587 | } | ||
| 588 | retval = rfkill_register(rfk_threeg); | ||
| 589 | if (retval) | ||
| 590 | goto err_threeg; | ||
| 591 | } | ||
| 592 | |||
| 593 | return 0; | ||
| 594 | |||
| 595 | err_threeg: | ||
| 596 | rfkill_destroy(rfk_threeg); | ||
| 597 | if (rfk_wlan) | ||
| 598 | rfkill_unregister(rfk_wlan); | ||
| 599 | err_wlan: | ||
| 600 | rfkill_destroy(rfk_wlan); | ||
| 601 | if (rfk_bluetooth) | ||
| 602 | rfkill_unregister(rfk_bluetooth); | ||
| 603 | err_bluetooth: | ||
| 604 | rfkill_destroy(rfk_bluetooth); | ||
| 605 | |||
| 606 | return retval; | ||
| 607 | } | ||
| 608 | |||
| 609 | static int msi_laptop_resume(struct platform_device *device) | ||
| 610 | { | ||
| 611 | u8 data; | ||
| 612 | int result; | ||
| 613 | |||
| 614 | if (!load_scm_model) | ||
| 615 | return 0; | ||
| 616 | |||
| 617 | /* set load SCM to disable hardware control by fn key */ | ||
| 618 | result = ec_read(MSI_STANDARD_EC_SCM_LOAD_ADDRESS, &data); | ||
| 619 | if (result < 0) | ||
| 620 | return result; | ||
| 621 | |||
| 622 | result = ec_write(MSI_STANDARD_EC_SCM_LOAD_ADDRESS, | ||
| 623 | data | MSI_STANDARD_EC_SCM_LOAD_MASK); | ||
| 624 | if (result < 0) | ||
| 625 | return result; | ||
| 626 | |||
| 627 | return 0; | ||
| 628 | } | ||
| 629 | |||
| 630 | static int load_scm_model_init(struct platform_device *sdev) | ||
| 631 | { | ||
| 632 | u8 data; | ||
| 633 | int result; | ||
| 634 | |||
| 635 | /* allow userland write sysfs file */ | ||
| 636 | dev_attr_bluetooth.store = store_bluetooth; | ||
| 637 | dev_attr_wlan.store = store_wlan; | ||
| 638 | dev_attr_threeg.store = store_threeg; | ||
| 639 | dev_attr_bluetooth.attr.mode |= S_IWUSR; | ||
| 640 | dev_attr_wlan.attr.mode |= S_IWUSR; | ||
| 641 | dev_attr_threeg.attr.mode |= S_IWUSR; | ||
| 642 | |||
| 643 | /* disable hardware control by fn key */ | ||
| 644 | result = ec_read(MSI_STANDARD_EC_SCM_LOAD_ADDRESS, &data); | ||
| 645 | if (result < 0) | ||
| 646 | return result; | ||
| 647 | |||
| 648 | result = ec_write(MSI_STANDARD_EC_SCM_LOAD_ADDRESS, | ||
| 649 | data | MSI_STANDARD_EC_SCM_LOAD_MASK); | ||
| 650 | if (result < 0) | ||
| 651 | return result; | ||
| 652 | |||
| 653 | /* initial rfkill */ | ||
| 654 | result = rfkill_init(sdev); | ||
| 655 | if (result < 0) | ||
| 656 | return result; | ||
| 657 | |||
| 658 | return 0; | ||
| 659 | } | ||
| 660 | |||
| 335 | static int __init msi_init(void) | 661 | static int __init msi_init(void) |
| 336 | { | 662 | { |
| 337 | int ret; | 663 | int ret; |
| @@ -339,8 +665,14 @@ static int __init msi_init(void) | |||
| 339 | if (acpi_disabled) | 665 | if (acpi_disabled) |
| 340 | return -ENODEV; | 666 | return -ENODEV; |
| 341 | 667 | ||
| 342 | if (!force && !dmi_check_system(msi_dmi_table)) | 668 | if (force || dmi_check_system(msi_dmi_table)) |
| 343 | return -ENODEV; | 669 | old_ec_model = 1; |
| 670 | |||
| 671 | if (!old_ec_model) | ||
| 672 | get_threeg_exists(); | ||
| 673 | |||
| 674 | if (!old_ec_model && dmi_check_system(msi_load_scm_models_dmi_table)) | ||
| 675 | load_scm_model = 1; | ||
| 344 | 676 | ||
| 345 | if (auto_brightness < 0 || auto_brightness > 2) | 677 | if (auto_brightness < 0 || auto_brightness > 2) |
| 346 | return -EINVAL; | 678 | return -EINVAL; |
| @@ -374,10 +706,23 @@ static int __init msi_init(void) | |||
| 374 | if (ret) | 706 | if (ret) |
| 375 | goto fail_platform_device1; | 707 | goto fail_platform_device1; |
| 376 | 708 | ||
| 709 | if (load_scm_model && (load_scm_model_init(msipf_device) < 0)) { | ||
| 710 | ret = -EINVAL; | ||
| 711 | goto fail_platform_device1; | ||
| 712 | } | ||
| 713 | |||
| 377 | ret = sysfs_create_group(&msipf_device->dev.kobj, &msipf_attribute_group); | 714 | ret = sysfs_create_group(&msipf_device->dev.kobj, &msipf_attribute_group); |
| 378 | if (ret) | 715 | if (ret) |
| 379 | goto fail_platform_device2; | 716 | goto fail_platform_device2; |
| 380 | 717 | ||
| 718 | if (!old_ec_model) { | ||
| 719 | if (threeg_exists) | ||
| 720 | ret = device_create_file(&msipf_device->dev, | ||
| 721 | &dev_attr_threeg); | ||
| 722 | if (ret) | ||
| 723 | goto fail_platform_device2; | ||
| 724 | } | ||
| 725 | |||
| 381 | /* Disable automatic brightness control by default because | 726 | /* Disable automatic brightness control by default because |
| 382 | * this module was probably loaded to do brightness control in | 727 | * this module was probably loaded to do brightness control in |
| 383 | * software. */ | 728 | * software. */ |
| @@ -412,10 +757,14 @@ static void __exit msi_cleanup(void) | |||
| 412 | { | 757 | { |
| 413 | 758 | ||
| 414 | sysfs_remove_group(&msipf_device->dev.kobj, &msipf_attribute_group); | 759 | sysfs_remove_group(&msipf_device->dev.kobj, &msipf_attribute_group); |
| 760 | if (!old_ec_model && threeg_exists) | ||
| 761 | device_remove_file(&msipf_device->dev, &dev_attr_threeg); | ||
| 415 | platform_device_unregister(msipf_device); | 762 | platform_device_unregister(msipf_device); |
| 416 | platform_driver_unregister(&msipf_driver); | 763 | platform_driver_unregister(&msipf_driver); |
| 417 | backlight_device_unregister(msibl_device); | 764 | backlight_device_unregister(msibl_device); |
| 418 | 765 | ||
| 766 | rfkill_cleanup(); | ||
| 767 | |||
| 419 | /* Enable automatic brightness control again */ | 768 | /* Enable automatic brightness control again */ |
| 420 | if (auto_brightness != 2) | 769 | if (auto_brightness != 2) |
| 421 | set_auto_brightness(1); | 770 | set_auto_brightness(1); |
| @@ -435,3 +784,4 @@ MODULE_ALIAS("dmi:*:svnMICRO-STARINT'LCO.,LTD:pnMS-1013:pvr0131*:cvnMICRO-STARIN | |||
| 435 | MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1058:pvr0581:rvnMSI:rnMS-1058:*:ct10:*"); | 784 | MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1058:pvr0581:rvnMSI:rnMS-1058:*:ct10:*"); |
| 436 | MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1412:*:rvnMSI:rnMS-1412:*:cvnMICRO-STARINT'LCO.,LTD:ct10:*"); | 785 | MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1412:*:rvnMSI:rnMS-1412:*:cvnMICRO-STARINT'LCO.,LTD:ct10:*"); |
| 437 | MODULE_ALIAS("dmi:*:svnNOTEBOOK:pnSAM2000:pvr0131*:cvnMICRO-STARINT'LCO.,LTD:ct10:*"); | 786 | MODULE_ALIAS("dmi:*:svnNOTEBOOK:pnSAM2000:pvr0131*:cvnMICRO-STARINT'LCO.,LTD:ct10:*"); |
| 787 | MODULE_ALIAS("dmi:*:svnMICRO-STARINTERNATIONAL*:pnMS-N034:*"); | ||
diff --git a/drivers/scsi/sgiwd93.c b/drivers/scsi/sgiwd93.c index 0807b260268b..fef0e3c75b16 100644 --- a/drivers/scsi/sgiwd93.c +++ b/drivers/scsi/sgiwd93.c | |||
| @@ -226,7 +226,7 @@ static struct scsi_host_template sgiwd93_template = { | |||
| 226 | .use_clustering = DISABLE_CLUSTERING, | 226 | .use_clustering = DISABLE_CLUSTERING, |
| 227 | }; | 227 | }; |
| 228 | 228 | ||
| 229 | static int __init sgiwd93_probe(struct platform_device *pdev) | 229 | static int __devinit sgiwd93_probe(struct platform_device *pdev) |
| 230 | { | 230 | { |
| 231 | struct sgiwd93_platform_data *pd = pdev->dev.platform_data; | 231 | struct sgiwd93_platform_data *pd = pdev->dev.platform_data; |
| 232 | unsigned char *wdregs = pd->wdregs; | 232 | unsigned char *wdregs = pd->wdregs; |
diff --git a/drivers/scsi/sni_53c710.c b/drivers/scsi/sni_53c710.c index 37b3359e863e..56cf0bb4ed1f 100644 --- a/drivers/scsi/sni_53c710.c +++ b/drivers/scsi/sni_53c710.c | |||
| @@ -64,7 +64,7 @@ static struct scsi_host_template snirm710_template = { | |||
| 64 | .module = THIS_MODULE, | 64 | .module = THIS_MODULE, |
| 65 | }; | 65 | }; |
| 66 | 66 | ||
| 67 | static int __init snirm710_probe(struct platform_device *dev) | 67 | static int __devinit snirm710_probe(struct platform_device *dev) |
| 68 | { | 68 | { |
| 69 | unsigned long base; | 69 | unsigned long base; |
| 70 | struct NCR_700_Host_Parameters *hostdata; | 70 | struct NCR_700_Host_Parameters *hostdata; |
diff --git a/drivers/staging/asus_oled/asus_oled.c b/drivers/staging/asus_oled/asus_oled.c index cadb6f7321ad..7ebecc92c61b 100644 --- a/drivers/staging/asus_oled/asus_oled.c +++ b/drivers/staging/asus_oled/asus_oled.c | |||
| @@ -770,13 +770,8 @@ static struct usb_driver oled_driver = { | |||
| 770 | .id_table = id_table, | 770 | .id_table = id_table, |
| 771 | }; | 771 | }; |
| 772 | 772 | ||
| 773 | static ssize_t version_show(struct class *dev, char *buf) | 773 | static CLASS_ATTR_STRING(version, S_IRUGO, |
| 774 | { | 774 | ASUS_OLED_UNDERSCORE_NAME " " ASUS_OLED_VERSION); |
| 775 | return sprintf(buf, ASUS_OLED_UNDERSCORE_NAME " %s\n", | ||
| 776 | ASUS_OLED_VERSION); | ||
| 777 | } | ||
| 778 | |||
| 779 | static CLASS_ATTR(version, S_IRUGO, version_show, NULL); | ||
| 780 | 775 | ||
| 781 | static int __init asus_oled_init(void) | 776 | static int __init asus_oled_init(void) |
| 782 | { | 777 | { |
| @@ -788,7 +783,7 @@ static int __init asus_oled_init(void) | |||
| 788 | return PTR_ERR(oled_class); | 783 | return PTR_ERR(oled_class); |
| 789 | } | 784 | } |
| 790 | 785 | ||
| 791 | retval = class_create_file(oled_class, &class_attr_version); | 786 | retval = class_create_file(oled_class, &class_attr_version.attr); |
| 792 | if (retval) { | 787 | if (retval) { |
| 793 | err("Error creating class version file"); | 788 | err("Error creating class version file"); |
| 794 | goto error; | 789 | goto error; |
| @@ -810,7 +805,7 @@ error: | |||
| 810 | 805 | ||
| 811 | static void __exit asus_oled_exit(void) | 806 | static void __exit asus_oled_exit(void) |
| 812 | { | 807 | { |
| 813 | class_remove_file(oled_class, &class_attr_version); | 808 | class_remove_file(oled_class, &class_attr_version.attr); |
| 814 | class_destroy(oled_class); | 809 | class_destroy(oled_class); |
| 815 | 810 | ||
| 816 | usb_deregister(&oled_driver); | 811 | usb_deregister(&oled_driver); |
diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig index 8aa1955f35ed..1da73ecd9799 100644 --- a/drivers/uio/Kconfig +++ b/drivers/uio/Kconfig | |||
| @@ -44,17 +44,6 @@ config UIO_PDRV_GENIRQ | |||
| 44 | 44 | ||
| 45 | If you don't know what to do here, say N. | 45 | If you don't know what to do here, say N. |
| 46 | 46 | ||
| 47 | config UIO_SMX | ||
| 48 | tristate "SMX cryptengine UIO interface" | ||
| 49 | help | ||
| 50 | Userspace IO interface to the Cryptography engine found on the | ||
| 51 | Nias Digital SMX boards. These will be available from Q4 2008 | ||
| 52 | from http://www.niasdigital.com. The userspace part of this | ||
| 53 | driver will be released under the GPL at the same time as the | ||
| 54 | hardware and will be able to be downloaded from the same site. | ||
| 55 | |||
| 56 | If you compile this as a module, it will be called uio_smx. | ||
| 57 | |||
| 58 | config UIO_AEC | 47 | config UIO_AEC |
| 59 | tristate "AEC video timestamp device" | 48 | tristate "AEC video timestamp device" |
| 60 | depends on PCI | 49 | depends on PCI |
| @@ -74,6 +63,7 @@ config UIO_AEC | |||
| 74 | 63 | ||
| 75 | config UIO_SERCOS3 | 64 | config UIO_SERCOS3 |
| 76 | tristate "Automata Sercos III PCI card driver" | 65 | tristate "Automata Sercos III PCI card driver" |
| 66 | depends on PCI | ||
| 77 | help | 67 | help |
| 78 | Userspace I/O interface for the Sercos III PCI card from | 68 | Userspace I/O interface for the Sercos III PCI card from |
| 79 | Automata GmbH. The userspace part of this driver will be | 69 | Automata GmbH. The userspace part of this driver will be |
| @@ -87,11 +77,21 @@ config UIO_SERCOS3 | |||
| 87 | config UIO_PCI_GENERIC | 77 | config UIO_PCI_GENERIC |
| 88 | tristate "Generic driver for PCI 2.3 and PCI Express cards" | 78 | tristate "Generic driver for PCI 2.3 and PCI Express cards" |
| 89 | depends on PCI | 79 | depends on PCI |
| 90 | default n | ||
| 91 | help | 80 | help |
| 92 | Generic driver that you can bind, dynamically, to any | 81 | Generic driver that you can bind, dynamically, to any |
| 93 | PCI 2.3 compliant and PCI Express card. It is useful, | 82 | PCI 2.3 compliant and PCI Express card. It is useful, |
| 94 | primarily, for virtualization scenarios. | 83 | primarily, for virtualization scenarios. |
| 95 | If you compile this as a module, it will be called uio_pci_generic. | 84 | If you compile this as a module, it will be called uio_pci_generic. |
| 96 | 85 | ||
| 86 | config UIO_NETX | ||
| 87 | tristate "Hilscher NetX Card driver" | ||
| 88 | depends on PCI | ||
| 89 | help | ||
| 90 | Driver for Hilscher NetX based fieldbus cards (cifX, comX). | ||
| 91 | This driver requires a userspace component that comes with the card | ||
| 92 | or is available from Hilscher (http://www.hilscher.com). | ||
| 93 | |||
| 94 | To compile this driver as a module, choose M here; the module | ||
| 95 | will be called uio_netx. | ||
| 96 | |||
| 97 | endif | 97 | endif |
diff --git a/drivers/uio/Makefile b/drivers/uio/Makefile index 73b2e7516729..18fd818c5b97 100644 --- a/drivers/uio/Makefile +++ b/drivers/uio/Makefile | |||
| @@ -2,7 +2,7 @@ obj-$(CONFIG_UIO) += uio.o | |||
| 2 | obj-$(CONFIG_UIO_CIF) += uio_cif.o | 2 | obj-$(CONFIG_UIO_CIF) += uio_cif.o |
| 3 | obj-$(CONFIG_UIO_PDRV) += uio_pdrv.o | 3 | obj-$(CONFIG_UIO_PDRV) += uio_pdrv.o |
| 4 | obj-$(CONFIG_UIO_PDRV_GENIRQ) += uio_pdrv_genirq.o | 4 | obj-$(CONFIG_UIO_PDRV_GENIRQ) += uio_pdrv_genirq.o |
| 5 | obj-$(CONFIG_UIO_SMX) += uio_smx.o | ||
| 6 | obj-$(CONFIG_UIO_AEC) += uio_aec.o | 5 | obj-$(CONFIG_UIO_AEC) += uio_aec.o |
| 7 | obj-$(CONFIG_UIO_SERCOS3) += uio_sercos3.o | 6 | obj-$(CONFIG_UIO_SERCOS3) += uio_sercos3.o |
| 8 | obj-$(CONFIG_UIO_PCI_GENERIC) += uio_pci_generic.o | 7 | obj-$(CONFIG_UIO_PCI_GENERIC) += uio_pci_generic.o |
| 8 | obj-$(CONFIG_UIO_NETX) += uio_netx.o | ||
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index e941367dd28f..4de382acd8f2 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c | |||
| @@ -129,7 +129,7 @@ static ssize_t map_type_show(struct kobject *kobj, struct attribute *attr, | |||
| 129 | return entry->show(mem, buf); | 129 | return entry->show(mem, buf); |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | static struct sysfs_ops map_sysfs_ops = { | 132 | static const struct sysfs_ops map_sysfs_ops = { |
| 133 | .show = map_type_show, | 133 | .show = map_type_show, |
| 134 | }; | 134 | }; |
| 135 | 135 | ||
| @@ -217,7 +217,7 @@ static ssize_t portio_type_show(struct kobject *kobj, struct attribute *attr, | |||
| 217 | return entry->show(port, buf); | 217 | return entry->show(port, buf); |
| 218 | } | 218 | } |
| 219 | 219 | ||
| 220 | static struct sysfs_ops portio_sysfs_ops = { | 220 | static const struct sysfs_ops portio_sysfs_ops = { |
| 221 | .show = portio_type_show, | 221 | .show = portio_type_show, |
| 222 | }; | 222 | }; |
| 223 | 223 | ||
diff --git a/drivers/uio/uio_netx.c b/drivers/uio/uio_netx.c new file mode 100644 index 000000000000..afbf0bd55cc9 --- /dev/null +++ b/drivers/uio/uio_netx.c | |||
| @@ -0,0 +1,172 @@ | |||
| 1 | /* | ||
| 2 | * UIO driver for Hilscher NetX based fieldbus cards (cifX, comX). | ||
| 3 | * See http://www.hilscher.com for details. | ||
| 4 | * | ||
| 5 | * (C) 2007 Hans J. Koch <hjk@linutronix.de> | ||
| 6 | * (C) 2008 Manuel Traut <manut@linutronix.de> | ||
| 7 | * | ||
| 8 | * Licensed under GPL version 2 only. | ||
| 9 | * | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <linux/device.h> | ||
| 13 | #include <linux/io.h> | ||
| 14 | #include <linux/module.h> | ||
| 15 | #include <linux/pci.h> | ||
| 16 | #include <linux/uio_driver.h> | ||
| 17 | |||
| 18 | #define PCI_VENDOR_ID_HILSCHER 0x15CF | ||
| 19 | #define PCI_DEVICE_ID_HILSCHER_NETX 0x0000 | ||
| 20 | #define PCI_SUBDEVICE_ID_NXSB_PCA 0x3235 | ||
| 21 | #define PCI_SUBDEVICE_ID_NXPCA 0x3335 | ||
| 22 | |||
| 23 | #define DPM_HOST_INT_EN0 0xfff0 | ||
| 24 | #define DPM_HOST_INT_STAT0 0xffe0 | ||
| 25 | |||
| 26 | #define DPM_HOST_INT_MASK 0xe600ffff | ||
| 27 | #define DPM_HOST_INT_GLOBAL_EN 0x80000000 | ||
| 28 | |||
| 29 | static irqreturn_t netx_handler(int irq, struct uio_info *dev_info) | ||
| 30 | { | ||
| 31 | void __iomem *int_enable_reg = dev_info->mem[0].internal_addr | ||
| 32 | + DPM_HOST_INT_EN0; | ||
| 33 | void __iomem *int_status_reg = dev_info->mem[0].internal_addr | ||
| 34 | + DPM_HOST_INT_STAT0; | ||
| 35 | |||
| 36 | /* Is one of our interrupts enabled and active ? */ | ||
| 37 | if (!(ioread32(int_enable_reg) & ioread32(int_status_reg) | ||
| 38 | & DPM_HOST_INT_MASK)) | ||
| 39 | return IRQ_NONE; | ||
| 40 | |||
| 41 | /* Disable interrupt */ | ||
| 42 | iowrite32(ioread32(int_enable_reg) & ~DPM_HOST_INT_GLOBAL_EN, | ||
| 43 | int_enable_reg); | ||
| 44 | return IRQ_HANDLED; | ||
| 45 | } | ||
| 46 | |||
| 47 | static int __devinit netx_pci_probe(struct pci_dev *dev, | ||
| 48 | const struct pci_device_id *id) | ||
| 49 | { | ||
| 50 | struct uio_info *info; | ||
| 51 | int bar; | ||
| 52 | |||
| 53 | info = kzalloc(sizeof(struct uio_info), GFP_KERNEL); | ||
| 54 | if (!info) | ||
| 55 | return -ENOMEM; | ||
| 56 | |||
| 57 | if (pci_enable_device(dev)) | ||
| 58 | goto out_free; | ||
| 59 | |||
| 60 | if (pci_request_regions(dev, "netx")) | ||
| 61 | goto out_disable; | ||
| 62 | |||
| 63 | switch (id->device) { | ||
| 64 | case PCI_DEVICE_ID_HILSCHER_NETX: | ||
| 65 | bar = 0; | ||
| 66 | info->name = "netx"; | ||
| 67 | break; | ||
| 68 | default: | ||
| 69 | bar = 2; | ||
| 70 | info->name = "netx_plx"; | ||
| 71 | } | ||
| 72 | |||
| 73 | /* BAR0 or 2 points to the card's dual port memory */ | ||
| 74 | info->mem[0].addr = pci_resource_start(dev, bar); | ||
| 75 | if (!info->mem[0].addr) | ||
| 76 | goto out_release; | ||
| 77 | info->mem[0].internal_addr = ioremap(pci_resource_start(dev, bar), | ||
| 78 | pci_resource_len(dev, bar)); | ||
| 79 | |||
| 80 | if (!info->mem[0].internal_addr) | ||
| 81 | goto out_release; | ||
| 82 | |||
| 83 | info->mem[0].size = pci_resource_len(dev, bar); | ||
| 84 | info->mem[0].memtype = UIO_MEM_PHYS; | ||
| 85 | info->irq = dev->irq; | ||
| 86 | info->irq_flags = IRQF_SHARED; | ||
| 87 | info->handler = netx_handler; | ||
| 88 | info->version = "0.0.1"; | ||
| 89 | |||
| 90 | /* Make sure all interrupts are disabled */ | ||
| 91 | iowrite32(0, info->mem[0].internal_addr + DPM_HOST_INT_EN0); | ||
| 92 | |||
| 93 | if (uio_register_device(&dev->dev, info)) | ||
| 94 | goto out_unmap; | ||
| 95 | |||
| 96 | pci_set_drvdata(dev, info); | ||
| 97 | dev_info(&dev->dev, "Found %s card, registered UIO device.\n", | ||
| 98 | info->name); | ||
| 99 | |||
| 100 | return 0; | ||
| 101 | |||
| 102 | out_unmap: | ||
| 103 | iounmap(info->mem[0].internal_addr); | ||
| 104 | out_release: | ||
| 105 | pci_release_regions(dev); | ||
| 106 | out_disable: | ||
| 107 | pci_disable_device(dev); | ||
| 108 | out_free: | ||
| 109 | kfree(info); | ||
| 110 | return -ENODEV; | ||
| 111 | } | ||
| 112 | |||
| 113 | static void netx_pci_remove(struct pci_dev *dev) | ||
| 114 | { | ||
| 115 | struct uio_info *info = pci_get_drvdata(dev); | ||
| 116 | |||
| 117 | /* Disable all interrupts */ | ||
| 118 | iowrite32(0, info->mem[0].internal_addr + DPM_HOST_INT_EN0); | ||
| 119 | uio_unregister_device(info); | ||
| 120 | pci_release_regions(dev); | ||
| 121 | pci_disable_device(dev); | ||
| 122 | pci_set_drvdata(dev, NULL); | ||
| 123 | iounmap(info->mem[0].internal_addr); | ||
| 124 | |||
| 125 | kfree(info); | ||
| 126 | } | ||
| 127 | |||
| 128 | static struct pci_device_id netx_pci_ids[] = { | ||
| 129 | { | ||
| 130 | .vendor = PCI_VENDOR_ID_HILSCHER, | ||
| 131 | .device = PCI_DEVICE_ID_HILSCHER_NETX, | ||
| 132 | .subvendor = 0, | ||
| 133 | .subdevice = 0, | ||
| 134 | }, | ||
| 135 | { | ||
| 136 | .vendor = PCI_VENDOR_ID_PLX, | ||
| 137 | .device = PCI_DEVICE_ID_PLX_9030, | ||
| 138 | .subvendor = PCI_VENDOR_ID_PLX, | ||
| 139 | .subdevice = PCI_SUBDEVICE_ID_NXSB_PCA, | ||
| 140 | }, | ||
| 141 | { | ||
| 142 | .vendor = PCI_VENDOR_ID_PLX, | ||
| 143 | .device = PCI_DEVICE_ID_PLX_9030, | ||
| 144 | .subvendor = PCI_VENDOR_ID_PLX, | ||
| 145 | .subdevice = PCI_SUBDEVICE_ID_NXPCA, | ||
| 146 | }, | ||
| 147 | { 0, } | ||
| 148 | }; | ||
| 149 | |||
| 150 | static struct pci_driver netx_pci_driver = { | ||
| 151 | .name = "netx", | ||
| 152 | .id_table = netx_pci_ids, | ||
| 153 | .probe = netx_pci_probe, | ||
| 154 | .remove = netx_pci_remove, | ||
| 155 | }; | ||
| 156 | |||
| 157 | static int __init netx_init_module(void) | ||
| 158 | { | ||
| 159 | return pci_register_driver(&netx_pci_driver); | ||
| 160 | } | ||
| 161 | |||
| 162 | static void __exit netx_exit_module(void) | ||
| 163 | { | ||
| 164 | pci_unregister_driver(&netx_pci_driver); | ||
| 165 | } | ||
| 166 | |||
| 167 | module_init(netx_init_module); | ||
| 168 | module_exit(netx_exit_module); | ||
| 169 | |||
| 170 | MODULE_DEVICE_TABLE(pci, netx_pci_ids); | ||
| 171 | MODULE_LICENSE("GPL v2"); | ||
| 172 | MODULE_AUTHOR("Hans J. Koch, Manuel Traut"); | ||
diff --git a/drivers/uio/uio_smx.c b/drivers/uio/uio_smx.c deleted file mode 100644 index 44054a650a8a..000000000000 --- a/drivers/uio/uio_smx.c +++ /dev/null | |||
| @@ -1,140 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * UIO SMX Cryptengine driver. | ||
| 3 | * | ||
| 4 | * (C) 2008 Nias Digital P/L <bn@niasdigital.com> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License version 2 as | ||
| 8 | * published by the Free Software Foundation. | ||
| 9 | * | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <linux/device.h> | ||
| 13 | #include <linux/module.h> | ||
| 14 | #include <linux/platform_device.h> | ||
| 15 | #include <linux/uio_driver.h> | ||
| 16 | #include <linux/io.h> | ||
| 17 | |||
| 18 | #define DRV_NAME "smx-ce" | ||
| 19 | #define DRV_VERSION "0.03" | ||
| 20 | |||
| 21 | #define SMX_CSR 0x00000000 | ||
| 22 | #define SMX_EnD 0x00000001 | ||
| 23 | #define SMX_RUN 0x00000002 | ||
| 24 | #define SMX_DRDY 0x00000004 | ||
| 25 | #define SMX_ERR 0x00000008 | ||
| 26 | |||
| 27 | static irqreturn_t smx_handler(int irq, struct uio_info *dev_info) | ||
| 28 | { | ||
| 29 | void __iomem *csr = dev_info->mem[0].internal_addr + SMX_CSR; | ||
| 30 | |||
| 31 | u32 status = ioread32(csr); | ||
| 32 | |||
| 33 | if (!(status & SMX_DRDY)) | ||
| 34 | return IRQ_NONE; | ||
| 35 | |||
| 36 | /* Disable interrupt */ | ||
| 37 | iowrite32(status & ~SMX_DRDY, csr); | ||
| 38 | return IRQ_HANDLED; | ||
| 39 | } | ||
| 40 | |||
| 41 | static int __devinit smx_ce_probe(struct platform_device *dev) | ||
| 42 | { | ||
| 43 | |||
| 44 | int ret = -ENODEV; | ||
| 45 | struct uio_info *info; | ||
| 46 | struct resource *regs; | ||
| 47 | |||
| 48 | info = kzalloc(sizeof(struct uio_info), GFP_KERNEL); | ||
| 49 | if (!info) | ||
| 50 | return -ENOMEM; | ||
| 51 | |||
| 52 | regs = platform_get_resource(dev, IORESOURCE_MEM, 0); | ||
| 53 | if (!regs) { | ||
| 54 | dev_err(&dev->dev, "No memory resource specified\n"); | ||
| 55 | goto out_free; | ||
| 56 | } | ||
| 57 | |||
| 58 | info->mem[0].addr = regs->start; | ||
| 59 | if (!info->mem[0].addr) { | ||
| 60 | dev_err(&dev->dev, "Invalid memory resource\n"); | ||
| 61 | goto out_free; | ||
| 62 | } | ||
| 63 | |||
| 64 | info->mem[0].size = regs->end - regs->start + 1; | ||
| 65 | info->mem[0].internal_addr = ioremap(regs->start, info->mem[0].size); | ||
| 66 | |||
| 67 | if (!info->mem[0].internal_addr) { | ||
| 68 | dev_err(&dev->dev, "Can't remap memory address range\n"); | ||
| 69 | goto out_free; | ||
| 70 | } | ||
| 71 | |||
| 72 | info->mem[0].memtype = UIO_MEM_PHYS; | ||
| 73 | |||
| 74 | info->name = "smx-ce"; | ||
| 75 | info->version = "0.03"; | ||
| 76 | |||
| 77 | info->irq = platform_get_irq(dev, 0); | ||
| 78 | if (info->irq < 0) { | ||
| 79 | ret = info->irq; | ||
| 80 | dev_err(&dev->dev, "No (or invalid) IRQ resource specified\n"); | ||
| 81 | goto out_unmap; | ||
| 82 | } | ||
| 83 | |||
| 84 | info->irq_flags = IRQF_SHARED; | ||
| 85 | info->handler = smx_handler; | ||
| 86 | |||
| 87 | platform_set_drvdata(dev, info); | ||
| 88 | |||
| 89 | ret = uio_register_device(&dev->dev, info); | ||
| 90 | |||
| 91 | if (ret) | ||
| 92 | goto out_unmap; | ||
| 93 | |||
| 94 | return 0; | ||
| 95 | |||
| 96 | out_unmap: | ||
| 97 | iounmap(info->mem[0].internal_addr); | ||
| 98 | out_free: | ||
| 99 | kfree(info); | ||
| 100 | |||
| 101 | return ret; | ||
| 102 | } | ||
| 103 | |||
| 104 | static int __devexit smx_ce_remove(struct platform_device *dev) | ||
| 105 | { | ||
| 106 | struct uio_info *info = platform_get_drvdata(dev); | ||
| 107 | |||
| 108 | uio_unregister_device(info); | ||
| 109 | platform_set_drvdata(dev, NULL); | ||
| 110 | iounmap(info->mem[0].internal_addr); | ||
| 111 | |||
| 112 | kfree(info); | ||
| 113 | |||
| 114 | return 0; | ||
| 115 | } | ||
| 116 | |||
| 117 | static struct platform_driver smx_ce_driver = { | ||
| 118 | .probe = smx_ce_probe, | ||
| 119 | .remove = __devexit_p(smx_ce_remove), | ||
| 120 | .driver = { | ||
| 121 | .name = DRV_NAME, | ||
| 122 | .owner = THIS_MODULE, | ||
| 123 | }, | ||
| 124 | }; | ||
| 125 | |||
| 126 | static int __init smx_ce_init_module(void) | ||
| 127 | { | ||
| 128 | return platform_driver_register(&smx_ce_driver); | ||
| 129 | } | ||
| 130 | module_init(smx_ce_init_module); | ||
| 131 | |||
| 132 | static void __exit smx_ce_exit_module(void) | ||
| 133 | { | ||
| 134 | platform_driver_unregister(&smx_ce_driver); | ||
| 135 | } | ||
| 136 | module_exit(smx_ce_exit_module); | ||
| 137 | |||
| 138 | MODULE_LICENSE("GPL v2"); | ||
| 139 | MODULE_VERSION(DRV_VERSION); | ||
| 140 | MODULE_AUTHOR("Ben Nizette <bn@niasdigital.com>"); | ||
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index a7037bf81688..f3c233806fa3 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
| @@ -489,10 +489,10 @@ void usb_driver_release_interface(struct usb_driver *driver, | |||
| 489 | if (device_is_registered(dev)) { | 489 | if (device_is_registered(dev)) { |
| 490 | device_release_driver(dev); | 490 | device_release_driver(dev); |
| 491 | } else { | 491 | } else { |
| 492 | down(&dev->sem); | 492 | device_lock(dev); |
| 493 | usb_unbind_interface(dev); | 493 | usb_unbind_interface(dev); |
| 494 | dev->driver = NULL; | 494 | dev->driver = NULL; |
| 495 | up(&dev->sem); | 495 | device_unlock(dev); |
| 496 | } | 496 | } |
| 497 | } | 497 | } |
| 498 | EXPORT_SYMBOL_GPL(usb_driver_release_interface); | 498 | EXPORT_SYMBOL_GPL(usb_driver_release_interface); |
diff --git a/drivers/uwb/driver.c b/drivers/uwb/driver.c index da77e41de990..08bd6dbfd4a6 100644 --- a/drivers/uwb/driver.c +++ b/drivers/uwb/driver.c | |||
| @@ -74,13 +74,16 @@ | |||
| 74 | unsigned long beacon_timeout_ms = 500; | 74 | unsigned long beacon_timeout_ms = 500; |
| 75 | 75 | ||
| 76 | static | 76 | static |
| 77 | ssize_t beacon_timeout_ms_show(struct class *class, char *buf) | 77 | ssize_t beacon_timeout_ms_show(struct class *class, |
| 78 | struct class_attribute *attr, | ||
| 79 | char *buf) | ||
| 78 | { | 80 | { |
| 79 | return scnprintf(buf, PAGE_SIZE, "%lu\n", beacon_timeout_ms); | 81 | return scnprintf(buf, PAGE_SIZE, "%lu\n", beacon_timeout_ms); |
| 80 | } | 82 | } |
| 81 | 83 | ||
| 82 | static | 84 | static |
| 83 | ssize_t beacon_timeout_ms_store(struct class *class, | 85 | ssize_t beacon_timeout_ms_store(struct class *class, |
| 86 | struct class_attribute *attr, | ||
| 84 | const char *buf, size_t size) | 87 | const char *buf, size_t size) |
| 85 | { | 88 | { |
| 86 | unsigned long bt; | 89 | unsigned long bt; |
diff --git a/drivers/uwb/umc-bus.c b/drivers/uwb/umc-bus.c index cdd6c8efc9f8..5fad4e791b3e 100644 --- a/drivers/uwb/umc-bus.c +++ b/drivers/uwb/umc-bus.c | |||
| @@ -62,12 +62,12 @@ int umc_controller_reset(struct umc_dev *umc) | |||
| 62 | struct device *parent = umc->dev.parent; | 62 | struct device *parent = umc->dev.parent; |
| 63 | int ret = 0; | 63 | int ret = 0; |
| 64 | 64 | ||
| 65 | if(down_trylock(&parent->sem)) | 65 | if (device_trylock(parent)) |
| 66 | return -EAGAIN; | 66 | return -EAGAIN; |
| 67 | ret = device_for_each_child(parent, parent, umc_bus_pre_reset_helper); | 67 | ret = device_for_each_child(parent, parent, umc_bus_pre_reset_helper); |
| 68 | if (ret >= 0) | 68 | if (ret >= 0) |
| 69 | ret = device_for_each_child(parent, parent, umc_bus_post_reset_helper); | 69 | ret = device_for_each_child(parent, parent, umc_bus_post_reset_helper); |
| 70 | up(&parent->sem); | 70 | device_unlock(parent); |
| 71 | 71 | ||
| 72 | return ret; | 72 | return ret; |
| 73 | } | 73 | } |
diff --git a/drivers/uwb/uwb-internal.h b/drivers/uwb/uwb-internal.h index d5bcfc1c227a..157485c862c0 100644 --- a/drivers/uwb/uwb-internal.h +++ b/drivers/uwb/uwb-internal.h | |||
| @@ -366,12 +366,12 @@ struct dentry *uwb_dbg_create_pal_dir(struct uwb_pal *pal); | |||
| 366 | 366 | ||
| 367 | static inline void uwb_dev_lock(struct uwb_dev *uwb_dev) | 367 | static inline void uwb_dev_lock(struct uwb_dev *uwb_dev) |
| 368 | { | 368 | { |
| 369 | down(&uwb_dev->dev.sem); | 369 | device_lock(&uwb_dev->dev); |
| 370 | } | 370 | } |
| 371 | 371 | ||
| 372 | static inline void uwb_dev_unlock(struct uwb_dev *uwb_dev) | 372 | static inline void uwb_dev_unlock(struct uwb_dev *uwb_dev) |
| 373 | { | 373 | { |
| 374 | up(&uwb_dev->dev.sem); | 374 | device_unlock(&uwb_dev->dev); |
| 375 | } | 375 | } |
| 376 | 376 | ||
| 377 | #endif /* #ifndef __UWB_INTERNAL_H__ */ | 377 | #endif /* #ifndef __UWB_INTERNAL_H__ */ |
diff --git a/drivers/uwb/wlp/sysfs.c b/drivers/uwb/wlp/sysfs.c index 0370399ff4bb..6627c94cc854 100644 --- a/drivers/uwb/wlp/sysfs.c +++ b/drivers/uwb/wlp/sysfs.c | |||
| @@ -615,8 +615,7 @@ ssize_t wlp_wss_attr_store(struct kobject *kobj, struct attribute *attr, | |||
| 615 | return ret; | 615 | return ret; |
| 616 | } | 616 | } |
| 617 | 617 | ||
| 618 | static | 618 | static const struct sysfs_ops wss_sysfs_ops = { |
| 619 | struct sysfs_ops wss_sysfs_ops = { | ||
| 620 | .show = wlp_wss_attr_show, | 619 | .show = wlp_wss_attr_show, |
| 621 | .store = wlp_wss_attr_store, | 620 | .store = wlp_wss_attr_store, |
| 622 | }; | 621 | }; |
diff --git a/drivers/video/acornfb.c b/drivers/video/acornfb.c index 0bcc59eb37fa..43d7d5067361 100644 --- a/drivers/video/acornfb.c +++ b/drivers/video/acornfb.c | |||
| @@ -1221,7 +1221,7 @@ free_unused_pages(unsigned int virtual_start, unsigned int virtual_end) | |||
| 1221 | printk("acornfb: freed %dK memory\n", mb_freed); | 1221 | printk("acornfb: freed %dK memory\n", mb_freed); |
| 1222 | } | 1222 | } |
| 1223 | 1223 | ||
| 1224 | static int __init acornfb_probe(struct platform_device *dev) | 1224 | static int __devinit acornfb_probe(struct platform_device *dev) |
| 1225 | { | 1225 | { |
| 1226 | unsigned long size; | 1226 | unsigned long size; |
| 1227 | u_int h_sync, v_sync; | 1227 | u_int h_sync, v_sync; |
diff --git a/drivers/video/arcfb.c b/drivers/video/arcfb.c index c3431691c9f2..01554d696528 100644 --- a/drivers/video/arcfb.c +++ b/drivers/video/arcfb.c | |||
| @@ -504,7 +504,7 @@ static struct fb_ops arcfb_ops = { | |||
| 504 | .fb_ioctl = arcfb_ioctl, | 504 | .fb_ioctl = arcfb_ioctl, |
| 505 | }; | 505 | }; |
| 506 | 506 | ||
| 507 | static int __init arcfb_probe(struct platform_device *dev) | 507 | static int __devinit arcfb_probe(struct platform_device *dev) |
| 508 | { | 508 | { |
| 509 | struct fb_info *info; | 509 | struct fb_info *info; |
| 510 | int retval = -ENOMEM; | 510 | int retval = -ENOMEM; |
diff --git a/drivers/video/cobalt_lcdfb.c b/drivers/video/cobalt_lcdfb.c index 108b89e09a80..5eb61b5adfe8 100644 --- a/drivers/video/cobalt_lcdfb.c +++ b/drivers/video/cobalt_lcdfb.c | |||
| @@ -287,7 +287,7 @@ static struct fb_ops cobalt_lcd_fbops = { | |||
| 287 | .fb_cursor = cobalt_lcdfb_cursor, | 287 | .fb_cursor = cobalt_lcdfb_cursor, |
| 288 | }; | 288 | }; |
| 289 | 289 | ||
| 290 | static int __init cobalt_lcdfb_probe(struct platform_device *dev) | 290 | static int __devinit cobalt_lcdfb_probe(struct platform_device *dev) |
| 291 | { | 291 | { |
| 292 | struct fb_info *info; | 292 | struct fb_info *info; |
| 293 | struct resource *res; | 293 | struct resource *res; |
diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c index d25df51bb0d2..581d2dbf675a 100644 --- a/drivers/video/efifb.c +++ b/drivers/video/efifb.c | |||
| @@ -210,7 +210,7 @@ static int __init efifb_setup(char *options) | |||
| 210 | return 0; | 210 | return 0; |
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | static int __init efifb_probe(struct platform_device *dev) | 213 | static int __devinit efifb_probe(struct platform_device *dev) |
| 214 | { | 214 | { |
| 215 | struct fb_info *info; | 215 | struct fb_info *info; |
| 216 | int err; | 216 | int err; |
diff --git a/drivers/video/epson1355fb.c b/drivers/video/epson1355fb.c index 2735b79e52a1..6d755bb3a2bc 100644 --- a/drivers/video/epson1355fb.c +++ b/drivers/video/epson1355fb.c | |||
| @@ -602,7 +602,7 @@ static int epson1355fb_remove(struct platform_device *dev) | |||
| 602 | return 0; | 602 | return 0; |
| 603 | } | 603 | } |
| 604 | 604 | ||
| 605 | int __init epson1355fb_probe(struct platform_device *dev) | 605 | int __devinit epson1355fb_probe(struct platform_device *dev) |
| 606 | { | 606 | { |
| 607 | struct epson1355_par *default_par; | 607 | struct epson1355_par *default_par; |
| 608 | struct fb_info *info; | 608 | struct fb_info *info; |
diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c index 695fa013fe7e..5643a35c1746 100644 --- a/drivers/video/gbefb.c +++ b/drivers/video/gbefb.c | |||
| @@ -1128,7 +1128,7 @@ static int __init gbefb_setup(char *options) | |||
| 1128 | return 0; | 1128 | return 0; |
| 1129 | } | 1129 | } |
| 1130 | 1130 | ||
| 1131 | static int __init gbefb_probe(struct platform_device *p_dev) | 1131 | static int __devinit gbefb_probe(struct platform_device *p_dev) |
| 1132 | { | 1132 | { |
| 1133 | int i, ret = 0; | 1133 | int i, ret = 0; |
| 1134 | struct fb_info *info; | 1134 | struct fb_info *info; |
diff --git a/drivers/video/hgafb.c b/drivers/video/hgafb.c index 0129c044f6d6..db9b785b56eb 100644 --- a/drivers/video/hgafb.c +++ b/drivers/video/hgafb.c | |||
| @@ -551,7 +551,7 @@ static struct fb_ops hgafb_ops = { | |||
| 551 | * Initialization | 551 | * Initialization |
| 552 | */ | 552 | */ |
| 553 | 553 | ||
| 554 | static int __init hgafb_probe(struct platform_device *pdev) | 554 | static int __devinit hgafb_probe(struct platform_device *pdev) |
| 555 | { | 555 | { |
| 556 | struct fb_info *info; | 556 | struct fb_info *info; |
| 557 | 557 | ||
diff --git a/drivers/video/hitfb.c b/drivers/video/hitfb.c index 73c83a8de2d3..bf78779199c6 100644 --- a/drivers/video/hitfb.c +++ b/drivers/video/hitfb.c | |||
| @@ -325,7 +325,7 @@ static struct fb_ops hitfb_ops = { | |||
| 325 | .fb_imageblit = cfb_imageblit, | 325 | .fb_imageblit = cfb_imageblit, |
| 326 | }; | 326 | }; |
| 327 | 327 | ||
| 328 | static int __init hitfb_probe(struct platform_device *dev) | 328 | static int __devinit hitfb_probe(struct platform_device *dev) |
| 329 | { | 329 | { |
| 330 | unsigned short lcdclor, ldr3, ldvndr; | 330 | unsigned short lcdclor, ldr3, ldvndr; |
| 331 | struct fb_info *info; | 331 | struct fb_info *info; |
diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/omap2/dss/manager.c index 913142d4cab1..9acef00c47ea 100644 --- a/drivers/video/omap2/dss/manager.c +++ b/drivers/video/omap2/dss/manager.c | |||
| @@ -341,7 +341,7 @@ static ssize_t manager_attr_store(struct kobject *kobj, struct attribute *attr, | |||
| 341 | return manager_attr->store(manager, buf, size); | 341 | return manager_attr->store(manager, buf, size); |
| 342 | } | 342 | } |
| 343 | 343 | ||
| 344 | static struct sysfs_ops manager_sysfs_ops = { | 344 | static const struct sysfs_ops manager_sysfs_ops = { |
| 345 | .show = manager_attr_show, | 345 | .show = manager_attr_show, |
| 346 | .store = manager_attr_store, | 346 | .store = manager_attr_store, |
| 347 | }; | 347 | }; |
diff --git a/drivers/video/omap2/dss/overlay.c b/drivers/video/omap2/dss/overlay.c index 0c5bea263ac6..aed3f3194347 100644 --- a/drivers/video/omap2/dss/overlay.c +++ b/drivers/video/omap2/dss/overlay.c | |||
| @@ -320,7 +320,7 @@ static ssize_t overlay_attr_store(struct kobject *kobj, struct attribute *attr, | |||
| 320 | return overlay_attr->store(overlay, buf, size); | 320 | return overlay_attr->store(overlay, buf, size); |
| 321 | } | 321 | } |
| 322 | 322 | ||
| 323 | static struct sysfs_ops overlay_sysfs_ops = { | 323 | static const struct sysfs_ops overlay_sysfs_ops = { |
| 324 | .show = overlay_attr_show, | 324 | .show = overlay_attr_show, |
| 325 | .store = overlay_attr_store, | 325 | .store = overlay_attr_store, |
| 326 | }; | 326 | }; |
diff --git a/drivers/video/q40fb.c b/drivers/video/q40fb.c index 4beac1df617b..de40a626dc76 100644 --- a/drivers/video/q40fb.c +++ b/drivers/video/q40fb.c | |||
| @@ -85,7 +85,7 @@ static struct fb_ops q40fb_ops = { | |||
| 85 | .fb_imageblit = cfb_imageblit, | 85 | .fb_imageblit = cfb_imageblit, |
| 86 | }; | 86 | }; |
| 87 | 87 | ||
| 88 | static int __init q40fb_probe(struct platform_device *dev) | 88 | static int __devinit q40fb_probe(struct platform_device *dev) |
| 89 | { | 89 | { |
| 90 | struct fb_info *info; | 90 | struct fb_info *info; |
| 91 | 91 | ||
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c index aac661225c78..2b094dec4a56 100644 --- a/drivers/video/s3c2410fb.c +++ b/drivers/video/s3c2410fb.c | |||
| @@ -1004,12 +1004,12 @@ dealloc_fb: | |||
| 1004 | return ret; | 1004 | return ret; |
| 1005 | } | 1005 | } |
| 1006 | 1006 | ||
| 1007 | static int __init s3c2410fb_probe(struct platform_device *pdev) | 1007 | static int __devinit s3c2410fb_probe(struct platform_device *pdev) |
| 1008 | { | 1008 | { |
| 1009 | return s3c24xxfb_probe(pdev, DRV_S3C2410); | 1009 | return s3c24xxfb_probe(pdev, DRV_S3C2410); |
| 1010 | } | 1010 | } |
| 1011 | 1011 | ||
| 1012 | static int __init s3c2412fb_probe(struct platform_device *pdev) | 1012 | static int __devinit s3c2412fb_probe(struct platform_device *pdev) |
| 1013 | { | 1013 | { |
| 1014 | return s3c24xxfb_probe(pdev, DRV_S3C2412); | 1014 | return s3c24xxfb_probe(pdev, DRV_S3C2412); |
| 1015 | } | 1015 | } |
diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c index cdaa873a6054..e8b76d65a070 100644 --- a/drivers/video/sa1100fb.c +++ b/drivers/video/sa1100fb.c | |||
| @@ -1435,7 +1435,7 @@ static struct sa1100fb_info * __init sa1100fb_init_fbinfo(struct device *dev) | |||
| 1435 | return fbi; | 1435 | return fbi; |
| 1436 | } | 1436 | } |
| 1437 | 1437 | ||
| 1438 | static int __init sa1100fb_probe(struct platform_device *pdev) | 1438 | static int __devinit sa1100fb_probe(struct platform_device *pdev) |
| 1439 | { | 1439 | { |
| 1440 | struct sa1100fb_info *fbi; | 1440 | struct sa1100fb_info *fbi; |
| 1441 | int ret, irq; | 1441 | int ret, irq; |
diff --git a/drivers/video/sgivwfb.c b/drivers/video/sgivwfb.c index f86012239bff..7a3a5e28eca1 100644 --- a/drivers/video/sgivwfb.c +++ b/drivers/video/sgivwfb.c | |||
| @@ -745,7 +745,7 @@ int __init sgivwfb_setup(char *options) | |||
| 745 | /* | 745 | /* |
| 746 | * Initialisation | 746 | * Initialisation |
| 747 | */ | 747 | */ |
| 748 | static int __init sgivwfb_probe(struct platform_device *dev) | 748 | static int __devinit sgivwfb_probe(struct platform_device *dev) |
| 749 | { | 749 | { |
| 750 | struct sgivw_par *par; | 750 | struct sgivw_par *par; |
| 751 | struct fb_info *info; | 751 | struct fb_info *info; |
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index 8d7653e56df5..bbd1dbf4026a 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c | |||
| @@ -943,7 +943,7 @@ static const struct dev_pm_ops sh_mobile_lcdc_dev_pm_ops = { | |||
| 943 | 943 | ||
| 944 | static int sh_mobile_lcdc_remove(struct platform_device *pdev); | 944 | static int sh_mobile_lcdc_remove(struct platform_device *pdev); |
| 945 | 945 | ||
| 946 | static int __init sh_mobile_lcdc_probe(struct platform_device *pdev) | 946 | static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev) |
| 947 | { | 947 | { |
| 948 | struct fb_info *info; | 948 | struct fb_info *info; |
| 949 | struct sh_mobile_lcdc_priv *priv; | 949 | struct sh_mobile_lcdc_priv *priv; |
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c index bd37ee1f6a25..ef4128c8e57a 100644 --- a/drivers/video/vesafb.c +++ b/drivers/video/vesafb.c | |||
| @@ -226,7 +226,7 @@ static int __init vesafb_setup(char *options) | |||
| 226 | return 0; | 226 | return 0; |
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | static int __init vesafb_probe(struct platform_device *dev) | 229 | static int __devinit vesafb_probe(struct platform_device *dev) |
| 230 | { | 230 | { |
| 231 | struct fb_info *info; | 231 | struct fb_info *info; |
| 232 | int i, err; | 232 | int i, err; |
diff --git a/drivers/video/vfb.c b/drivers/video/vfb.c index 050d432c7d95..b8ab995fbda7 100644 --- a/drivers/video/vfb.c +++ b/drivers/video/vfb.c | |||
| @@ -479,7 +479,7 @@ static int __init vfb_setup(char *options) | |||
| 479 | * Initialisation | 479 | * Initialisation |
| 480 | */ | 480 | */ |
| 481 | 481 | ||
| 482 | static int __init vfb_probe(struct platform_device *dev) | 482 | static int __devinit vfb_probe(struct platform_device *dev) |
| 483 | { | 483 | { |
| 484 | struct fb_info *info; | 484 | struct fb_info *info; |
| 485 | int retval = -ENOMEM; | 485 | int retval = -ENOMEM; |
diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c index 5b2938903ac2..76d8dae5b1bb 100644 --- a/drivers/video/vga16fb.c +++ b/drivers/video/vga16fb.c | |||
| @@ -1293,7 +1293,7 @@ static int vga16fb_setup(char *options) | |||
| 1293 | } | 1293 | } |
| 1294 | #endif | 1294 | #endif |
| 1295 | 1295 | ||
| 1296 | static int __init vga16fb_probe(struct platform_device *dev) | 1296 | static int __devinit vga16fb_probe(struct platform_device *dev) |
| 1297 | { | 1297 | { |
| 1298 | struct fb_info *info; | 1298 | struct fb_info *info; |
| 1299 | struct vga16fb_par *par; | 1299 | struct vga16fb_par *par; |
diff --git a/drivers/video/w100fb.c b/drivers/video/w100fb.c index 2376f688ec8b..5d223959778a 100644 --- a/drivers/video/w100fb.c +++ b/drivers/video/w100fb.c | |||
| @@ -628,7 +628,7 @@ static int w100fb_resume(struct platform_device *dev) | |||
| 628 | #endif | 628 | #endif |
| 629 | 629 | ||
| 630 | 630 | ||
| 631 | int __init w100fb_probe(struct platform_device *pdev) | 631 | int __devinit w100fb_probe(struct platform_device *pdev) |
| 632 | { | 632 | { |
| 633 | int err = -EIO; | 633 | int err = -EIO; |
| 634 | struct w100fb_mach_info *inf; | 634 | struct w100fb_mach_info *inf; |
diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c index 0d92969404c3..22977d30f89e 100644 --- a/drivers/w1/masters/omap_hdq.c +++ b/drivers/w1/masters/omap_hdq.c | |||
| @@ -72,7 +72,7 @@ struct hdq_data { | |||
| 72 | int init_trans; | 72 | int init_trans; |
| 73 | }; | 73 | }; |
| 74 | 74 | ||
| 75 | static int __init omap_hdq_probe(struct platform_device *pdev); | 75 | static int __devinit omap_hdq_probe(struct platform_device *pdev); |
| 76 | static int omap_hdq_remove(struct platform_device *pdev); | 76 | static int omap_hdq_remove(struct platform_device *pdev); |
| 77 | 77 | ||
| 78 | static struct platform_driver omap_hdq_driver = { | 78 | static struct platform_driver omap_hdq_driver = { |
| @@ -558,7 +558,7 @@ static void omap_w1_write_byte(void *_hdq, u8 byte) | |||
| 558 | return; | 558 | return; |
| 559 | } | 559 | } |
| 560 | 560 | ||
| 561 | static int __init omap_hdq_probe(struct platform_device *pdev) | 561 | static int __devinit omap_hdq_probe(struct platform_device *pdev) |
| 562 | { | 562 | { |
| 563 | struct hdq_data *hdq_data; | 563 | struct hdq_data *hdq_data; |
| 564 | struct resource *res; | 564 | struct resource *res; |
diff --git a/drivers/xen/sys-hypervisor.c b/drivers/xen/sys-hypervisor.c index ae5cb05a1a1c..bb71ab2336c8 100644 --- a/drivers/xen/sys-hypervisor.c +++ b/drivers/xen/sys-hypervisor.c | |||
| @@ -426,7 +426,7 @@ static ssize_t hyp_sysfs_store(struct kobject *kobj, | |||
| 426 | return 0; | 426 | return 0; |
| 427 | } | 427 | } |
| 428 | 428 | ||
| 429 | static struct sysfs_ops hyp_sysfs_ops = { | 429 | static const struct sysfs_ops hyp_sysfs_ops = { |
| 430 | .show = hyp_sysfs_show, | 430 | .show = hyp_sysfs_show, |
| 431 | .store = hyp_sysfs_store, | 431 | .store = hyp_sysfs_store, |
| 432 | }; | 432 | }; |
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index a240b6fa81df..4ce16ef702a3 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c | |||
| @@ -164,12 +164,12 @@ static void btrfs_root_release(struct kobject *kobj) | |||
| 164 | complete(&root->kobj_unregister); | 164 | complete(&root->kobj_unregister); |
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | static struct sysfs_ops btrfs_super_attr_ops = { | 167 | static const struct sysfs_ops btrfs_super_attr_ops = { |
| 168 | .show = btrfs_super_attr_show, | 168 | .show = btrfs_super_attr_show, |
| 169 | .store = btrfs_super_attr_store, | 169 | .store = btrfs_super_attr_store, |
| 170 | }; | 170 | }; |
| 171 | 171 | ||
| 172 | static struct sysfs_ops btrfs_root_attr_ops = { | 172 | static const struct sysfs_ops btrfs_root_attr_ops = { |
| 173 | .show = btrfs_root_attr_show, | 173 | .show = btrfs_root_attr_show, |
| 174 | .store = btrfs_root_attr_store, | 174 | .store = btrfs_root_attr_store, |
| 175 | }; | 175 | }; |
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c index 26a8bd40400a..f994a7dfda85 100644 --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c | |||
| @@ -148,7 +148,7 @@ static void lockspace_kobj_release(struct kobject *k) | |||
| 148 | kfree(ls); | 148 | kfree(ls); |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | static struct sysfs_ops dlm_attr_ops = { | 151 | static const struct sysfs_ops dlm_attr_ops = { |
| 152 | .show = dlm_attr_show, | 152 | .show = dlm_attr_show, |
| 153 | .store = dlm_attr_store, | 153 | .store = dlm_attr_store, |
| 154 | }; | 154 | }; |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 2b83b96cb2eb..ce84a6ed4a48 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
| @@ -2358,7 +2358,7 @@ static void ext4_sb_release(struct kobject *kobj) | |||
| 2358 | } | 2358 | } |
| 2359 | 2359 | ||
| 2360 | 2360 | ||
| 2361 | static struct sysfs_ops ext4_attr_ops = { | 2361 | static const struct sysfs_ops ext4_attr_ops = { |
| 2362 | .show = ext4_attr_show, | 2362 | .show = ext4_attr_show, |
| 2363 | .store = ext4_attr_store, | 2363 | .store = ext4_attr_store, |
| 2364 | }; | 2364 | }; |
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index b5f1a46133c8..419042f7f0b6 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c | |||
| @@ -49,7 +49,7 @@ static ssize_t gfs2_attr_store(struct kobject *kobj, struct attribute *attr, | |||
| 49 | return a->store ? a->store(sdp, buf, len) : len; | 49 | return a->store ? a->store(sdp, buf, len) : len; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | static struct sysfs_ops gfs2_attr_ops = { | 52 | static const struct sysfs_ops gfs2_attr_ops = { |
| 53 | .show = gfs2_attr_show, | 53 | .show = gfs2_attr_show, |
| 54 | .store = gfs2_attr_store, | 54 | .store = gfs2_attr_store, |
| 55 | }; | 55 | }; |
| @@ -574,7 +574,7 @@ static int gfs2_uevent(struct kset *kset, struct kobject *kobj, | |||
| 574 | return 0; | 574 | return 0; |
| 575 | } | 575 | } |
| 576 | 576 | ||
| 577 | static struct kset_uevent_ops gfs2_uevent_ops = { | 577 | static const struct kset_uevent_ops gfs2_uevent_ops = { |
| 578 | .uevent = gfs2_uevent, | 578 | .uevent = gfs2_uevent, |
| 579 | }; | 579 | }; |
| 580 | 580 | ||
diff --git a/fs/ocfs2/cluster/masklog.c b/fs/ocfs2/cluster/masklog.c index b39da877b12f..3bb928a2bf7d 100644 --- a/fs/ocfs2/cluster/masklog.c +++ b/fs/ocfs2/cluster/masklog.c | |||
| @@ -136,7 +136,7 @@ static ssize_t mlog_store(struct kobject *obj, struct attribute *attr, | |||
| 136 | return mlog_mask_store(mlog_attr->mask, buf, count); | 136 | return mlog_mask_store(mlog_attr->mask, buf, count); |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | static struct sysfs_ops mlog_attr_ops = { | 139 | static const struct sysfs_ops mlog_attr_ops = { |
| 140 | .show = mlog_show, | 140 | .show = mlog_show, |
| 141 | .store = mlog_store, | 141 | .store = mlog_store, |
| 142 | }; | 142 | }; |
diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c index a0a500af24a1..e9d293593e52 100644 --- a/fs/sysfs/bin.c +++ b/fs/sysfs/bin.c | |||
| @@ -54,14 +54,14 @@ fill_read(struct dentry *dentry, char *buffer, loff_t off, size_t count) | |||
| 54 | int rc; | 54 | int rc; |
| 55 | 55 | ||
| 56 | /* need attr_sd for attr, its parent for kobj */ | 56 | /* need attr_sd for attr, its parent for kobj */ |
| 57 | if (!sysfs_get_active_two(attr_sd)) | 57 | if (!sysfs_get_active(attr_sd)) |
| 58 | return -ENODEV; | 58 | return -ENODEV; |
| 59 | 59 | ||
| 60 | rc = -EIO; | 60 | rc = -EIO; |
| 61 | if (attr->read) | 61 | if (attr->read) |
| 62 | rc = attr->read(kobj, attr, buffer, off, count); | 62 | rc = attr->read(kobj, attr, buffer, off, count); |
| 63 | 63 | ||
| 64 | sysfs_put_active_two(attr_sd); | 64 | sysfs_put_active(attr_sd); |
| 65 | 65 | ||
| 66 | return rc; | 66 | return rc; |
| 67 | } | 67 | } |
| @@ -125,14 +125,14 @@ flush_write(struct dentry *dentry, char *buffer, loff_t offset, size_t count) | |||
| 125 | int rc; | 125 | int rc; |
| 126 | 126 | ||
| 127 | /* need attr_sd for attr, its parent for kobj */ | 127 | /* need attr_sd for attr, its parent for kobj */ |
| 128 | if (!sysfs_get_active_two(attr_sd)) | 128 | if (!sysfs_get_active(attr_sd)) |
| 129 | return -ENODEV; | 129 | return -ENODEV; |
| 130 | 130 | ||
| 131 | rc = -EIO; | 131 | rc = -EIO; |
| 132 | if (attr->write) | 132 | if (attr->write) |
| 133 | rc = attr->write(kobj, attr, buffer, offset, count); | 133 | rc = attr->write(kobj, attr, buffer, offset, count); |
| 134 | 134 | ||
| 135 | sysfs_put_active_two(attr_sd); | 135 | sysfs_put_active(attr_sd); |
| 136 | 136 | ||
| 137 | return rc; | 137 | return rc; |
| 138 | } | 138 | } |
| @@ -184,12 +184,12 @@ static void bin_vma_open(struct vm_area_struct *vma) | |||
| 184 | if (!bb->vm_ops || !bb->vm_ops->open) | 184 | if (!bb->vm_ops || !bb->vm_ops->open) |
| 185 | return; | 185 | return; |
| 186 | 186 | ||
| 187 | if (!sysfs_get_active_two(attr_sd)) | 187 | if (!sysfs_get_active(attr_sd)) |
| 188 | return; | 188 | return; |
| 189 | 189 | ||
| 190 | bb->vm_ops->open(vma); | 190 | bb->vm_ops->open(vma); |
| 191 | 191 | ||
| 192 | sysfs_put_active_two(attr_sd); | 192 | sysfs_put_active(attr_sd); |
| 193 | } | 193 | } |
| 194 | 194 | ||
| 195 | static void bin_vma_close(struct vm_area_struct *vma) | 195 | static void bin_vma_close(struct vm_area_struct *vma) |
| @@ -201,12 +201,12 @@ static void bin_vma_close(struct vm_area_struct *vma) | |||
| 201 | if (!bb->vm_ops || !bb->vm_ops->close) | 201 | if (!bb->vm_ops || !bb->vm_ops->close) |
| 202 | return; | 202 | return; |
| 203 | 203 | ||
| 204 | if (!sysfs_get_active_two(attr_sd)) | 204 | if (!sysfs_get_active(attr_sd)) |
| 205 | return; | 205 | return; |
| 206 | 206 | ||
| 207 | bb->vm_ops->close(vma); | 207 | bb->vm_ops->close(vma); |
| 208 | 208 | ||
| 209 | sysfs_put_active_two(attr_sd); | 209 | sysfs_put_active(attr_sd); |
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | static int bin_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | 212 | static int bin_fault(struct vm_area_struct *vma, struct vm_fault *vmf) |
| @@ -219,12 +219,12 @@ static int bin_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
| 219 | if (!bb->vm_ops || !bb->vm_ops->fault) | 219 | if (!bb->vm_ops || !bb->vm_ops->fault) |
| 220 | return VM_FAULT_SIGBUS; | 220 | return VM_FAULT_SIGBUS; |
| 221 | 221 | ||
| 222 | if (!sysfs_get_active_two(attr_sd)) | 222 | if (!sysfs_get_active(attr_sd)) |
| 223 | return VM_FAULT_SIGBUS; | 223 | return VM_FAULT_SIGBUS; |
| 224 | 224 | ||
| 225 | ret = bb->vm_ops->fault(vma, vmf); | 225 | ret = bb->vm_ops->fault(vma, vmf); |
| 226 | 226 | ||
| 227 | sysfs_put_active_two(attr_sd); | 227 | sysfs_put_active(attr_sd); |
| 228 | return ret; | 228 | return ret; |
| 229 | } | 229 | } |
| 230 | 230 | ||
| @@ -241,12 +241,12 @@ static int bin_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
| 241 | if (!bb->vm_ops->page_mkwrite) | 241 | if (!bb->vm_ops->page_mkwrite) |
| 242 | return 0; | 242 | return 0; |
| 243 | 243 | ||
| 244 | if (!sysfs_get_active_two(attr_sd)) | 244 | if (!sysfs_get_active(attr_sd)) |
| 245 | return VM_FAULT_SIGBUS; | 245 | return VM_FAULT_SIGBUS; |
| 246 | 246 | ||
| 247 | ret = bb->vm_ops->page_mkwrite(vma, vmf); | 247 | ret = bb->vm_ops->page_mkwrite(vma, vmf); |
| 248 | 248 | ||
| 249 | sysfs_put_active_two(attr_sd); | 249 | sysfs_put_active(attr_sd); |
| 250 | return ret; | 250 | return ret; |
| 251 | } | 251 | } |
| 252 | 252 | ||
| @@ -261,12 +261,12 @@ static int bin_access(struct vm_area_struct *vma, unsigned long addr, | |||
| 261 | if (!bb->vm_ops || !bb->vm_ops->access) | 261 | if (!bb->vm_ops || !bb->vm_ops->access) |
| 262 | return -EINVAL; | 262 | return -EINVAL; |
| 263 | 263 | ||
| 264 | if (!sysfs_get_active_two(attr_sd)) | 264 | if (!sysfs_get_active(attr_sd)) |
| 265 | return -EINVAL; | 265 | return -EINVAL; |
| 266 | 266 | ||
| 267 | ret = bb->vm_ops->access(vma, addr, buf, len, write); | 267 | ret = bb->vm_ops->access(vma, addr, buf, len, write); |
| 268 | 268 | ||
| 269 | sysfs_put_active_two(attr_sd); | 269 | sysfs_put_active(attr_sd); |
| 270 | return ret; | 270 | return ret; |
| 271 | } | 271 | } |
| 272 | 272 | ||
| @@ -281,12 +281,12 @@ static int bin_set_policy(struct vm_area_struct *vma, struct mempolicy *new) | |||
| 281 | if (!bb->vm_ops || !bb->vm_ops->set_policy) | 281 | if (!bb->vm_ops || !bb->vm_ops->set_policy) |
| 282 | return 0; | 282 | return 0; |
| 283 | 283 | ||
| 284 | if (!sysfs_get_active_two(attr_sd)) | 284 | if (!sysfs_get_active(attr_sd)) |
| 285 | return -EINVAL; | 285 | return -EINVAL; |
| 286 | 286 | ||
| 287 | ret = bb->vm_ops->set_policy(vma, new); | 287 | ret = bb->vm_ops->set_policy(vma, new); |
| 288 | 288 | ||
| 289 | sysfs_put_active_two(attr_sd); | 289 | sysfs_put_active(attr_sd); |
| 290 | return ret; | 290 | return ret; |
| 291 | } | 291 | } |
| 292 | 292 | ||
| @@ -301,12 +301,12 @@ static struct mempolicy *bin_get_policy(struct vm_area_struct *vma, | |||
| 301 | if (!bb->vm_ops || !bb->vm_ops->get_policy) | 301 | if (!bb->vm_ops || !bb->vm_ops->get_policy) |
| 302 | return vma->vm_policy; | 302 | return vma->vm_policy; |
| 303 | 303 | ||
| 304 | if (!sysfs_get_active_two(attr_sd)) | 304 | if (!sysfs_get_active(attr_sd)) |
| 305 | return vma->vm_policy; | 305 | return vma->vm_policy; |
| 306 | 306 | ||
| 307 | pol = bb->vm_ops->get_policy(vma, addr); | 307 | pol = bb->vm_ops->get_policy(vma, addr); |
| 308 | 308 | ||
| 309 | sysfs_put_active_two(attr_sd); | 309 | sysfs_put_active(attr_sd); |
| 310 | return pol; | 310 | return pol; |
| 311 | } | 311 | } |
| 312 | 312 | ||
| @@ -321,12 +321,12 @@ static int bin_migrate(struct vm_area_struct *vma, const nodemask_t *from, | |||
| 321 | if (!bb->vm_ops || !bb->vm_ops->migrate) | 321 | if (!bb->vm_ops || !bb->vm_ops->migrate) |
| 322 | return 0; | 322 | return 0; |
| 323 | 323 | ||
| 324 | if (!sysfs_get_active_two(attr_sd)) | 324 | if (!sysfs_get_active(attr_sd)) |
| 325 | return 0; | 325 | return 0; |
| 326 | 326 | ||
| 327 | ret = bb->vm_ops->migrate(vma, from, to, flags); | 327 | ret = bb->vm_ops->migrate(vma, from, to, flags); |
| 328 | 328 | ||
| 329 | sysfs_put_active_two(attr_sd); | 329 | sysfs_put_active(attr_sd); |
| 330 | return ret; | 330 | return ret; |
| 331 | } | 331 | } |
| 332 | #endif | 332 | #endif |
| @@ -356,7 +356,7 @@ static int mmap(struct file *file, struct vm_area_struct *vma) | |||
| 356 | 356 | ||
| 357 | /* need attr_sd for attr, its parent for kobj */ | 357 | /* need attr_sd for attr, its parent for kobj */ |
| 358 | rc = -ENODEV; | 358 | rc = -ENODEV; |
| 359 | if (!sysfs_get_active_two(attr_sd)) | 359 | if (!sysfs_get_active(attr_sd)) |
| 360 | goto out_unlock; | 360 | goto out_unlock; |
| 361 | 361 | ||
| 362 | rc = -EINVAL; | 362 | rc = -EINVAL; |
| @@ -384,7 +384,7 @@ static int mmap(struct file *file, struct vm_area_struct *vma) | |||
| 384 | bb->vm_ops = vma->vm_ops; | 384 | bb->vm_ops = vma->vm_ops; |
| 385 | vma->vm_ops = &bin_vm_ops; | 385 | vma->vm_ops = &bin_vm_ops; |
| 386 | out_put: | 386 | out_put: |
| 387 | sysfs_put_active_two(attr_sd); | 387 | sysfs_put_active(attr_sd); |
| 388 | out_unlock: | 388 | out_unlock: |
| 389 | mutex_unlock(&bb->mutex); | 389 | mutex_unlock(&bb->mutex); |
| 390 | 390 | ||
| @@ -399,7 +399,7 @@ static int open(struct inode * inode, struct file * file) | |||
| 399 | int error; | 399 | int error; |
| 400 | 400 | ||
| 401 | /* binary file operations requires both @sd and its parent */ | 401 | /* binary file operations requires both @sd and its parent */ |
| 402 | if (!sysfs_get_active_two(attr_sd)) | 402 | if (!sysfs_get_active(attr_sd)) |
| 403 | return -ENODEV; | 403 | return -ENODEV; |
| 404 | 404 | ||
| 405 | error = -EACCES; | 405 | error = -EACCES; |
| @@ -426,11 +426,11 @@ static int open(struct inode * inode, struct file * file) | |||
| 426 | mutex_unlock(&sysfs_bin_lock); | 426 | mutex_unlock(&sysfs_bin_lock); |
| 427 | 427 | ||
| 428 | /* open succeeded, put active references */ | 428 | /* open succeeded, put active references */ |
| 429 | sysfs_put_active_two(attr_sd); | 429 | sysfs_put_active(attr_sd); |
| 430 | return 0; | 430 | return 0; |
| 431 | 431 | ||
| 432 | err_out: | 432 | err_out: |
| 433 | sysfs_put_active_two(attr_sd); | 433 | sysfs_put_active(attr_sd); |
| 434 | kfree(bb); | 434 | kfree(bb); |
| 435 | return error; | 435 | return error; |
| 436 | } | 436 | } |
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 699f371b9f12..590717861c7a 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
| @@ -93,7 +93,7 @@ static void sysfs_unlink_sibling(struct sysfs_dirent *sd) | |||
| 93 | * RETURNS: | 93 | * RETURNS: |
| 94 | * Pointer to @sd on success, NULL on failure. | 94 | * Pointer to @sd on success, NULL on failure. |
| 95 | */ | 95 | */ |
| 96 | static struct sysfs_dirent *sysfs_get_active(struct sysfs_dirent *sd) | 96 | struct sysfs_dirent *sysfs_get_active(struct sysfs_dirent *sd) |
| 97 | { | 97 | { |
| 98 | if (unlikely(!sd)) | 98 | if (unlikely(!sd)) |
| 99 | return NULL; | 99 | return NULL; |
| @@ -124,7 +124,7 @@ static struct sysfs_dirent *sysfs_get_active(struct sysfs_dirent *sd) | |||
| 124 | * Put an active reference to @sd. This function is noop if @sd | 124 | * Put an active reference to @sd. This function is noop if @sd |
| 125 | * is NULL. | 125 | * is NULL. |
| 126 | */ | 126 | */ |
| 127 | static void sysfs_put_active(struct sysfs_dirent *sd) | 127 | void sysfs_put_active(struct sysfs_dirent *sd) |
| 128 | { | 128 | { |
| 129 | struct completion *cmpl; | 129 | struct completion *cmpl; |
| 130 | int v; | 130 | int v; |
| @@ -145,45 +145,6 @@ static void sysfs_put_active(struct sysfs_dirent *sd) | |||
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | /** | 147 | /** |
| 148 | * sysfs_get_active_two - get active references to sysfs_dirent and parent | ||
| 149 | * @sd: sysfs_dirent of interest | ||
| 150 | * | ||
| 151 | * Get active reference to @sd and its parent. Parent's active | ||
| 152 | * reference is grabbed first. This function is noop if @sd is | ||
| 153 | * NULL. | ||
| 154 | * | ||
| 155 | * RETURNS: | ||
| 156 | * Pointer to @sd on success, NULL on failure. | ||
| 157 | */ | ||
| 158 | struct sysfs_dirent *sysfs_get_active_two(struct sysfs_dirent *sd) | ||
| 159 | { | ||
| 160 | if (sd) { | ||
| 161 | if (sd->s_parent && unlikely(!sysfs_get_active(sd->s_parent))) | ||
| 162 | return NULL; | ||
| 163 | if (unlikely(!sysfs_get_active(sd))) { | ||
| 164 | sysfs_put_active(sd->s_parent); | ||
| 165 | return NULL; | ||
| 166 | } | ||
| 167 | } | ||
| 168 | return sd; | ||
| 169 | } | ||
| 170 | |||
| 171 | /** | ||
| 172 | * sysfs_put_active_two - put active references to sysfs_dirent and parent | ||
| 173 | * @sd: sysfs_dirent of interest | ||
| 174 | * | ||
| 175 | * Put active references to @sd and its parent. This function is | ||
| 176 | * noop if @sd is NULL. | ||
| 177 | */ | ||
| 178 | void sysfs_put_active_two(struct sysfs_dirent *sd) | ||
| 179 | { | ||
| 180 | if (sd) { | ||
| 181 | sysfs_put_active(sd); | ||
| 182 | sysfs_put_active(sd->s_parent); | ||
| 183 | } | ||
| 184 | } | ||
| 185 | |||
| 186 | /** | ||
| 187 | * sysfs_deactivate - deactivate sysfs_dirent | 148 | * sysfs_deactivate - deactivate sysfs_dirent |
| 188 | * @sd: sysfs_dirent to deactivate | 149 | * @sd: sysfs_dirent to deactivate |
| 189 | * | 150 | * |
| @@ -195,6 +156,10 @@ static void sysfs_deactivate(struct sysfs_dirent *sd) | |||
| 195 | int v; | 156 | int v; |
| 196 | 157 | ||
| 197 | BUG_ON(sd->s_sibling || !(sd->s_flags & SYSFS_FLAG_REMOVED)); | 158 | BUG_ON(sd->s_sibling || !(sd->s_flags & SYSFS_FLAG_REMOVED)); |
| 159 | |||
| 160 | if (!(sysfs_type(sd) & SYSFS_ACTIVE_REF)) | ||
| 161 | return; | ||
| 162 | |||
| 198 | sd->s_sibling = (void *)&wait; | 163 | sd->s_sibling = (void *)&wait; |
| 199 | 164 | ||
| 200 | rwsem_acquire(&sd->dep_map, 0, 0, _RET_IP_); | 165 | rwsem_acquire(&sd->dep_map, 0, 0, _RET_IP_); |
| @@ -354,7 +319,6 @@ struct sysfs_dirent *sysfs_new_dirent(const char *name, umode_t mode, int type) | |||
| 354 | 319 | ||
| 355 | atomic_set(&sd->s_count, 1); | 320 | atomic_set(&sd->s_count, 1); |
| 356 | atomic_set(&sd->s_active, 0); | 321 | atomic_set(&sd->s_active, 0); |
| 357 | sysfs_dirent_init_lockdep(sd); | ||
| 358 | 322 | ||
| 359 | sd->s_name = name; | 323 | sd->s_name = name; |
| 360 | sd->s_mode = mode; | 324 | sd->s_mode = mode; |
| @@ -681,7 +645,7 @@ static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry, | |||
| 681 | } | 645 | } |
| 682 | 646 | ||
| 683 | /* attach dentry and inode */ | 647 | /* attach dentry and inode */ |
| 684 | inode = sysfs_get_inode(sd); | 648 | inode = sysfs_get_inode(dir->i_sb, sd); |
| 685 | if (!inode) { | 649 | if (!inode) { |
| 686 | ret = ERR_PTR(-ENOMEM); | 650 | ret = ERR_PTR(-ENOMEM); |
| 687 | goto out_unlock; | 651 | goto out_unlock; |
| @@ -837,11 +801,46 @@ static inline unsigned char dt_type(struct sysfs_dirent *sd) | |||
| 837 | return (sd->s_mode >> 12) & 15; | 801 | return (sd->s_mode >> 12) & 15; |
| 838 | } | 802 | } |
| 839 | 803 | ||
| 804 | static int sysfs_dir_release(struct inode *inode, struct file *filp) | ||
| 805 | { | ||
| 806 | sysfs_put(filp->private_data); | ||
| 807 | return 0; | ||
| 808 | } | ||
| 809 | |||
| 810 | static struct sysfs_dirent *sysfs_dir_pos(struct sysfs_dirent *parent_sd, | ||
| 811 | ino_t ino, struct sysfs_dirent *pos) | ||
| 812 | { | ||
| 813 | if (pos) { | ||
| 814 | int valid = !(pos->s_flags & SYSFS_FLAG_REMOVED) && | ||
| 815 | pos->s_parent == parent_sd && | ||
| 816 | ino == pos->s_ino; | ||
| 817 | sysfs_put(pos); | ||
| 818 | if (valid) | ||
| 819 | return pos; | ||
| 820 | } | ||
| 821 | pos = NULL; | ||
| 822 | if ((ino > 1) && (ino < INT_MAX)) { | ||
| 823 | pos = parent_sd->s_dir.children; | ||
| 824 | while (pos && (ino > pos->s_ino)) | ||
| 825 | pos = pos->s_sibling; | ||
| 826 | } | ||
| 827 | return pos; | ||
| 828 | } | ||
| 829 | |||
| 830 | static struct sysfs_dirent *sysfs_dir_next_pos(struct sysfs_dirent *parent_sd, | ||
| 831 | ino_t ino, struct sysfs_dirent *pos) | ||
| 832 | { | ||
| 833 | pos = sysfs_dir_pos(parent_sd, ino, pos); | ||
| 834 | if (pos) | ||
| 835 | pos = pos->s_sibling; | ||
| 836 | return pos; | ||
| 837 | } | ||
| 838 | |||
| 840 | static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir) | 839 | static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir) |
| 841 | { | 840 | { |
| 842 | struct dentry *dentry = filp->f_path.dentry; | 841 | struct dentry *dentry = filp->f_path.dentry; |
| 843 | struct sysfs_dirent * parent_sd = dentry->d_fsdata; | 842 | struct sysfs_dirent * parent_sd = dentry->d_fsdata; |
| 844 | struct sysfs_dirent *pos; | 843 | struct sysfs_dirent *pos = filp->private_data; |
| 845 | ino_t ino; | 844 | ino_t ino; |
| 846 | 845 | ||
| 847 | if (filp->f_pos == 0) { | 846 | if (filp->f_pos == 0) { |
| @@ -857,29 +856,31 @@ static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir) | |||
| 857 | if (filldir(dirent, "..", 2, filp->f_pos, ino, DT_DIR) == 0) | 856 | if (filldir(dirent, "..", 2, filp->f_pos, ino, DT_DIR) == 0) |
| 858 | filp->f_pos++; | 857 | filp->f_pos++; |
| 859 | } | 858 | } |
| 860 | if ((filp->f_pos > 1) && (filp->f_pos < INT_MAX)) { | 859 | mutex_lock(&sysfs_mutex); |
| 861 | mutex_lock(&sysfs_mutex); | 860 | for (pos = sysfs_dir_pos(parent_sd, filp->f_pos, pos); |
| 862 | 861 | pos; | |
| 863 | /* Skip the dentries we have already reported */ | 862 | pos = sysfs_dir_next_pos(parent_sd, filp->f_pos, pos)) { |
| 864 | pos = parent_sd->s_dir.children; | 863 | const char * name; |
| 865 | while (pos && (filp->f_pos > pos->s_ino)) | 864 | unsigned int type; |
| 866 | pos = pos->s_sibling; | 865 | int len, ret; |
| 867 | 866 | ||
| 868 | for ( ; pos; pos = pos->s_sibling) { | 867 | name = pos->s_name; |
| 869 | const char * name; | 868 | len = strlen(name); |
| 870 | int len; | 869 | ino = pos->s_ino; |
| 871 | 870 | type = dt_type(pos); | |
| 872 | name = pos->s_name; | 871 | filp->f_pos = ino; |
| 873 | len = strlen(name); | 872 | filp->private_data = sysfs_get(pos); |
| 874 | filp->f_pos = ino = pos->s_ino; | ||
| 875 | 873 | ||
| 876 | if (filldir(dirent, name, len, filp->f_pos, ino, | ||
| 877 | dt_type(pos)) < 0) | ||
| 878 | break; | ||
| 879 | } | ||
| 880 | if (!pos) | ||
| 881 | filp->f_pos = INT_MAX; | ||
| 882 | mutex_unlock(&sysfs_mutex); | 874 | mutex_unlock(&sysfs_mutex); |
| 875 | ret = filldir(dirent, name, len, filp->f_pos, ino, type); | ||
| 876 | mutex_lock(&sysfs_mutex); | ||
| 877 | if (ret < 0) | ||
| 878 | break; | ||
| 879 | } | ||
| 880 | mutex_unlock(&sysfs_mutex); | ||
| 881 | if ((filp->f_pos > 1) && !pos) { /* EOF */ | ||
| 882 | filp->f_pos = INT_MAX; | ||
| 883 | filp->private_data = NULL; | ||
| 883 | } | 884 | } |
| 884 | return 0; | 885 | return 0; |
| 885 | } | 886 | } |
| @@ -888,5 +889,6 @@ static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir) | |||
| 888 | const struct file_operations sysfs_dir_operations = { | 889 | const struct file_operations sysfs_dir_operations = { |
| 889 | .read = generic_read_dir, | 890 | .read = generic_read_dir, |
| 890 | .readdir = sysfs_readdir, | 891 | .readdir = sysfs_readdir, |
| 892 | .release = sysfs_dir_release, | ||
| 891 | .llseek = generic_file_llseek, | 893 | .llseek = generic_file_llseek, |
| 892 | }; | 894 | }; |
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index dc30d9e31683..e222b2582746 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
| @@ -53,7 +53,7 @@ struct sysfs_buffer { | |||
| 53 | size_t count; | 53 | size_t count; |
| 54 | loff_t pos; | 54 | loff_t pos; |
| 55 | char * page; | 55 | char * page; |
| 56 | struct sysfs_ops * ops; | 56 | const struct sysfs_ops * ops; |
| 57 | struct mutex mutex; | 57 | struct mutex mutex; |
| 58 | int needs_read_fill; | 58 | int needs_read_fill; |
| 59 | int event; | 59 | int event; |
| @@ -75,7 +75,7 @@ static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer | |||
| 75 | { | 75 | { |
| 76 | struct sysfs_dirent *attr_sd = dentry->d_fsdata; | 76 | struct sysfs_dirent *attr_sd = dentry->d_fsdata; |
| 77 | struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; | 77 | struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; |
| 78 | struct sysfs_ops * ops = buffer->ops; | 78 | const struct sysfs_ops * ops = buffer->ops; |
| 79 | int ret = 0; | 79 | int ret = 0; |
| 80 | ssize_t count; | 80 | ssize_t count; |
| 81 | 81 | ||
| @@ -85,13 +85,13 @@ static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer | |||
| 85 | return -ENOMEM; | 85 | return -ENOMEM; |
| 86 | 86 | ||
| 87 | /* need attr_sd for attr and ops, its parent for kobj */ | 87 | /* need attr_sd for attr and ops, its parent for kobj */ |
| 88 | if (!sysfs_get_active_two(attr_sd)) | 88 | if (!sysfs_get_active(attr_sd)) |
| 89 | return -ENODEV; | 89 | return -ENODEV; |
| 90 | 90 | ||
| 91 | buffer->event = atomic_read(&attr_sd->s_attr.open->event); | 91 | buffer->event = atomic_read(&attr_sd->s_attr.open->event); |
| 92 | count = ops->show(kobj, attr_sd->s_attr.attr, buffer->page); | 92 | count = ops->show(kobj, attr_sd->s_attr.attr, buffer->page); |
| 93 | 93 | ||
| 94 | sysfs_put_active_two(attr_sd); | 94 | sysfs_put_active(attr_sd); |
| 95 | 95 | ||
| 96 | /* | 96 | /* |
| 97 | * The code works fine with PAGE_SIZE return but it's likely to | 97 | * The code works fine with PAGE_SIZE return but it's likely to |
| @@ -199,16 +199,16 @@ flush_write_buffer(struct dentry * dentry, struct sysfs_buffer * buffer, size_t | |||
| 199 | { | 199 | { |
| 200 | struct sysfs_dirent *attr_sd = dentry->d_fsdata; | 200 | struct sysfs_dirent *attr_sd = dentry->d_fsdata; |
| 201 | struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; | 201 | struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; |
| 202 | struct sysfs_ops * ops = buffer->ops; | 202 | const struct sysfs_ops * ops = buffer->ops; |
| 203 | int rc; | 203 | int rc; |
| 204 | 204 | ||
| 205 | /* need attr_sd for attr and ops, its parent for kobj */ | 205 | /* need attr_sd for attr and ops, its parent for kobj */ |
| 206 | if (!sysfs_get_active_two(attr_sd)) | 206 | if (!sysfs_get_active(attr_sd)) |
| 207 | return -ENODEV; | 207 | return -ENODEV; |
| 208 | 208 | ||
| 209 | rc = ops->store(kobj, attr_sd->s_attr.attr, buffer->page, count); | 209 | rc = ops->store(kobj, attr_sd->s_attr.attr, buffer->page, count); |
| 210 | 210 | ||
| 211 | sysfs_put_active_two(attr_sd); | 211 | sysfs_put_active(attr_sd); |
| 212 | 212 | ||
| 213 | return rc; | 213 | return rc; |
| 214 | } | 214 | } |
| @@ -335,7 +335,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file) | |||
| 335 | struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; | 335 | struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; |
| 336 | struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; | 336 | struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; |
| 337 | struct sysfs_buffer *buffer; | 337 | struct sysfs_buffer *buffer; |
| 338 | struct sysfs_ops *ops; | 338 | const struct sysfs_ops *ops; |
| 339 | int error = -EACCES; | 339 | int error = -EACCES; |
| 340 | char *p; | 340 | char *p; |
| 341 | 341 | ||
| @@ -344,7 +344,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file) | |||
| 344 | memmove(last_sysfs_file, p, strlen(p) + 1); | 344 | memmove(last_sysfs_file, p, strlen(p) + 1); |
| 345 | 345 | ||
| 346 | /* need attr_sd for attr and ops, its parent for kobj */ | 346 | /* need attr_sd for attr and ops, its parent for kobj */ |
| 347 | if (!sysfs_get_active_two(attr_sd)) | 347 | if (!sysfs_get_active(attr_sd)) |
| 348 | return -ENODEV; | 348 | return -ENODEV; |
| 349 | 349 | ||
| 350 | /* every kobject with an attribute needs a ktype assigned */ | 350 | /* every kobject with an attribute needs a ktype assigned */ |
| @@ -393,13 +393,13 @@ static int sysfs_open_file(struct inode *inode, struct file *file) | |||
| 393 | goto err_free; | 393 | goto err_free; |
| 394 | 394 | ||
| 395 | /* open succeeded, put active references */ | 395 | /* open succeeded, put active references */ |
| 396 | sysfs_put_active_two(attr_sd); | 396 | sysfs_put_active(attr_sd); |
| 397 | return 0; | 397 | return 0; |
| 398 | 398 | ||
| 399 | err_free: | 399 | err_free: |
| 400 | kfree(buffer); | 400 | kfree(buffer); |
| 401 | err_out: | 401 | err_out: |
| 402 | sysfs_put_active_two(attr_sd); | 402 | sysfs_put_active(attr_sd); |
| 403 | return error; | 403 | return error; |
| 404 | } | 404 | } |
| 405 | 405 | ||
| @@ -437,12 +437,12 @@ static unsigned int sysfs_poll(struct file *filp, poll_table *wait) | |||
| 437 | struct sysfs_open_dirent *od = attr_sd->s_attr.open; | 437 | struct sysfs_open_dirent *od = attr_sd->s_attr.open; |
| 438 | 438 | ||
| 439 | /* need parent for the kobj, grab both */ | 439 | /* need parent for the kobj, grab both */ |
| 440 | if (!sysfs_get_active_two(attr_sd)) | 440 | if (!sysfs_get_active(attr_sd)) |
| 441 | goto trigger; | 441 | goto trigger; |
| 442 | 442 | ||
| 443 | poll_wait(filp, &od->poll, wait); | 443 | poll_wait(filp, &od->poll, wait); |
| 444 | 444 | ||
| 445 | sysfs_put_active_two(attr_sd); | 445 | sysfs_put_active(attr_sd); |
| 446 | 446 | ||
| 447 | if (buffer->event != atomic_read(&od->event)) | 447 | if (buffer->event != atomic_read(&od->event)) |
| 448 | goto trigger; | 448 | goto trigger; |
| @@ -509,6 +509,7 @@ int sysfs_add_file_mode(struct sysfs_dirent *dir_sd, | |||
| 509 | if (!sd) | 509 | if (!sd) |
| 510 | return -ENOMEM; | 510 | return -ENOMEM; |
| 511 | sd->s_attr.attr = (void *)attr; | 511 | sd->s_attr.attr = (void *)attr; |
| 512 | sysfs_dirent_init_lockdep(sd); | ||
| 512 | 513 | ||
| 513 | sysfs_addrm_start(&acxt, dir_sd); | 514 | sysfs_addrm_start(&acxt, dir_sd); |
| 514 | rc = sysfs_add_one(&acxt, sd); | 515 | rc = sysfs_add_one(&acxt, sd); |
| @@ -542,6 +543,18 @@ int sysfs_create_file(struct kobject * kobj, const struct attribute * attr) | |||
| 542 | 543 | ||
| 543 | } | 544 | } |
| 544 | 545 | ||
| 546 | int sysfs_create_files(struct kobject *kobj, const struct attribute **ptr) | ||
| 547 | { | ||
| 548 | int err = 0; | ||
| 549 | int i; | ||
| 550 | |||
| 551 | for (i = 0; ptr[i] && !err; i++) | ||
| 552 | err = sysfs_create_file(kobj, ptr[i]); | ||
| 553 | if (err) | ||
| 554 | while (--i >= 0) | ||
| 555 | sysfs_remove_file(kobj, ptr[i]); | ||
| 556 | return err; | ||
| 557 | } | ||
| 545 | 558 | ||
| 546 | /** | 559 | /** |
| 547 | * sysfs_add_file_to_group - add an attribute file to a pre-existing group. | 560 | * sysfs_add_file_to_group - add an attribute file to a pre-existing group. |
| @@ -614,6 +627,12 @@ void sysfs_remove_file(struct kobject * kobj, const struct attribute * attr) | |||
| 614 | sysfs_hash_and_remove(kobj->sd, attr->name); | 627 | sysfs_hash_and_remove(kobj->sd, attr->name); |
| 615 | } | 628 | } |
| 616 | 629 | ||
| 630 | void sysfs_remove_files(struct kobject * kobj, const struct attribute **ptr) | ||
| 631 | { | ||
| 632 | int i; | ||
| 633 | for (i = 0; ptr[i]; i++) | ||
| 634 | sysfs_remove_file(kobj, ptr[i]); | ||
| 635 | } | ||
| 617 | 636 | ||
| 618 | /** | 637 | /** |
| 619 | * sysfs_remove_file_from_group - remove an attribute file from a group. | 638 | * sysfs_remove_file_from_group - remove an attribute file from a group. |
| @@ -732,3 +751,5 @@ EXPORT_SYMBOL_GPL(sysfs_schedule_callback); | |||
| 732 | 751 | ||
| 733 | EXPORT_SYMBOL_GPL(sysfs_create_file); | 752 | EXPORT_SYMBOL_GPL(sysfs_create_file); |
| 734 | EXPORT_SYMBOL_GPL(sysfs_remove_file); | 753 | EXPORT_SYMBOL_GPL(sysfs_remove_file); |
| 754 | EXPORT_SYMBOL_GPL(sysfs_remove_files); | ||
| 755 | EXPORT_SYMBOL_GPL(sysfs_create_files); | ||
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index 6a06a1d1ea7b..082daaecac1b 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c | |||
| @@ -111,20 +111,20 @@ int sysfs_setattr(struct dentry *dentry, struct iattr *iattr) | |||
| 111 | if (!sd) | 111 | if (!sd) |
| 112 | return -EINVAL; | 112 | return -EINVAL; |
| 113 | 113 | ||
| 114 | mutex_lock(&sysfs_mutex); | ||
| 114 | error = inode_change_ok(inode, iattr); | 115 | error = inode_change_ok(inode, iattr); |
| 115 | if (error) | 116 | if (error) |
| 116 | return error; | 117 | goto out; |
| 117 | 118 | ||
| 118 | iattr->ia_valid &= ~ATTR_SIZE; /* ignore size changes */ | 119 | iattr->ia_valid &= ~ATTR_SIZE; /* ignore size changes */ |
| 119 | 120 | ||
| 120 | error = inode_setattr(inode, iattr); | 121 | error = inode_setattr(inode, iattr); |
| 121 | if (error) | 122 | if (error) |
| 122 | return error; | 123 | goto out; |
| 123 | 124 | ||
| 124 | mutex_lock(&sysfs_mutex); | ||
| 125 | error = sysfs_sd_setattr(sd, iattr); | 125 | error = sysfs_sd_setattr(sd, iattr); |
| 126 | out: | ||
| 126 | mutex_unlock(&sysfs_mutex); | 127 | mutex_unlock(&sysfs_mutex); |
| 127 | |||
| 128 | return error; | 128 | return error; |
| 129 | } | 129 | } |
| 130 | 130 | ||
| @@ -283,6 +283,7 @@ static void sysfs_init_inode(struct sysfs_dirent *sd, struct inode *inode) | |||
| 283 | 283 | ||
| 284 | /** | 284 | /** |
| 285 | * sysfs_get_inode - get inode for sysfs_dirent | 285 | * sysfs_get_inode - get inode for sysfs_dirent |
| 286 | * @sb: super block | ||
| 286 | * @sd: sysfs_dirent to allocate inode for | 287 | * @sd: sysfs_dirent to allocate inode for |
| 287 | * | 288 | * |
| 288 | * Get inode for @sd. If such inode doesn't exist, a new inode | 289 | * Get inode for @sd. If such inode doesn't exist, a new inode |
| @@ -295,11 +296,11 @@ static void sysfs_init_inode(struct sysfs_dirent *sd, struct inode *inode) | |||
| 295 | * RETURNS: | 296 | * RETURNS: |
| 296 | * Pointer to allocated inode on success, NULL on failure. | 297 | * Pointer to allocated inode on success, NULL on failure. |
| 297 | */ | 298 | */ |
| 298 | struct inode * sysfs_get_inode(struct sysfs_dirent *sd) | 299 | struct inode * sysfs_get_inode(struct super_block *sb, struct sysfs_dirent *sd) |
| 299 | { | 300 | { |
| 300 | struct inode *inode; | 301 | struct inode *inode; |
| 301 | 302 | ||
| 302 | inode = iget_locked(sysfs_sb, sd->s_ino); | 303 | inode = iget_locked(sb, sd->s_ino); |
| 303 | if (inode && (inode->i_state & I_NEW)) | 304 | if (inode && (inode->i_state & I_NEW)) |
| 304 | sysfs_init_inode(sd, inode); | 305 | sysfs_init_inode(sd, inode); |
| 305 | 306 | ||
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c index 49749955ccaf..0cb10884a2fc 100644 --- a/fs/sysfs/mount.c +++ b/fs/sysfs/mount.c | |||
| @@ -23,7 +23,6 @@ | |||
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | static struct vfsmount *sysfs_mount; | 25 | static struct vfsmount *sysfs_mount; |
| 26 | struct super_block * sysfs_sb = NULL; | ||
| 27 | struct kmem_cache *sysfs_dir_cachep; | 26 | struct kmem_cache *sysfs_dir_cachep; |
| 28 | 27 | ||
| 29 | static const struct super_operations sysfs_ops = { | 28 | static const struct super_operations sysfs_ops = { |
| @@ -50,11 +49,10 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 50 | sb->s_magic = SYSFS_MAGIC; | 49 | sb->s_magic = SYSFS_MAGIC; |
| 51 | sb->s_op = &sysfs_ops; | 50 | sb->s_op = &sysfs_ops; |
| 52 | sb->s_time_gran = 1; | 51 | sb->s_time_gran = 1; |
| 53 | sysfs_sb = sb; | ||
| 54 | 52 | ||
| 55 | /* get root inode, initialize and unlock it */ | 53 | /* get root inode, initialize and unlock it */ |
| 56 | mutex_lock(&sysfs_mutex); | 54 | mutex_lock(&sysfs_mutex); |
| 57 | inode = sysfs_get_inode(&sysfs_root); | 55 | inode = sysfs_get_inode(sb, &sysfs_root); |
| 58 | mutex_unlock(&sysfs_mutex); | 56 | mutex_unlock(&sysfs_mutex); |
| 59 | if (!inode) { | 57 | if (!inode) { |
| 60 | pr_debug("sysfs: could not get root inode\n"); | 58 | pr_debug("sysfs: could not get root inode\n"); |
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c index c5eff49fa41b..1b9a3a1e8a17 100644 --- a/fs/sysfs/symlink.c +++ b/fs/sysfs/symlink.c | |||
| @@ -123,6 +123,44 @@ void sysfs_remove_link(struct kobject * kobj, const char * name) | |||
| 123 | sysfs_hash_and_remove(parent_sd, name); | 123 | sysfs_hash_and_remove(parent_sd, name); |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | /** | ||
| 127 | * sysfs_rename_link - rename symlink in object's directory. | ||
| 128 | * @kobj: object we're acting for. | ||
| 129 | * @targ: object we're pointing to. | ||
| 130 | * @old: previous name of the symlink. | ||
| 131 | * @new: new name of the symlink. | ||
| 132 | * | ||
| 133 | * A helper function for the common rename symlink idiom. | ||
| 134 | */ | ||
| 135 | int sysfs_rename_link(struct kobject *kobj, struct kobject *targ, | ||
| 136 | const char *old, const char *new) | ||
| 137 | { | ||
| 138 | struct sysfs_dirent *parent_sd, *sd = NULL; | ||
| 139 | int result; | ||
| 140 | |||
| 141 | if (!kobj) | ||
| 142 | parent_sd = &sysfs_root; | ||
| 143 | else | ||
| 144 | parent_sd = kobj->sd; | ||
| 145 | |||
| 146 | result = -ENOENT; | ||
| 147 | sd = sysfs_get_dirent(parent_sd, old); | ||
| 148 | if (!sd) | ||
| 149 | goto out; | ||
| 150 | |||
| 151 | result = -EINVAL; | ||
| 152 | if (sysfs_type(sd) != SYSFS_KOBJ_LINK) | ||
| 153 | goto out; | ||
| 154 | if (sd->s_symlink.target_sd->s_dir.kobj != targ) | ||
| 155 | goto out; | ||
| 156 | |||
| 157 | result = sysfs_rename(sd, parent_sd, new); | ||
| 158 | |||
| 159 | out: | ||
| 160 | sysfs_put(sd); | ||
| 161 | return result; | ||
| 162 | } | ||
| 163 | |||
| 126 | static int sysfs_get_target_path(struct sysfs_dirent *parent_sd, | 164 | static int sysfs_get_target_path(struct sysfs_dirent *parent_sd, |
| 127 | struct sysfs_dirent *target_sd, char *path) | 165 | struct sysfs_dirent *target_sd, char *path) |
| 128 | { | 166 | { |
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h index cdd9377a6e06..30f5a44fb5d3 100644 --- a/fs/sysfs/sysfs.h +++ b/fs/sysfs/sysfs.h | |||
| @@ -66,8 +66,8 @@ struct sysfs_dirent { | |||
| 66 | }; | 66 | }; |
| 67 | 67 | ||
| 68 | unsigned int s_flags; | 68 | unsigned int s_flags; |
| 69 | unsigned short s_mode; | ||
| 69 | ino_t s_ino; | 70 | ino_t s_ino; |
| 70 | umode_t s_mode; | ||
| 71 | struct sysfs_inode_attrs *s_iattr; | 71 | struct sysfs_inode_attrs *s_iattr; |
| 72 | }; | 72 | }; |
| 73 | 73 | ||
| @@ -79,6 +79,7 @@ struct sysfs_dirent { | |||
| 79 | #define SYSFS_KOBJ_BIN_ATTR 0x0004 | 79 | #define SYSFS_KOBJ_BIN_ATTR 0x0004 |
| 80 | #define SYSFS_KOBJ_LINK 0x0008 | 80 | #define SYSFS_KOBJ_LINK 0x0008 |
| 81 | #define SYSFS_COPY_NAME (SYSFS_DIR | SYSFS_KOBJ_LINK) | 81 | #define SYSFS_COPY_NAME (SYSFS_DIR | SYSFS_KOBJ_LINK) |
| 82 | #define SYSFS_ACTIVE_REF (SYSFS_KOBJ_ATTR | SYSFS_KOBJ_BIN_ATTR) | ||
| 82 | 83 | ||
| 83 | #define SYSFS_FLAG_MASK ~SYSFS_TYPE_MASK | 84 | #define SYSFS_FLAG_MASK ~SYSFS_TYPE_MASK |
| 84 | #define SYSFS_FLAG_REMOVED 0x0200 | 85 | #define SYSFS_FLAG_REMOVED 0x0200 |
| @@ -91,9 +92,12 @@ static inline unsigned int sysfs_type(struct sysfs_dirent *sd) | |||
| 91 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 92 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 92 | #define sysfs_dirent_init_lockdep(sd) \ | 93 | #define sysfs_dirent_init_lockdep(sd) \ |
| 93 | do { \ | 94 | do { \ |
| 94 | static struct lock_class_key __key; \ | 95 | struct attribute *attr = sd->s_attr.attr; \ |
| 96 | struct lock_class_key *key = attr->key; \ | ||
| 97 | if (!key) \ | ||
| 98 | key = &attr->skey; \ | ||
| 95 | \ | 99 | \ |
| 96 | lockdep_init_map(&sd->dep_map, "s_active", &__key, 0); \ | 100 | lockdep_init_map(&sd->dep_map, "s_active", key, 0); \ |
| 97 | } while(0) | 101 | } while(0) |
| 98 | #else | 102 | #else |
| 99 | #define sysfs_dirent_init_lockdep(sd) do {} while(0) | 103 | #define sysfs_dirent_init_lockdep(sd) do {} while(0) |
| @@ -111,7 +115,6 @@ struct sysfs_addrm_cxt { | |||
| 111 | * mount.c | 115 | * mount.c |
| 112 | */ | 116 | */ |
| 113 | extern struct sysfs_dirent sysfs_root; | 117 | extern struct sysfs_dirent sysfs_root; |
| 114 | extern struct super_block *sysfs_sb; | ||
| 115 | extern struct kmem_cache *sysfs_dir_cachep; | 118 | extern struct kmem_cache *sysfs_dir_cachep; |
| 116 | 119 | ||
| 117 | /* | 120 | /* |
| @@ -124,8 +127,8 @@ extern const struct file_operations sysfs_dir_operations; | |||
| 124 | extern const struct inode_operations sysfs_dir_inode_operations; | 127 | extern const struct inode_operations sysfs_dir_inode_operations; |
| 125 | 128 | ||
| 126 | struct dentry *sysfs_get_dentry(struct sysfs_dirent *sd); | 129 | struct dentry *sysfs_get_dentry(struct sysfs_dirent *sd); |
| 127 | struct sysfs_dirent *sysfs_get_active_two(struct sysfs_dirent *sd); | 130 | struct sysfs_dirent *sysfs_get_active(struct sysfs_dirent *sd); |
| 128 | void sysfs_put_active_two(struct sysfs_dirent *sd); | 131 | void sysfs_put_active(struct sysfs_dirent *sd); |
| 129 | void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt, | 132 | void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt, |
| 130 | struct sysfs_dirent *parent_sd); | 133 | struct sysfs_dirent *parent_sd); |
| 131 | int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd); | 134 | int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd); |
| @@ -168,7 +171,7 @@ static inline void __sysfs_put(struct sysfs_dirent *sd) | |||
| 168 | /* | 171 | /* |
| 169 | * inode.c | 172 | * inode.c |
| 170 | */ | 173 | */ |
| 171 | struct inode *sysfs_get_inode(struct sysfs_dirent *sd); | 174 | struct inode *sysfs_get_inode(struct super_block *sb, struct sysfs_dirent *sd); |
| 172 | void sysfs_delete_inode(struct inode *inode); | 175 | void sysfs_delete_inode(struct inode *inode); |
| 173 | int sysfs_sd_setattr(struct sysfs_dirent *sd, struct iattr *iattr); | 176 | int sysfs_sd_setattr(struct sysfs_dirent *sd, struct iattr *iattr); |
| 174 | int sysfs_permission(struct inode *inode, int mask); | 177 | int sysfs_permission(struct inode *inode, int mask); |
diff --git a/include/linux/device.h b/include/linux/device.h index b30527db3ac0..182192892d45 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -106,7 +106,7 @@ extern int bus_unregister_notifier(struct bus_type *bus, | |||
| 106 | 106 | ||
| 107 | /* All 4 notifers below get called with the target struct device * | 107 | /* All 4 notifers below get called with the target struct device * |
| 108 | * as an argument. Note that those functions are likely to be called | 108 | * as an argument. Note that those functions are likely to be called |
| 109 | * with the device semaphore held in the core, so be careful. | 109 | * with the device lock held in the core, so be careful. |
| 110 | */ | 110 | */ |
| 111 | #define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */ | 111 | #define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */ |
| 112 | #define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */ | 112 | #define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */ |
| @@ -251,8 +251,10 @@ extern struct device *class_find_device(struct class *class, | |||
| 251 | 251 | ||
| 252 | struct class_attribute { | 252 | struct class_attribute { |
| 253 | struct attribute attr; | 253 | struct attribute attr; |
| 254 | ssize_t (*show)(struct class *class, char *buf); | 254 | ssize_t (*show)(struct class *class, struct class_attribute *attr, |
| 255 | ssize_t (*store)(struct class *class, const char *buf, size_t count); | 255 | char *buf); |
| 256 | ssize_t (*store)(struct class *class, struct class_attribute *attr, | ||
| 257 | const char *buf, size_t count); | ||
| 256 | }; | 258 | }; |
| 257 | 259 | ||
| 258 | #define CLASS_ATTR(_name, _mode, _show, _store) \ | 260 | #define CLASS_ATTR(_name, _mode, _show, _store) \ |
| @@ -263,6 +265,23 @@ extern int __must_check class_create_file(struct class *class, | |||
| 263 | extern void class_remove_file(struct class *class, | 265 | extern void class_remove_file(struct class *class, |
| 264 | const struct class_attribute *attr); | 266 | const struct class_attribute *attr); |
| 265 | 267 | ||
| 268 | /* Simple class attribute that is just a static string */ | ||
| 269 | |||
| 270 | struct class_attribute_string { | ||
| 271 | struct class_attribute attr; | ||
| 272 | char *str; | ||
| 273 | }; | ||
| 274 | |||
| 275 | /* Currently read-only only */ | ||
| 276 | #define _CLASS_ATTR_STRING(_name, _mode, _str) \ | ||
| 277 | { __ATTR(_name, _mode, show_class_attr_string, NULL), _str } | ||
| 278 | #define CLASS_ATTR_STRING(_name, _mode, _str) \ | ||
| 279 | struct class_attribute_string class_attr_##_name = \ | ||
| 280 | _CLASS_ATTR_STRING(_name, _mode, _str) | ||
| 281 | |||
| 282 | extern ssize_t show_class_attr_string(struct class *class, struct class_attribute *attr, | ||
| 283 | char *buf); | ||
| 284 | |||
| 266 | struct class_interface { | 285 | struct class_interface { |
| 267 | struct list_head node; | 286 | struct list_head node; |
| 268 | struct class *class; | 287 | struct class *class; |
| @@ -489,6 +508,21 @@ static inline bool device_async_suspend_enabled(struct device *dev) | |||
| 489 | return !!dev->power.async_suspend; | 508 | return !!dev->power.async_suspend; |
| 490 | } | 509 | } |
| 491 | 510 | ||
| 511 | static inline void device_lock(struct device *dev) | ||
| 512 | { | ||
| 513 | down(&dev->sem); | ||
| 514 | } | ||
| 515 | |||
| 516 | static inline int device_trylock(struct device *dev) | ||
| 517 | { | ||
| 518 | return down_trylock(&dev->sem); | ||
| 519 | } | ||
| 520 | |||
| 521 | static inline void device_unlock(struct device *dev) | ||
| 522 | { | ||
| 523 | up(&dev->sem); | ||
| 524 | } | ||
| 525 | |||
| 492 | void driver_init(void); | 526 | void driver_init(void); |
| 493 | 527 | ||
| 494 | /* | 528 | /* |
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 58ae8e00fcdd..3950d3c2850d 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
| @@ -106,7 +106,7 @@ extern char *kobject_get_path(struct kobject *kobj, gfp_t flag); | |||
| 106 | 106 | ||
| 107 | struct kobj_type { | 107 | struct kobj_type { |
| 108 | void (*release)(struct kobject *kobj); | 108 | void (*release)(struct kobject *kobj); |
| 109 | struct sysfs_ops *sysfs_ops; | 109 | const struct sysfs_ops *sysfs_ops; |
| 110 | struct attribute **default_attrs; | 110 | struct attribute **default_attrs; |
| 111 | }; | 111 | }; |
| 112 | 112 | ||
| @@ -118,9 +118,9 @@ struct kobj_uevent_env { | |||
| 118 | }; | 118 | }; |
| 119 | 119 | ||
| 120 | struct kset_uevent_ops { | 120 | struct kset_uevent_ops { |
| 121 | int (*filter)(struct kset *kset, struct kobject *kobj); | 121 | int (* const filter)(struct kset *kset, struct kobject *kobj); |
| 122 | const char *(*name)(struct kset *kset, struct kobject *kobj); | 122 | const char *(* const name)(struct kset *kset, struct kobject *kobj); |
| 123 | int (*uevent)(struct kset *kset, struct kobject *kobj, | 123 | int (* const uevent)(struct kset *kset, struct kobject *kobj, |
| 124 | struct kobj_uevent_env *env); | 124 | struct kobj_uevent_env *env); |
| 125 | }; | 125 | }; |
| 126 | 126 | ||
| @@ -132,7 +132,7 @@ struct kobj_attribute { | |||
| 132 | const char *buf, size_t count); | 132 | const char *buf, size_t count); |
| 133 | }; | 133 | }; |
| 134 | 134 | ||
| 135 | extern struct sysfs_ops kobj_sysfs_ops; | 135 | extern const struct sysfs_ops kobj_sysfs_ops; |
| 136 | 136 | ||
| 137 | /** | 137 | /** |
| 138 | * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem. | 138 | * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem. |
| @@ -155,14 +155,14 @@ struct kset { | |||
| 155 | struct list_head list; | 155 | struct list_head list; |
| 156 | spinlock_t list_lock; | 156 | spinlock_t list_lock; |
| 157 | struct kobject kobj; | 157 | struct kobject kobj; |
| 158 | struct kset_uevent_ops *uevent_ops; | 158 | const struct kset_uevent_ops *uevent_ops; |
| 159 | }; | 159 | }; |
| 160 | 160 | ||
| 161 | extern void kset_init(struct kset *kset); | 161 | extern void kset_init(struct kset *kset); |
| 162 | extern int __must_check kset_register(struct kset *kset); | 162 | extern int __must_check kset_register(struct kset *kset); |
| 163 | extern void kset_unregister(struct kset *kset); | 163 | extern void kset_unregister(struct kset *kset); |
| 164 | extern struct kset * __must_check kset_create_and_add(const char *name, | 164 | extern struct kset * __must_check kset_create_and_add(const char *name, |
| 165 | struct kset_uevent_ops *u, | 165 | const struct kset_uevent_ops *u, |
| 166 | struct kobject *parent_kobj); | 166 | struct kobject *parent_kobj); |
| 167 | 167 | ||
| 168 | static inline struct kset *to_kset(struct kobject *kobj) | 168 | static inline struct kset *to_kset(struct kobject *kobj) |
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 71ff887ca44e..212da17d06af 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h | |||
| @@ -21,7 +21,7 @@ struct platform_device { | |||
| 21 | u32 num_resources; | 21 | u32 num_resources; |
| 22 | struct resource * resource; | 22 | struct resource * resource; |
| 23 | 23 | ||
| 24 | struct platform_device_id *id_entry; | 24 | const struct platform_device_id *id_entry; |
| 25 | 25 | ||
| 26 | /* arch specific additions */ | 26 | /* arch specific additions */ |
| 27 | struct pdev_archdata archdata; | 27 | struct pdev_archdata archdata; |
| @@ -62,7 +62,7 @@ struct platform_driver { | |||
| 62 | int (*suspend)(struct platform_device *, pm_message_t state); | 62 | int (*suspend)(struct platform_device *, pm_message_t state); |
| 63 | int (*resume)(struct platform_device *); | 63 | int (*resume)(struct platform_device *); |
| 64 | struct device_driver driver; | 64 | struct device_driver driver; |
| 65 | struct platform_device_id *id_table; | 65 | const struct platform_device_id *id_table; |
| 66 | }; | 66 | }; |
| 67 | 67 | ||
| 68 | extern int platform_driver_register(struct platform_driver *); | 68 | extern int platform_driver_register(struct platform_driver *); |
| @@ -77,6 +77,11 @@ extern int platform_driver_probe(struct platform_driver *driver, | |||
| 77 | #define platform_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev) | 77 | #define platform_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev) |
| 78 | #define platform_set_drvdata(_dev,data) dev_set_drvdata(&(_dev)->dev, (data)) | 78 | #define platform_set_drvdata(_dev,data) dev_set_drvdata(&(_dev)->dev, (data)) |
| 79 | 79 | ||
| 80 | extern struct platform_device *platform_create_bundle(struct platform_driver *driver, | ||
| 81 | int (*probe)(struct platform_device *), | ||
| 82 | struct resource *res, unsigned int n_res, | ||
| 83 | const void *data, size_t size); | ||
| 84 | |||
| 80 | /* early platform driver interface */ | 85 | /* early platform driver interface */ |
| 81 | struct early_platform_driver { | 86 | struct early_platform_driver { |
| 82 | const char *class_str; | 87 | const char *class_str; |
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h index f395bb3fa2f2..1154c29f4101 100644 --- a/include/linux/sysdev.h +++ b/include/linux/sysdev.h | |||
| @@ -27,10 +27,12 @@ | |||
| 27 | 27 | ||
| 28 | 28 | ||
| 29 | struct sys_device; | 29 | struct sys_device; |
| 30 | struct sysdev_class_attribute; | ||
| 30 | 31 | ||
| 31 | struct sysdev_class { | 32 | struct sysdev_class { |
| 32 | const char *name; | 33 | const char *name; |
| 33 | struct list_head drivers; | 34 | struct list_head drivers; |
| 35 | struct sysdev_class_attribute **attrs; | ||
| 34 | 36 | ||
| 35 | /* Default operations for these types of devices */ | 37 | /* Default operations for these types of devices */ |
| 36 | int (*shutdown)(struct sys_device *); | 38 | int (*shutdown)(struct sys_device *); |
| @@ -41,8 +43,10 @@ struct sysdev_class { | |||
| 41 | 43 | ||
| 42 | struct sysdev_class_attribute { | 44 | struct sysdev_class_attribute { |
| 43 | struct attribute attr; | 45 | struct attribute attr; |
| 44 | ssize_t (*show)(struct sysdev_class *, char *); | 46 | ssize_t (*show)(struct sysdev_class *, struct sysdev_class_attribute *, |
| 45 | ssize_t (*store)(struct sysdev_class *, const char *, size_t); | 47 | char *); |
| 48 | ssize_t (*store)(struct sysdev_class *, struct sysdev_class_attribute *, | ||
| 49 | const char *, size_t); | ||
| 46 | }; | 50 | }; |
| 47 | 51 | ||
| 48 | #define _SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \ | 52 | #define _SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \ |
| @@ -119,6 +123,19 @@ struct sysdev_attribute { | |||
| 119 | extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *); | 123 | extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *); |
| 120 | extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *); | 124 | extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *); |
| 121 | 125 | ||
| 126 | /* Create/remove NULL terminated attribute list */ | ||
| 127 | static inline int | ||
| 128 | sysdev_create_files(struct sys_device *d, struct sysdev_attribute **a) | ||
| 129 | { | ||
| 130 | return sysfs_create_files(&d->kobj, (const struct attribute **)a); | ||
| 131 | } | ||
| 132 | |||
| 133 | static inline void | ||
| 134 | sysdev_remove_files(struct sys_device *d, struct sysdev_attribute **a) | ||
| 135 | { | ||
| 136 | return sysfs_remove_files(&d->kobj, (const struct attribute **)a); | ||
| 137 | } | ||
| 138 | |||
| 122 | struct sysdev_ext_attribute { | 139 | struct sysdev_ext_attribute { |
| 123 | struct sysdev_attribute attr; | 140 | struct sysdev_attribute attr; |
| 124 | void *var; | 141 | void *var; |
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index cfa83083a2d4..f0496b3d1811 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/compiler.h> | 15 | #include <linux/compiler.h> |
| 16 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
| 17 | #include <linux/list.h> | 17 | #include <linux/list.h> |
| 18 | #include <linux/lockdep.h> | ||
| 18 | #include <asm/atomic.h> | 19 | #include <asm/atomic.h> |
| 19 | 20 | ||
| 20 | struct kobject; | 21 | struct kobject; |
| @@ -29,8 +30,33 @@ struct attribute { | |||
| 29 | const char *name; | 30 | const char *name; |
| 30 | struct module *owner; | 31 | struct module *owner; |
| 31 | mode_t mode; | 32 | mode_t mode; |
| 33 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
| 34 | struct lock_class_key *key; | ||
| 35 | struct lock_class_key skey; | ||
| 36 | #endif | ||
| 32 | }; | 37 | }; |
| 33 | 38 | ||
| 39 | /** | ||
| 40 | * sysfs_attr_init - initialize a dynamically allocated sysfs attribute | ||
| 41 | * @attr: struct attribute to initialize | ||
| 42 | * | ||
| 43 | * Initialize a dynamically allocated struct attribute so we can | ||
| 44 | * make lockdep happy. This is a new requirement for attributes | ||
| 45 | * and initially this is only needed when lockdep is enabled. | ||
| 46 | * Lockdep gives a nice error when your attribute is added to | ||
| 47 | * sysfs if you don't have this. | ||
| 48 | */ | ||
| 49 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
| 50 | #define sysfs_attr_init(attr) \ | ||
| 51 | do { \ | ||
| 52 | static struct lock_class_key __key; \ | ||
| 53 | \ | ||
| 54 | (attr)->key = &__key; \ | ||
| 55 | } while(0) | ||
| 56 | #else | ||
| 57 | #define sysfs_attr_init(attr) do {} while(0) | ||
| 58 | #endif | ||
| 59 | |||
| 34 | struct attribute_group { | 60 | struct attribute_group { |
| 35 | const char *name; | 61 | const char *name; |
| 36 | mode_t (*is_visible)(struct kobject *, | 62 | mode_t (*is_visible)(struct kobject *, |
| @@ -74,6 +100,18 @@ struct bin_attribute { | |||
| 74 | struct vm_area_struct *vma); | 100 | struct vm_area_struct *vma); |
| 75 | }; | 101 | }; |
| 76 | 102 | ||
| 103 | /** | ||
| 104 | * sysfs_bin_attr_init - initialize a dynamically allocated bin_attribute | ||
| 105 | * @attr: struct bin_attribute to initialize | ||
| 106 | * | ||
| 107 | * Initialize a dynamically allocated struct bin_attribute so we | ||
| 108 | * can make lockdep happy. This is a new requirement for | ||
| 109 | * attributes and initially this is only needed when lockdep is | ||
| 110 | * enabled. Lockdep gives a nice error when your attribute is | ||
| 111 | * added to sysfs if you don't have this. | ||
| 112 | */ | ||
| 113 | #define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&(bin_attr)->attr) | ||
| 114 | |||
| 77 | struct sysfs_ops { | 115 | struct sysfs_ops { |
| 78 | ssize_t (*show)(struct kobject *, struct attribute *,char *); | 116 | ssize_t (*show)(struct kobject *, struct attribute *,char *); |
| 79 | ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); | 117 | ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); |
| @@ -94,9 +132,12 @@ int __must_check sysfs_move_dir(struct kobject *kobj, | |||
| 94 | 132 | ||
| 95 | int __must_check sysfs_create_file(struct kobject *kobj, | 133 | int __must_check sysfs_create_file(struct kobject *kobj, |
| 96 | const struct attribute *attr); | 134 | const struct attribute *attr); |
| 135 | int __must_check sysfs_create_files(struct kobject *kobj, | ||
| 136 | const struct attribute **attr); | ||
| 97 | int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, | 137 | int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, |
| 98 | mode_t mode); | 138 | mode_t mode); |
| 99 | void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); | 139 | void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); |
| 140 | void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr); | ||
| 100 | 141 | ||
| 101 | int __must_check sysfs_create_bin_file(struct kobject *kobj, | 142 | int __must_check sysfs_create_bin_file(struct kobject *kobj, |
| 102 | const struct bin_attribute *attr); | 143 | const struct bin_attribute *attr); |
| @@ -110,6 +151,9 @@ int __must_check sysfs_create_link_nowarn(struct kobject *kobj, | |||
| 110 | const char *name); | 151 | const char *name); |
| 111 | void sysfs_remove_link(struct kobject *kobj, const char *name); | 152 | void sysfs_remove_link(struct kobject *kobj, const char *name); |
| 112 | 153 | ||
| 154 | int sysfs_rename_link(struct kobject *kobj, struct kobject *target, | ||
| 155 | const char *old_name, const char *new_name); | ||
| 156 | |||
| 113 | int __must_check sysfs_create_group(struct kobject *kobj, | 157 | int __must_check sysfs_create_group(struct kobject *kobj, |
| 114 | const struct attribute_group *grp); | 158 | const struct attribute_group *grp); |
| 115 | int sysfs_update_group(struct kobject *kobj, | 159 | int sysfs_update_group(struct kobject *kobj, |
| @@ -164,6 +208,12 @@ static inline int sysfs_create_file(struct kobject *kobj, | |||
| 164 | return 0; | 208 | return 0; |
| 165 | } | 209 | } |
| 166 | 210 | ||
| 211 | static inline int sysfs_create_files(struct kobject *kobj, | ||
| 212 | const struct attribute **attr) | ||
| 213 | { | ||
| 214 | return 0; | ||
| 215 | } | ||
| 216 | |||
| 167 | static inline int sysfs_chmod_file(struct kobject *kobj, | 217 | static inline int sysfs_chmod_file(struct kobject *kobj, |
| 168 | struct attribute *attr, mode_t mode) | 218 | struct attribute *attr, mode_t mode) |
| 169 | { | 219 | { |
| @@ -175,6 +225,11 @@ static inline void sysfs_remove_file(struct kobject *kobj, | |||
| 175 | { | 225 | { |
| 176 | } | 226 | } |
| 177 | 227 | ||
| 228 | static inline void sysfs_remove_files(struct kobject *kobj, | ||
| 229 | const struct attribute **attr) | ||
| 230 | { | ||
| 231 | } | ||
| 232 | |||
| 178 | static inline int sysfs_create_bin_file(struct kobject *kobj, | 233 | static inline int sysfs_create_bin_file(struct kobject *kobj, |
| 179 | const struct bin_attribute *attr) | 234 | const struct bin_attribute *attr) |
| 180 | { | 235 | { |
| @@ -203,6 +258,12 @@ static inline void sysfs_remove_link(struct kobject *kobj, const char *name) | |||
| 203 | { | 258 | { |
| 204 | } | 259 | } |
| 205 | 260 | ||
| 261 | static inline int sysfs_rename_link(struct kobject *k, struct kobject *t, | ||
| 262 | const char *old_name, const char *new_name) | ||
| 263 | { | ||
| 264 | return 0; | ||
| 265 | } | ||
| 266 | |||
| 206 | static inline int sysfs_create_group(struct kobject *kobj, | 267 | static inline int sysfs_create_group(struct kobject *kobj, |
| 207 | const struct attribute_group *grp) | 268 | const struct attribute_group *grp) |
| 208 | { | 269 | { |
diff --git a/include/linux/usb.h b/include/linux/usb.h index 3492abf82e75..8c9f053111bb 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
| @@ -512,9 +512,9 @@ extern struct usb_device *usb_get_dev(struct usb_device *dev); | |||
| 512 | extern void usb_put_dev(struct usb_device *dev); | 512 | extern void usb_put_dev(struct usb_device *dev); |
| 513 | 513 | ||
| 514 | /* USB device locking */ | 514 | /* USB device locking */ |
| 515 | #define usb_lock_device(udev) down(&(udev)->dev.sem) | 515 | #define usb_lock_device(udev) device_lock(&(udev)->dev) |
| 516 | #define usb_unlock_device(udev) up(&(udev)->dev.sem) | 516 | #define usb_unlock_device(udev) device_unlock(&(udev)->dev) |
| 517 | #define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem) | 517 | #define usb_trylock_device(udev) device_trylock(&(udev)->dev) |
| 518 | extern int usb_lock_device_for_reset(struct usb_device *udev, | 518 | extern int usb_lock_device_for_reset(struct usb_device *udev, |
| 519 | const struct usb_interface *iface); | 519 | const struct usb_interface *iface); |
| 520 | 520 | ||
diff --git a/kernel/module.c b/kernel/module.c index e5538d5f00ad..c968d3606dca 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
| @@ -1085,6 +1085,7 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect, | |||
| 1085 | if (sattr->name == NULL) | 1085 | if (sattr->name == NULL) |
| 1086 | goto out; | 1086 | goto out; |
| 1087 | sect_attrs->nsections++; | 1087 | sect_attrs->nsections++; |
| 1088 | sysfs_attr_init(&sattr->mattr.attr); | ||
| 1088 | sattr->mattr.show = module_sect_show; | 1089 | sattr->mattr.show = module_sect_show; |
| 1089 | sattr->mattr.store = NULL; | 1090 | sattr->mattr.store = NULL; |
| 1090 | sattr->mattr.attr.name = sattr->name; | 1091 | sattr->mattr.attr.name = sattr->name; |
| @@ -1180,6 +1181,7 @@ static void add_notes_attrs(struct module *mod, unsigned int nsect, | |||
| 1180 | if (sect_empty(&sechdrs[i])) | 1181 | if (sect_empty(&sechdrs[i])) |
| 1181 | continue; | 1182 | continue; |
| 1182 | if (sechdrs[i].sh_type == SHT_NOTE) { | 1183 | if (sechdrs[i].sh_type == SHT_NOTE) { |
| 1184 | sysfs_bin_attr_init(nattr); | ||
| 1183 | nattr->attr.name = mod->sect_attrs->attrs[loaded].name; | 1185 | nattr->attr.name = mod->sect_attrs->attrs[loaded].name; |
| 1184 | nattr->attr.mode = S_IRUGO; | 1186 | nattr->attr.mode = S_IRUGO; |
| 1185 | nattr->size = sechdrs[i].sh_size; | 1187 | nattr->size = sechdrs[i].sh_size; |
| @@ -1252,6 +1254,7 @@ int module_add_modinfo_attrs(struct module *mod) | |||
| 1252 | if (!attr->test || | 1254 | if (!attr->test || |
| 1253 | (attr->test && attr->test(mod))) { | 1255 | (attr->test && attr->test(mod))) { |
| 1254 | memcpy(temp_attr, attr, sizeof(*temp_attr)); | 1256 | memcpy(temp_attr, attr, sizeof(*temp_attr)); |
| 1257 | sysfs_attr_init(&temp_attr->attr); | ||
| 1255 | error = sysfs_create_file(&mod->mkobj.kobj,&temp_attr->attr); | 1258 | error = sysfs_create_file(&mod->mkobj.kobj,&temp_attr->attr); |
| 1256 | ++temp_attr; | 1259 | ++temp_attr; |
| 1257 | } | 1260 | } |
diff --git a/kernel/params.c b/kernel/params.c index 8d95f5451b22..d55a53ec9234 100644 --- a/kernel/params.c +++ b/kernel/params.c | |||
| @@ -516,6 +516,7 @@ static __modinit int add_sysfs_param(struct module_kobject *mk, | |||
| 516 | new->grp.attrs = attrs; | 516 | new->grp.attrs = attrs; |
| 517 | 517 | ||
| 518 | /* Tack new one on the end. */ | 518 | /* Tack new one on the end. */ |
| 519 | sysfs_attr_init(&new->attrs[num].mattr.attr); | ||
| 519 | new->attrs[num].param = kp; | 520 | new->attrs[num].param = kp; |
| 520 | new->attrs[num].mattr.show = param_attr_show; | 521 | new->attrs[num].mattr.show = param_attr_show; |
| 521 | new->attrs[num].mattr.store = param_attr_store; | 522 | new->attrs[num].mattr.store = param_attr_store; |
| @@ -722,7 +723,7 @@ static ssize_t module_attr_store(struct kobject *kobj, | |||
| 722 | return ret; | 723 | return ret; |
| 723 | } | 724 | } |
| 724 | 725 | ||
| 725 | static struct sysfs_ops module_sysfs_ops = { | 726 | static const struct sysfs_ops module_sysfs_ops = { |
| 726 | .show = module_attr_show, | 727 | .show = module_attr_show, |
| 727 | .store = module_attr_store, | 728 | .store = module_attr_store, |
| 728 | }; | 729 | }; |
| @@ -736,7 +737,7 @@ static int uevent_filter(struct kset *kset, struct kobject *kobj) | |||
| 736 | return 0; | 737 | return 0; |
| 737 | } | 738 | } |
| 738 | 739 | ||
| 739 | static struct kset_uevent_ops module_uevent_ops = { | 740 | static const struct kset_uevent_ops module_uevent_ops = { |
| 740 | .filter = uevent_filter, | 741 | .filter = uevent_filter, |
| 741 | }; | 742 | }; |
| 742 | 743 | ||
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 8e352c756ba7..f40560b86544 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
| @@ -5481,13 +5481,16 @@ void __init perf_event_init(void) | |||
| 5481 | register_cpu_notifier(&perf_cpu_nb); | 5481 | register_cpu_notifier(&perf_cpu_nb); |
| 5482 | } | 5482 | } |
| 5483 | 5483 | ||
| 5484 | static ssize_t perf_show_reserve_percpu(struct sysdev_class *class, char *buf) | 5484 | static ssize_t perf_show_reserve_percpu(struct sysdev_class *class, |
| 5485 | struct sysdev_class_attribute *attr, | ||
| 5486 | char *buf) | ||
| 5485 | { | 5487 | { |
| 5486 | return sprintf(buf, "%d\n", perf_reserved_percpu); | 5488 | return sprintf(buf, "%d\n", perf_reserved_percpu); |
| 5487 | } | 5489 | } |
| 5488 | 5490 | ||
| 5489 | static ssize_t | 5491 | static ssize_t |
| 5490 | perf_set_reserve_percpu(struct sysdev_class *class, | 5492 | perf_set_reserve_percpu(struct sysdev_class *class, |
| 5493 | struct sysdev_class_attribute *attr, | ||
| 5491 | const char *buf, | 5494 | const char *buf, |
| 5492 | size_t count) | 5495 | size_t count) |
| 5493 | { | 5496 | { |
| @@ -5516,13 +5519,17 @@ perf_set_reserve_percpu(struct sysdev_class *class, | |||
| 5516 | return count; | 5519 | return count; |
| 5517 | } | 5520 | } |
| 5518 | 5521 | ||
| 5519 | static ssize_t perf_show_overcommit(struct sysdev_class *class, char *buf) | 5522 | static ssize_t perf_show_overcommit(struct sysdev_class *class, |
| 5523 | struct sysdev_class_attribute *attr, | ||
| 5524 | char *buf) | ||
| 5520 | { | 5525 | { |
| 5521 | return sprintf(buf, "%d\n", perf_overcommit); | 5526 | return sprintf(buf, "%d\n", perf_overcommit); |
| 5522 | } | 5527 | } |
| 5523 | 5528 | ||
| 5524 | static ssize_t | 5529 | static ssize_t |
| 5525 | perf_set_overcommit(struct sysdev_class *class, const char *buf, size_t count) | 5530 | perf_set_overcommit(struct sysdev_class *class, |
| 5531 | struct sysdev_class_attribute *attr, | ||
| 5532 | const char *buf, size_t count) | ||
| 5526 | { | 5533 | { |
| 5527 | unsigned long val; | 5534 | unsigned long val; |
| 5528 | int err; | 5535 | int err; |
diff --git a/kernel/sched.c b/kernel/sched.c index b47ceeec1a91..150b6988de49 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
| @@ -7406,11 +7406,13 @@ static ssize_t sched_power_savings_store(const char *buf, size_t count, int smt) | |||
| 7406 | 7406 | ||
| 7407 | #ifdef CONFIG_SCHED_MC | 7407 | #ifdef CONFIG_SCHED_MC |
| 7408 | static ssize_t sched_mc_power_savings_show(struct sysdev_class *class, | 7408 | static ssize_t sched_mc_power_savings_show(struct sysdev_class *class, |
| 7409 | struct sysdev_class_attribute *attr, | ||
| 7409 | char *page) | 7410 | char *page) |
| 7410 | { | 7411 | { |
| 7411 | return sprintf(page, "%u\n", sched_mc_power_savings); | 7412 | return sprintf(page, "%u\n", sched_mc_power_savings); |
| 7412 | } | 7413 | } |
| 7413 | static ssize_t sched_mc_power_savings_store(struct sysdev_class *class, | 7414 | static ssize_t sched_mc_power_savings_store(struct sysdev_class *class, |
| 7415 | struct sysdev_class_attribute *attr, | ||
| 7414 | const char *buf, size_t count) | 7416 | const char *buf, size_t count) |
| 7415 | { | 7417 | { |
| 7416 | return sched_power_savings_store(buf, count, 0); | 7418 | return sched_power_savings_store(buf, count, 0); |
| @@ -7422,11 +7424,13 @@ static SYSDEV_CLASS_ATTR(sched_mc_power_savings, 0644, | |||
| 7422 | 7424 | ||
| 7423 | #ifdef CONFIG_SCHED_SMT | 7425 | #ifdef CONFIG_SCHED_SMT |
| 7424 | static ssize_t sched_smt_power_savings_show(struct sysdev_class *dev, | 7426 | static ssize_t sched_smt_power_savings_show(struct sysdev_class *dev, |
| 7427 | struct sysdev_class_attribute *attr, | ||
| 7425 | char *page) | 7428 | char *page) |
| 7426 | { | 7429 | { |
| 7427 | return sprintf(page, "%u\n", sched_smt_power_savings); | 7430 | return sprintf(page, "%u\n", sched_smt_power_savings); |
| 7428 | } | 7431 | } |
| 7429 | static ssize_t sched_smt_power_savings_store(struct sysdev_class *dev, | 7432 | static ssize_t sched_smt_power_savings_store(struct sysdev_class *dev, |
| 7433 | struct sysdev_class_attribute *attr, | ||
| 7430 | const char *buf, size_t count) | 7434 | const char *buf, size_t count) |
| 7431 | { | 7435 | { |
| 7432 | return sched_power_savings_store(buf, count, 1); | 7436 | return sched_power_savings_store(buf, count, 1); |
diff --git a/lib/kobject.c b/lib/kobject.c index b512b746d2af..8115eb1bbf4d 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
| @@ -700,7 +700,7 @@ static ssize_t kobj_attr_store(struct kobject *kobj, struct attribute *attr, | |||
| 700 | return ret; | 700 | return ret; |
| 701 | } | 701 | } |
| 702 | 702 | ||
| 703 | struct sysfs_ops kobj_sysfs_ops = { | 703 | const struct sysfs_ops kobj_sysfs_ops = { |
| 704 | .show = kobj_attr_show, | 704 | .show = kobj_attr_show, |
| 705 | .store = kobj_attr_store, | 705 | .store = kobj_attr_store, |
| 706 | }; | 706 | }; |
| @@ -789,7 +789,7 @@ static struct kobj_type kset_ktype = { | |||
| 789 | * If the kset was not able to be created, NULL will be returned. | 789 | * If the kset was not able to be created, NULL will be returned. |
| 790 | */ | 790 | */ |
| 791 | static struct kset *kset_create(const char *name, | 791 | static struct kset *kset_create(const char *name, |
| 792 | struct kset_uevent_ops *uevent_ops, | 792 | const struct kset_uevent_ops *uevent_ops, |
| 793 | struct kobject *parent_kobj) | 793 | struct kobject *parent_kobj) |
| 794 | { | 794 | { |
| 795 | struct kset *kset; | 795 | struct kset *kset; |
| @@ -832,7 +832,7 @@ static struct kset *kset_create(const char *name, | |||
| 832 | * If the kset was not able to be created, NULL will be returned. | 832 | * If the kset was not able to be created, NULL will be returned. |
| 833 | */ | 833 | */ |
| 834 | struct kset *kset_create_and_add(const char *name, | 834 | struct kset *kset_create_and_add(const char *name, |
| 835 | struct kset_uevent_ops *uevent_ops, | 835 | const struct kset_uevent_ops *uevent_ops, |
| 836 | struct kobject *parent_kobj) | 836 | struct kobject *parent_kobj) |
| 837 | { | 837 | { |
| 838 | struct kset *kset; | 838 | struct kset *kset; |
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index 920a3ca6e259..c9d3a3e8405d 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c | |||
| @@ -95,7 +95,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, | |||
| 95 | const char *subsystem; | 95 | const char *subsystem; |
| 96 | struct kobject *top_kobj; | 96 | struct kobject *top_kobj; |
| 97 | struct kset *kset; | 97 | struct kset *kset; |
| 98 | struct kset_uevent_ops *uevent_ops; | 98 | const struct kset_uevent_ops *uevent_ops; |
| 99 | u64 seq; | 99 | u64 seq; |
| 100 | int i = 0; | 100 | int i = 0; |
| 101 | int retval = 0; | 101 | int retval = 0; |
| @@ -4390,7 +4390,7 @@ static void kmem_cache_release(struct kobject *kobj) | |||
| 4390 | kfree(s); | 4390 | kfree(s); |
| 4391 | } | 4391 | } |
| 4392 | 4392 | ||
| 4393 | static struct sysfs_ops slab_sysfs_ops = { | 4393 | static const struct sysfs_ops slab_sysfs_ops = { |
| 4394 | .show = slab_attr_show, | 4394 | .show = slab_attr_show, |
| 4395 | .store = slab_attr_store, | 4395 | .store = slab_attr_store, |
| 4396 | }; | 4396 | }; |
| @@ -4409,7 +4409,7 @@ static int uevent_filter(struct kset *kset, struct kobject *kobj) | |||
| 4409 | return 0; | 4409 | return 0; |
| 4410 | } | 4410 | } |
| 4411 | 4411 | ||
| 4412 | static struct kset_uevent_ops slab_uevent_ops = { | 4412 | static const struct kset_uevent_ops slab_uevent_ops = { |
| 4413 | .filter = uevent_filter, | 4413 | .filter = uevent_filter, |
| 4414 | }; | 4414 | }; |
| 4415 | 4415 | ||
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 400efa26ddba..4db7ae2fe07d 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
| @@ -3937,7 +3937,9 @@ drop: | |||
| 3937 | return 0; | 3937 | return 0; |
| 3938 | } | 3938 | } |
| 3939 | 3939 | ||
| 3940 | static ssize_t l2cap_sysfs_show(struct class *dev, char *buf) | 3940 | static ssize_t l2cap_sysfs_show(struct class *dev, |
| 3941 | struct class_attribute *attr, | ||
| 3942 | char *buf) | ||
| 3941 | { | 3943 | { |
| 3942 | struct sock *sk; | 3944 | struct sock *sk; |
| 3943 | struct hlist_node *node; | 3945 | struct hlist_node *node; |
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index 89f4a59eb82b..db8a68e1a5ba 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c | |||
| @@ -2098,7 +2098,9 @@ static struct hci_cb rfcomm_cb = { | |||
| 2098 | .security_cfm = rfcomm_security_cfm | 2098 | .security_cfm = rfcomm_security_cfm |
| 2099 | }; | 2099 | }; |
| 2100 | 2100 | ||
| 2101 | static ssize_t rfcomm_dlc_sysfs_show(struct class *dev, char *buf) | 2101 | static ssize_t rfcomm_dlc_sysfs_show(struct class *dev, |
| 2102 | struct class_attribute *attr, | ||
| 2103 | char *buf) | ||
| 2102 | { | 2104 | { |
| 2103 | struct rfcomm_session *s; | 2105 | struct rfcomm_session *s; |
| 2104 | struct list_head *pp, *p; | 2106 | struct list_head *pp, *p; |
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index 4b5968dda673..ca87d6ac6a20 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c | |||
| @@ -1061,7 +1061,9 @@ done: | |||
| 1061 | return result; | 1061 | return result; |
| 1062 | } | 1062 | } |
| 1063 | 1063 | ||
| 1064 | static ssize_t rfcomm_sock_sysfs_show(struct class *dev, char *buf) | 1064 | static ssize_t rfcomm_sock_sysfs_show(struct class *dev, |
| 1065 | struct class_attribute *attr, | ||
| 1066 | char *buf) | ||
| 1065 | { | 1067 | { |
| 1066 | struct sock *sk; | 1068 | struct sock *sk; |
| 1067 | struct hlist_node *node; | 1069 | struct hlist_node *node; |
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index dd8f6ec57dce..f93b939539bc 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
| @@ -953,7 +953,9 @@ drop: | |||
| 953 | return 0; | 953 | return 0; |
| 954 | } | 954 | } |
| 955 | 955 | ||
| 956 | static ssize_t sco_sysfs_show(struct class *dev, char *buf) | 956 | static ssize_t sco_sysfs_show(struct class *dev, |
| 957 | struct class_attribute *attr, | ||
| 958 | char *buf) | ||
| 957 | { | 959 | { |
| 958 | struct sock *sk; | 960 | struct sock *sk; |
| 959 | struct hlist_node *node; | 961 | struct hlist_node *node; |
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 1cf2cef78584..fef0384e3c0b 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h | |||
| @@ -423,7 +423,7 @@ extern void br_ifinfo_notify(int event, struct net_bridge_port *port); | |||
| 423 | 423 | ||
| 424 | #ifdef CONFIG_SYSFS | 424 | #ifdef CONFIG_SYSFS |
| 425 | /* br_sysfs_if.c */ | 425 | /* br_sysfs_if.c */ |
| 426 | extern struct sysfs_ops brport_sysfs_ops; | 426 | extern const struct sysfs_ops brport_sysfs_ops; |
| 427 | extern int br_sysfs_addif(struct net_bridge_port *p); | 427 | extern int br_sysfs_addif(struct net_bridge_port *p); |
| 428 | 428 | ||
| 429 | /* br_sysfs_br.c */ | 429 | /* br_sysfs_br.c */ |
diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c index 696596cd3384..0b9916489d6b 100644 --- a/net/bridge/br_sysfs_if.c +++ b/net/bridge/br_sysfs_if.c | |||
| @@ -238,7 +238,7 @@ static ssize_t brport_store(struct kobject * kobj, | |||
| 238 | return ret; | 238 | return ret; |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | struct sysfs_ops brport_sysfs_ops = { | 241 | const struct sysfs_ops brport_sysfs_ops = { |
| 242 | .show = brport_show, | 242 | .show = brport_show, |
| 243 | .store = brport_store, | 243 | .store = brport_store, |
| 244 | }; | 244 | }; |
diff --git a/samples/kobject/kobject-example.c b/samples/kobject/kobject-example.c index 8d9b55a12023..86ea0c3ad975 100644 --- a/samples/kobject/kobject-example.c +++ b/samples/kobject/kobject-example.c | |||
| @@ -44,7 +44,7 @@ static struct kobj_attribute foo_attribute = | |||
| 44 | __ATTR(foo, 0666, foo_show, foo_store); | 44 | __ATTR(foo, 0666, foo_show, foo_store); |
| 45 | 45 | ||
| 46 | /* | 46 | /* |
| 47 | * More complex function where we determine which varible is being accessed by | 47 | * More complex function where we determine which variable is being accessed by |
| 48 | * looking at the attribute for the "baz" and "bar" files. | 48 | * looking at the attribute for the "baz" and "bar" files. |
| 49 | */ | 49 | */ |
| 50 | static ssize_t b_show(struct kobject *kobj, struct kobj_attribute *attr, | 50 | static ssize_t b_show(struct kobject *kobj, struct kobj_attribute *attr, |
| @@ -79,7 +79,7 @@ static struct kobj_attribute bar_attribute = | |||
| 79 | 79 | ||
| 80 | 80 | ||
| 81 | /* | 81 | /* |
| 82 | * Create a group of attributes so that we can create and destory them all | 82 | * Create a group of attributes so that we can create and destroy them all |
| 83 | * at once. | 83 | * at once. |
| 84 | */ | 84 | */ |
| 85 | static struct attribute *attrs[] = { | 85 | static struct attribute *attrs[] = { |
diff --git a/samples/kobject/kset-example.c b/samples/kobject/kset-example.c index 45b7d56fb541..3b126d1f8599 100644 --- a/samples/kobject/kset-example.c +++ b/samples/kobject/kset-example.c | |||
| @@ -87,7 +87,7 @@ static ssize_t foo_attr_store(struct kobject *kobj, | |||
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | /* Our custom sysfs_ops that we will associate with our ktype later on */ | 89 | /* Our custom sysfs_ops that we will associate with our ktype later on */ |
| 90 | static struct sysfs_ops foo_sysfs_ops = { | 90 | static const struct sysfs_ops foo_sysfs_ops = { |
| 91 | .show = foo_attr_show, | 91 | .show = foo_attr_show, |
| 92 | .store = foo_attr_store, | 92 | .store = foo_attr_store, |
| 93 | }; | 93 | }; |
| @@ -127,7 +127,7 @@ static struct foo_attribute foo_attribute = | |||
| 127 | __ATTR(foo, 0666, foo_show, foo_store); | 127 | __ATTR(foo, 0666, foo_show, foo_store); |
| 128 | 128 | ||
| 129 | /* | 129 | /* |
| 130 | * More complex function where we determine which varible is being accessed by | 130 | * More complex function where we determine which variable is being accessed by |
| 131 | * looking at the attribute for the "baz" and "bar" files. | 131 | * looking at the attribute for the "baz" and "bar" files. |
| 132 | */ | 132 | */ |
| 133 | static ssize_t b_show(struct foo_obj *foo_obj, struct foo_attribute *attr, | 133 | static ssize_t b_show(struct foo_obj *foo_obj, struct foo_attribute *attr, |
| @@ -161,7 +161,7 @@ static struct foo_attribute bar_attribute = | |||
| 161 | __ATTR(bar, 0666, b_show, b_store); | 161 | __ATTR(bar, 0666, b_show, b_store); |
| 162 | 162 | ||
| 163 | /* | 163 | /* |
| 164 | * Create a group of attributes so that we can create and destory them all | 164 | * Create a group of attributes so that we can create and destroy them all |
| 165 | * at once. | 165 | * at once. |
| 166 | */ | 166 | */ |
| 167 | static struct attribute *foo_default_attrs[] = { | 167 | static struct attribute *foo_default_attrs[] = { |
