diff options
287 files changed, 4239 insertions, 2460 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/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt index 33df82e3a398..bfcbbf88c44d 100644 --- a/Documentation/sound/alsa/ALSA-Configuration.txt +++ b/Documentation/sound/alsa/ALSA-Configuration.txt | |||
@@ -1812,7 +1812,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1812 | Module snd-ua101 | 1812 | Module snd-ua101 |
1813 | ---------------- | 1813 | ---------------- |
1814 | 1814 | ||
1815 | Module for the Edirol UA-101 audio/MIDI interface. | 1815 | Module for the Edirol UA-101/UA-1000 audio/MIDI interfaces. |
1816 | 1816 | ||
1817 | This module supports multiple devices, autoprobe and hotplugging. | 1817 | This module supports multiple devices, autoprobe and hotplugging. |
1818 | 1818 | ||
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 2 | 1 | VERSION = 2 |
2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
3 | SUBLEVEL = 33 | 3 | SUBLEVEL = 34 |
4 | EXTRAVERSION = | 4 | EXTRAVERSION = -rc1 |
5 | NAME = Man-Eating Seals of Antiquity | 5 | NAME = Man-Eating Seals of Antiquity |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arm/mach-ep93xx/include/mach/ts72xx.h b/arch/arm/mach-ep93xx/include/mach/ts72xx.h index 3bd934e9a7f1..93107d88ff3a 100644 --- a/arch/arm/mach-ep93xx/include/mach/ts72xx.h +++ b/arch/arm/mach-ep93xx/include/mach/ts72xx.h | |||
@@ -65,6 +65,8 @@ | |||
65 | #define TS72XX_RTC_DATA_PHYS_BASE 0x11700000 | 65 | #define TS72XX_RTC_DATA_PHYS_BASE 0x11700000 |
66 | #define TS72XX_RTC_DATA_SIZE 0x00001000 | 66 | #define TS72XX_RTC_DATA_SIZE 0x00001000 |
67 | 67 | ||
68 | #define TS72XX_WDT_CONTROL_PHYS_BASE 0x23800000 | ||
69 | #define TS72XX_WDT_FEED_PHYS_BASE 0x23c00000 | ||
68 | 70 | ||
69 | #ifndef __ASSEMBLY__ | 71 | #ifndef __ASSEMBLY__ |
70 | 72 | ||
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c index 259f7822ba52..fac1ec7a60fb 100644 --- a/arch/arm/mach-ep93xx/ts72xx.c +++ b/arch/arm/mach-ep93xx/ts72xx.c | |||
@@ -166,6 +166,26 @@ static struct platform_device ts72xx_rtc_device = { | |||
166 | .num_resources = 0, | 166 | .num_resources = 0, |
167 | }; | 167 | }; |
168 | 168 | ||
169 | static struct resource ts72xx_wdt_resources[] = { | ||
170 | { | ||
171 | .start = TS72XX_WDT_CONTROL_PHYS_BASE, | ||
172 | .end = TS72XX_WDT_CONTROL_PHYS_BASE + SZ_4K - 1, | ||
173 | .flags = IORESOURCE_MEM, | ||
174 | }, | ||
175 | { | ||
176 | .start = TS72XX_WDT_FEED_PHYS_BASE, | ||
177 | .end = TS72XX_WDT_FEED_PHYS_BASE + SZ_4K - 1, | ||
178 | .flags = IORESOURCE_MEM, | ||
179 | }, | ||
180 | }; | ||
181 | |||
182 | static struct platform_device ts72xx_wdt_device = { | ||
183 | .name = "ts72xx-wdt", | ||
184 | .id = -1, | ||
185 | .num_resources = ARRAY_SIZE(ts72xx_wdt_resources), | ||
186 | .resource = ts72xx_wdt_resources, | ||
187 | }; | ||
188 | |||
169 | static struct ep93xx_eth_data ts72xx_eth_data = { | 189 | static struct ep93xx_eth_data ts72xx_eth_data = { |
170 | .phy_id = 1, | 190 | .phy_id = 1, |
171 | }; | 191 | }; |
@@ -175,6 +195,7 @@ static void __init ts72xx_init_machine(void) | |||
175 | ep93xx_init_devices(); | 195 | ep93xx_init_devices(); |
176 | ts72xx_register_flash(); | 196 | ts72xx_register_flash(); |
177 | platform_device_register(&ts72xx_rtc_device); | 197 | platform_device_register(&ts72xx_rtc_device); |
198 | platform_device_register(&ts72xx_wdt_device); | ||
178 | 199 | ||
179 | ep93xx_register_eth(&ts72xx_eth_data, 1); | 200 | ep93xx_register_eth(&ts72xx_eth_data, 1); |
180 | } | 201 | } |
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/powerpc/platforms/52xx/mpc52xx_gpt.c b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c index 6f8ebe1085b3..072b948b2e2d 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c | |||
@@ -553,7 +553,7 @@ static ssize_t mpc52xx_wdt_write(struct file *file, const char __user *data, | |||
553 | return 0; | 553 | return 0; |
554 | } | 554 | } |
555 | 555 | ||
556 | static struct watchdog_info mpc5200_wdt_info = { | 556 | static const struct watchdog_info mpc5200_wdt_info = { |
557 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, | 557 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, |
558 | .identity = WDT_IDENTITY, | 558 | .identity = WDT_IDENTITY, |
559 | }; | 559 | }; |
diff --git a/arch/s390/include/asm/qdio.h b/arch/s390/include/asm/qdio.h index c666bfe5e984..9b04b1102bbc 100644 --- a/arch/s390/include/asm/qdio.h +++ b/arch/s390/include/asm/qdio.h | |||
@@ -321,11 +321,6 @@ typedef void qdio_handler_t(struct ccw_device *, unsigned int, int, | |||
321 | #define QDIO_ERROR_ACTIVATE_CHECK_CONDITION 0x40 | 321 | #define QDIO_ERROR_ACTIVATE_CHECK_CONDITION 0x40 |
322 | #define QDIO_ERROR_SLSB_STATE 0x80 | 322 | #define QDIO_ERROR_SLSB_STATE 0x80 |
323 | 323 | ||
324 | /* for qdio_initialize */ | ||
325 | #define QDIO_INBOUND_0COPY_SBALS 0x01 | ||
326 | #define QDIO_OUTBOUND_0COPY_SBALS 0x02 | ||
327 | #define QDIO_USE_OUTBOUND_PCIS 0x04 | ||
328 | |||
329 | /* for qdio_cleanup */ | 324 | /* for qdio_cleanup */ |
330 | #define QDIO_FLAG_CLEANUP_USING_CLEAR 0x01 | 325 | #define QDIO_FLAG_CLEANUP_USING_CLEAR 0x01 |
331 | #define QDIO_FLAG_CLEANUP_USING_HALT 0x02 | 326 | #define QDIO_FLAG_CLEANUP_USING_HALT 0x02 |
@@ -344,7 +339,6 @@ typedef void qdio_handler_t(struct ccw_device *, unsigned int, int, | |||
344 | * @input_handler: handler to be called for input queues | 339 | * @input_handler: handler to be called for input queues |
345 | * @output_handler: handler to be called for output queues | 340 | * @output_handler: handler to be called for output queues |
346 | * @int_parm: interruption parameter | 341 | * @int_parm: interruption parameter |
347 | * @flags: initialization flags | ||
348 | * @input_sbal_addr_array: address of no_input_qs * 128 pointers | 342 | * @input_sbal_addr_array: address of no_input_qs * 128 pointers |
349 | * @output_sbal_addr_array: address of no_output_qs * 128 pointers | 343 | * @output_sbal_addr_array: address of no_output_qs * 128 pointers |
350 | */ | 344 | */ |
@@ -361,7 +355,6 @@ struct qdio_initialize { | |||
361 | qdio_handler_t *input_handler; | 355 | qdio_handler_t *input_handler; |
362 | qdio_handler_t *output_handler; | 356 | qdio_handler_t *output_handler; |
363 | unsigned long int_parm; | 357 | unsigned long int_parm; |
364 | unsigned long flags; | ||
365 | void **input_sbal_addr_array; | 358 | void **input_sbal_addr_array; |
366 | void **output_sbal_addr_array; | 359 | void **output_sbal_addr_array; |
367 | }; | 360 | }; |
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 a8f93f1705ad..aa2483e460f3 100644 --- a/arch/s390/kernel/time.c +++ b/arch/s390/kernel/time.c | |||
@@ -73,15 +73,15 @@ unsigned long long monotonic_clock(void) | |||
73 | } | 73 | } |
74 | EXPORT_SYMBOL(monotonic_clock); | 74 | EXPORT_SYMBOL(monotonic_clock); |
75 | 75 | ||
76 | void tod_to_timeval(__u64 todval, struct timespec *xtime) | 76 | void tod_to_timeval(__u64 todval, struct timespec *xt) |
77 | { | 77 | { |
78 | unsigned long long sec; | 78 | unsigned long long sec; |
79 | 79 | ||
80 | sec = todval >> 12; | 80 | sec = todval >> 12; |
81 | do_div(sec, 1000000); | 81 | do_div(sec, 1000000); |
82 | xtime->tv_sec = sec; | 82 | xt->tv_sec = sec; |
83 | todval -= (sec * 1000000) << 12; | 83 | todval -= (sec * 1000000) << 12; |
84 | xtime->tv_nsec = ((todval * 1000) >> 12); | 84 | xt->tv_nsec = ((todval * 1000) >> 12); |
85 | } | 85 | } |
86 | EXPORT_SYMBOL(tod_to_timeval); | 86 | EXPORT_SYMBOL(tod_to_timeval); |
87 | 87 | ||
@@ -216,8 +216,8 @@ void update_vsyscall(struct timespec *wall_time, struct clocksource *clock, | |||
216 | ++vdso_data->tb_update_count; | 216 | ++vdso_data->tb_update_count; |
217 | smp_wmb(); | 217 | smp_wmb(); |
218 | vdso_data->xtime_tod_stamp = clock->cycle_last; | 218 | vdso_data->xtime_tod_stamp = clock->cycle_last; |
219 | vdso_data->xtime_clock_sec = xtime.tv_sec; | 219 | vdso_data->xtime_clock_sec = wall_time->tv_sec; |
220 | vdso_data->xtime_clock_nsec = xtime.tv_nsec; | 220 | vdso_data->xtime_clock_nsec = wall_time->tv_nsec; |
221 | vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec; | 221 | vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec; |
222 | vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec; | 222 | vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec; |
223 | smp_wmb(); | 223 | smp_wmb(); |
@@ -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/s390/lib/Makefile b/arch/s390/lib/Makefile index cd54a1c352af..761ab8b56afc 100644 --- a/arch/s390/lib/Makefile +++ b/arch/s390/lib/Makefile | |||
@@ -2,7 +2,8 @@ | |||
2 | # Makefile for s390-specific library files.. | 2 | # Makefile for s390-specific library files.. |
3 | # | 3 | # |
4 | 4 | ||
5 | lib-y += delay.o string.o uaccess_std.o uaccess_pt.o usercopy.o | 5 | lib-y += delay.o string.o uaccess_std.o uaccess_pt.o |
6 | obj-y += usercopy.o | ||
6 | obj-$(CONFIG_32BIT) += div64.o qrnnd.o ucmpdi2.o | 7 | obj-$(CONFIG_32BIT) += div64.o qrnnd.o ucmpdi2.o |
7 | lib-$(CONFIG_64BIT) += uaccess_mvcos.o | 8 | lib-$(CONFIG_64BIT) += uaccess_mvcos.o |
8 | lib-$(CONFIG_SMP) += spinlock.o | 9 | lib-$(CONFIG_SMP) += spinlock.o |
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c index 76a3637b88e0..f16bd04e39e9 100644 --- a/arch/s390/mm/cmm.c +++ b/arch/s390/mm/cmm.c | |||
@@ -374,7 +374,7 @@ static struct ctl_table cmm_dir_table[] = { | |||
374 | #ifdef CONFIG_CMM_IUCV | 374 | #ifdef CONFIG_CMM_IUCV |
375 | #define SMSG_PREFIX "CMM" | 375 | #define SMSG_PREFIX "CMM" |
376 | static void | 376 | static void |
377 | cmm_smsg_target(char *from, char *msg) | 377 | cmm_smsg_target(const char *from, char *msg) |
378 | { | 378 | { |
379 | long nr, seconds; | 379 | long nr, seconds; |
380 | 380 | ||
diff --git a/arch/sh/kernel/cpu/sh2/setup-sh7619.c b/arch/sh/kernel/cpu/sh2/setup-sh7619.c index 114c7cee7184..9b96457ccc7b 100644 --- a/arch/sh/kernel/cpu/sh2/setup-sh7619.c +++ b/arch/sh/kernel/cpu/sh2/setup-sh7619.c | |||
@@ -128,7 +128,6 @@ static struct platform_device eth_device = { | |||
128 | }; | 128 | }; |
129 | 129 | ||
130 | static struct sh_timer_config cmt0_platform_data = { | 130 | static struct sh_timer_config cmt0_platform_data = { |
131 | .name = "CMT0", | ||
132 | .channel_offset = 0x02, | 131 | .channel_offset = 0x02, |
133 | .timer_bit = 0, | 132 | .timer_bit = 0, |
134 | .clk = "peripheral_clk", | 133 | .clk = "peripheral_clk", |
@@ -138,7 +137,6 @@ static struct sh_timer_config cmt0_platform_data = { | |||
138 | 137 | ||
139 | static struct resource cmt0_resources[] = { | 138 | static struct resource cmt0_resources[] = { |
140 | [0] = { | 139 | [0] = { |
141 | .name = "CMT0", | ||
142 | .start = 0xf84a0072, | 140 | .start = 0xf84a0072, |
143 | .end = 0xf84a0077, | 141 | .end = 0xf84a0077, |
144 | .flags = IORESOURCE_MEM, | 142 | .flags = IORESOURCE_MEM, |
@@ -160,7 +158,6 @@ static struct platform_device cmt0_device = { | |||
160 | }; | 158 | }; |
161 | 159 | ||
162 | static struct sh_timer_config cmt1_platform_data = { | 160 | static struct sh_timer_config cmt1_platform_data = { |
163 | .name = "CMT1", | ||
164 | .channel_offset = 0x08, | 161 | .channel_offset = 0x08, |
165 | .timer_bit = 1, | 162 | .timer_bit = 1, |
166 | .clk = "peripheral_clk", | 163 | .clk = "peripheral_clk", |
@@ -170,7 +167,6 @@ static struct sh_timer_config cmt1_platform_data = { | |||
170 | 167 | ||
171 | static struct resource cmt1_resources[] = { | 168 | static struct resource cmt1_resources[] = { |
172 | [0] = { | 169 | [0] = { |
173 | .name = "CMT1", | ||
174 | .start = 0xf84a0078, | 170 | .start = 0xf84a0078, |
175 | .end = 0xf84a007d, | 171 | .end = 0xf84a007d, |
176 | .flags = IORESOURCE_MEM, | 172 | .flags = IORESOURCE_MEM, |
diff --git a/arch/sh/kernel/cpu/sh2a/setup-mxg.c b/arch/sh/kernel/cpu/sh2a/setup-mxg.c index 8f669dc9b0da..5301450656cc 100644 --- a/arch/sh/kernel/cpu/sh2a/setup-mxg.c +++ b/arch/sh/kernel/cpu/sh2a/setup-mxg.c | |||
@@ -115,7 +115,6 @@ static DECLARE_INTC_DESC(intc_desc, "mxg", vectors, groups, | |||
115 | mask_registers, prio_registers, NULL); | 115 | mask_registers, prio_registers, NULL); |
116 | 116 | ||
117 | static struct sh_timer_config mtu2_0_platform_data = { | 117 | static struct sh_timer_config mtu2_0_platform_data = { |
118 | .name = "MTU2_0", | ||
119 | .channel_offset = -0x80, | 118 | .channel_offset = -0x80, |
120 | .timer_bit = 0, | 119 | .timer_bit = 0, |
121 | .clk = "peripheral_clk", | 120 | .clk = "peripheral_clk", |
@@ -124,7 +123,6 @@ static struct sh_timer_config mtu2_0_platform_data = { | |||
124 | 123 | ||
125 | static struct resource mtu2_0_resources[] = { | 124 | static struct resource mtu2_0_resources[] = { |
126 | [0] = { | 125 | [0] = { |
127 | .name = "MTU2_0", | ||
128 | .start = 0xff801300, | 126 | .start = 0xff801300, |
129 | .end = 0xff801326, | 127 | .end = 0xff801326, |
130 | .flags = IORESOURCE_MEM, | 128 | .flags = IORESOURCE_MEM, |
@@ -146,7 +144,6 @@ static struct platform_device mtu2_0_device = { | |||
146 | }; | 144 | }; |
147 | 145 | ||
148 | static struct sh_timer_config mtu2_1_platform_data = { | 146 | static struct sh_timer_config mtu2_1_platform_data = { |
149 | .name = "MTU2_1", | ||
150 | .channel_offset = -0x100, | 147 | .channel_offset = -0x100, |
151 | .timer_bit = 1, | 148 | .timer_bit = 1, |
152 | .clk = "peripheral_clk", | 149 | .clk = "peripheral_clk", |
@@ -155,7 +152,6 @@ static struct sh_timer_config mtu2_1_platform_data = { | |||
155 | 152 | ||
156 | static struct resource mtu2_1_resources[] = { | 153 | static struct resource mtu2_1_resources[] = { |
157 | [0] = { | 154 | [0] = { |
158 | .name = "MTU2_1", | ||
159 | .start = 0xff801380, | 155 | .start = 0xff801380, |
160 | .end = 0xff801390, | 156 | .end = 0xff801390, |
161 | .flags = IORESOURCE_MEM, | 157 | .flags = IORESOURCE_MEM, |
@@ -177,7 +173,6 @@ static struct platform_device mtu2_1_device = { | |||
177 | }; | 173 | }; |
178 | 174 | ||
179 | static struct sh_timer_config mtu2_2_platform_data = { | 175 | static struct sh_timer_config mtu2_2_platform_data = { |
180 | .name = "MTU2_2", | ||
181 | .channel_offset = 0x80, | 176 | .channel_offset = 0x80, |
182 | .timer_bit = 2, | 177 | .timer_bit = 2, |
183 | .clk = "peripheral_clk", | 178 | .clk = "peripheral_clk", |
@@ -186,7 +181,6 @@ static struct sh_timer_config mtu2_2_platform_data = { | |||
186 | 181 | ||
187 | static struct resource mtu2_2_resources[] = { | 182 | static struct resource mtu2_2_resources[] = { |
188 | [0] = { | 183 | [0] = { |
189 | .name = "MTU2_2", | ||
190 | .start = 0xff801000, | 184 | .start = 0xff801000, |
191 | .end = 0xff80100a, | 185 | .end = 0xff80100a, |
192 | .flags = IORESOURCE_MEM, | 186 | .flags = IORESOURCE_MEM, |
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7201.c b/arch/sh/kernel/cpu/sh2a/setup-sh7201.c index 4ccfeb59eb1a..5b07ab57acfd 100644 --- a/arch/sh/kernel/cpu/sh2a/setup-sh7201.c +++ b/arch/sh/kernel/cpu/sh2a/setup-sh7201.c | |||
@@ -318,7 +318,6 @@ static struct platform_device rtc_device = { | |||
318 | }; | 318 | }; |
319 | 319 | ||
320 | static struct sh_timer_config mtu2_0_platform_data = { | 320 | static struct sh_timer_config mtu2_0_platform_data = { |
321 | .name = "MTU2_0", | ||
322 | .channel_offset = -0x80, | 321 | .channel_offset = -0x80, |
323 | .timer_bit = 0, | 322 | .timer_bit = 0, |
324 | .clk = "peripheral_clk", | 323 | .clk = "peripheral_clk", |
@@ -327,7 +326,6 @@ static struct sh_timer_config mtu2_0_platform_data = { | |||
327 | 326 | ||
328 | static struct resource mtu2_0_resources[] = { | 327 | static struct resource mtu2_0_resources[] = { |
329 | [0] = { | 328 | [0] = { |
330 | .name = "MTU2_0", | ||
331 | .start = 0xfffe4300, | 329 | .start = 0xfffe4300, |
332 | .end = 0xfffe4326, | 330 | .end = 0xfffe4326, |
333 | .flags = IORESOURCE_MEM, | 331 | .flags = IORESOURCE_MEM, |
@@ -349,7 +347,6 @@ static struct platform_device mtu2_0_device = { | |||
349 | }; | 347 | }; |
350 | 348 | ||
351 | static struct sh_timer_config mtu2_1_platform_data = { | 349 | static struct sh_timer_config mtu2_1_platform_data = { |
352 | .name = "MTU2_1", | ||
353 | .channel_offset = -0x100, | 350 | .channel_offset = -0x100, |
354 | .timer_bit = 1, | 351 | .timer_bit = 1, |
355 | .clk = "peripheral_clk", | 352 | .clk = "peripheral_clk", |
@@ -358,7 +355,6 @@ static struct sh_timer_config mtu2_1_platform_data = { | |||
358 | 355 | ||
359 | static struct resource mtu2_1_resources[] = { | 356 | static struct resource mtu2_1_resources[] = { |
360 | [0] = { | 357 | [0] = { |
361 | .name = "MTU2_1", | ||
362 | .start = 0xfffe4380, | 358 | .start = 0xfffe4380, |
363 | .end = 0xfffe4390, | 359 | .end = 0xfffe4390, |
364 | .flags = IORESOURCE_MEM, | 360 | .flags = IORESOURCE_MEM, |
@@ -380,7 +376,6 @@ static struct platform_device mtu2_1_device = { | |||
380 | }; | 376 | }; |
381 | 377 | ||
382 | static struct sh_timer_config mtu2_2_platform_data = { | 378 | static struct sh_timer_config mtu2_2_platform_data = { |
383 | .name = "MTU2_2", | ||
384 | .channel_offset = 0x80, | 379 | .channel_offset = 0x80, |
385 | .timer_bit = 2, | 380 | .timer_bit = 2, |
386 | .clk = "peripheral_clk", | 381 | .clk = "peripheral_clk", |
@@ -389,7 +384,6 @@ static struct sh_timer_config mtu2_2_platform_data = { | |||
389 | 384 | ||
390 | static struct resource mtu2_2_resources[] = { | 385 | static struct resource mtu2_2_resources[] = { |
391 | [0] = { | 386 | [0] = { |
392 | .name = "MTU2_2", | ||
393 | .start = 0xfffe4000, | 387 | .start = 0xfffe4000, |
394 | .end = 0xfffe400a, | 388 | .end = 0xfffe400a, |
395 | .flags = IORESOURCE_MEM, | 389 | .flags = IORESOURCE_MEM, |
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c index 3136966cc9b3..433ac5301314 100644 --- a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c +++ b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c | |||
@@ -234,7 +234,6 @@ static struct platform_device scif3_device = { | |||
234 | }; | 234 | }; |
235 | 235 | ||
236 | static struct sh_timer_config cmt0_platform_data = { | 236 | static struct sh_timer_config cmt0_platform_data = { |
237 | .name = "CMT0", | ||
238 | .channel_offset = 0x02, | 237 | .channel_offset = 0x02, |
239 | .timer_bit = 0, | 238 | .timer_bit = 0, |
240 | .clk = "peripheral_clk", | 239 | .clk = "peripheral_clk", |
@@ -244,7 +243,6 @@ static struct sh_timer_config cmt0_platform_data = { | |||
244 | 243 | ||
245 | static struct resource cmt0_resources[] = { | 244 | static struct resource cmt0_resources[] = { |
246 | [0] = { | 245 | [0] = { |
247 | .name = "CMT0", | ||
248 | .start = 0xfffec002, | 246 | .start = 0xfffec002, |
249 | .end = 0xfffec007, | 247 | .end = 0xfffec007, |
250 | .flags = IORESOURCE_MEM, | 248 | .flags = IORESOURCE_MEM, |
@@ -266,7 +264,6 @@ static struct platform_device cmt0_device = { | |||
266 | }; | 264 | }; |
267 | 265 | ||
268 | static struct sh_timer_config cmt1_platform_data = { | 266 | static struct sh_timer_config cmt1_platform_data = { |
269 | .name = "CMT1", | ||
270 | .channel_offset = 0x08, | 267 | .channel_offset = 0x08, |
271 | .timer_bit = 1, | 268 | .timer_bit = 1, |
272 | .clk = "peripheral_clk", | 269 | .clk = "peripheral_clk", |
@@ -276,7 +273,6 @@ static struct sh_timer_config cmt1_platform_data = { | |||
276 | 273 | ||
277 | static struct resource cmt1_resources[] = { | 274 | static struct resource cmt1_resources[] = { |
278 | [0] = { | 275 | [0] = { |
279 | .name = "CMT1", | ||
280 | .start = 0xfffec008, | 276 | .start = 0xfffec008, |
281 | .end = 0xfffec00d, | 277 | .end = 0xfffec00d, |
282 | .flags = IORESOURCE_MEM, | 278 | .flags = IORESOURCE_MEM, |
@@ -298,7 +294,6 @@ static struct platform_device cmt1_device = { | |||
298 | }; | 294 | }; |
299 | 295 | ||
300 | static struct sh_timer_config mtu2_0_platform_data = { | 296 | static struct sh_timer_config mtu2_0_platform_data = { |
301 | .name = "MTU2_0", | ||
302 | .channel_offset = -0x80, | 297 | .channel_offset = -0x80, |
303 | .timer_bit = 0, | 298 | .timer_bit = 0, |
304 | .clk = "peripheral_clk", | 299 | .clk = "peripheral_clk", |
@@ -307,7 +302,6 @@ static struct sh_timer_config mtu2_0_platform_data = { | |||
307 | 302 | ||
308 | static struct resource mtu2_0_resources[] = { | 303 | static struct resource mtu2_0_resources[] = { |
309 | [0] = { | 304 | [0] = { |
310 | .name = "MTU2_0", | ||
311 | .start = 0xfffe4300, | 305 | .start = 0xfffe4300, |
312 | .end = 0xfffe4326, | 306 | .end = 0xfffe4326, |
313 | .flags = IORESOURCE_MEM, | 307 | .flags = IORESOURCE_MEM, |
@@ -329,7 +323,6 @@ static struct platform_device mtu2_0_device = { | |||
329 | }; | 323 | }; |
330 | 324 | ||
331 | static struct sh_timer_config mtu2_1_platform_data = { | 325 | static struct sh_timer_config mtu2_1_platform_data = { |
332 | .name = "MTU2_1", | ||
333 | .channel_offset = -0x100, | 326 | .channel_offset = -0x100, |
334 | .timer_bit = 1, | 327 | .timer_bit = 1, |
335 | .clk = "peripheral_clk", | 328 | .clk = "peripheral_clk", |
@@ -338,7 +331,6 @@ static struct sh_timer_config mtu2_1_platform_data = { | |||
338 | 331 | ||
339 | static struct resource mtu2_1_resources[] = { | 332 | static struct resource mtu2_1_resources[] = { |
340 | [0] = { | 333 | [0] = { |
341 | .name = "MTU2_1", | ||
342 | .start = 0xfffe4380, | 334 | .start = 0xfffe4380, |
343 | .end = 0xfffe4390, | 335 | .end = 0xfffe4390, |
344 | .flags = IORESOURCE_MEM, | 336 | .flags = IORESOURCE_MEM, |
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7206.c b/arch/sh/kernel/cpu/sh2a/setup-sh7206.c index 064873585a8b..8caecb41e4e6 100644 --- a/arch/sh/kernel/cpu/sh2a/setup-sh7206.c +++ b/arch/sh/kernel/cpu/sh2a/setup-sh7206.c | |||
@@ -194,7 +194,6 @@ static struct platform_device scif3_device = { | |||
194 | }; | 194 | }; |
195 | 195 | ||
196 | static struct sh_timer_config cmt0_platform_data = { | 196 | static struct sh_timer_config cmt0_platform_data = { |
197 | .name = "CMT0", | ||
198 | .channel_offset = 0x02, | 197 | .channel_offset = 0x02, |
199 | .timer_bit = 0, | 198 | .timer_bit = 0, |
200 | .clk = "peripheral_clk", | 199 | .clk = "peripheral_clk", |
@@ -204,7 +203,6 @@ static struct sh_timer_config cmt0_platform_data = { | |||
204 | 203 | ||
205 | static struct resource cmt0_resources[] = { | 204 | static struct resource cmt0_resources[] = { |
206 | [0] = { | 205 | [0] = { |
207 | .name = "CMT0", | ||
208 | .start = 0xfffec002, | 206 | .start = 0xfffec002, |
209 | .end = 0xfffec007, | 207 | .end = 0xfffec007, |
210 | .flags = IORESOURCE_MEM, | 208 | .flags = IORESOURCE_MEM, |
@@ -226,7 +224,6 @@ static struct platform_device cmt0_device = { | |||
226 | }; | 224 | }; |
227 | 225 | ||
228 | static struct sh_timer_config cmt1_platform_data = { | 226 | static struct sh_timer_config cmt1_platform_data = { |
229 | .name = "CMT1", | ||
230 | .channel_offset = 0x08, | 227 | .channel_offset = 0x08, |
231 | .timer_bit = 1, | 228 | .timer_bit = 1, |
232 | .clk = "peripheral_clk", | 229 | .clk = "peripheral_clk", |
@@ -236,7 +233,6 @@ static struct sh_timer_config cmt1_platform_data = { | |||
236 | 233 | ||
237 | static struct resource cmt1_resources[] = { | 234 | static struct resource cmt1_resources[] = { |
238 | [0] = { | 235 | [0] = { |
239 | .name = "CMT1", | ||
240 | .start = 0xfffec008, | 236 | .start = 0xfffec008, |
241 | .end = 0xfffec00d, | 237 | .end = 0xfffec00d, |
242 | .flags = IORESOURCE_MEM, | 238 | .flags = IORESOURCE_MEM, |
@@ -258,7 +254,6 @@ static struct platform_device cmt1_device = { | |||
258 | }; | 254 | }; |
259 | 255 | ||
260 | static struct sh_timer_config mtu2_0_platform_data = { | 256 | static struct sh_timer_config mtu2_0_platform_data = { |
261 | .name = "MTU2_0", | ||
262 | .channel_offset = -0x80, | 257 | .channel_offset = -0x80, |
263 | .timer_bit = 0, | 258 | .timer_bit = 0, |
264 | .clk = "peripheral_clk", | 259 | .clk = "peripheral_clk", |
@@ -267,7 +262,6 @@ static struct sh_timer_config mtu2_0_platform_data = { | |||
267 | 262 | ||
268 | static struct resource mtu2_0_resources[] = { | 263 | static struct resource mtu2_0_resources[] = { |
269 | [0] = { | 264 | [0] = { |
270 | .name = "MTU2_0", | ||
271 | .start = 0xfffe4300, | 265 | .start = 0xfffe4300, |
272 | .end = 0xfffe4326, | 266 | .end = 0xfffe4326, |
273 | .flags = IORESOURCE_MEM, | 267 | .flags = IORESOURCE_MEM, |
@@ -289,7 +283,6 @@ static struct platform_device mtu2_0_device = { | |||
289 | }; | 283 | }; |
290 | 284 | ||
291 | static struct sh_timer_config mtu2_1_platform_data = { | 285 | static struct sh_timer_config mtu2_1_platform_data = { |
292 | .name = "MTU2_1", | ||
293 | .channel_offset = -0x100, | 286 | .channel_offset = -0x100, |
294 | .timer_bit = 1, | 287 | .timer_bit = 1, |
295 | .clk = "peripheral_clk", | 288 | .clk = "peripheral_clk", |
@@ -298,7 +291,6 @@ static struct sh_timer_config mtu2_1_platform_data = { | |||
298 | 291 | ||
299 | static struct resource mtu2_1_resources[] = { | 292 | static struct resource mtu2_1_resources[] = { |
300 | [0] = { | 293 | [0] = { |
301 | .name = "MTU2_1", | ||
302 | .start = 0xfffe4380, | 294 | .start = 0xfffe4380, |
303 | .end = 0xfffe4390, | 295 | .end = 0xfffe4390, |
304 | .flags = IORESOURCE_MEM, | 296 | .flags = IORESOURCE_MEM, |
@@ -320,7 +312,6 @@ static struct platform_device mtu2_1_device = { | |||
320 | }; | 312 | }; |
321 | 313 | ||
322 | static struct sh_timer_config mtu2_2_platform_data = { | 314 | static struct sh_timer_config mtu2_2_platform_data = { |
323 | .name = "MTU2_2", | ||
324 | .channel_offset = 0x80, | 315 | .channel_offset = 0x80, |
325 | .timer_bit = 2, | 316 | .timer_bit = 2, |
326 | .clk = "peripheral_clk", | 317 | .clk = "peripheral_clk", |
@@ -329,7 +320,6 @@ static struct sh_timer_config mtu2_2_platform_data = { | |||
329 | 320 | ||
330 | static struct resource mtu2_2_resources[] = { | 321 | static struct resource mtu2_2_resources[] = { |
331 | [0] = { | 322 | [0] = { |
332 | .name = "MTU2_2", | ||
333 | .start = 0xfffe4000, | 323 | .start = 0xfffe4000, |
334 | .end = 0xfffe400a, | 324 | .end = 0xfffe400a, |
335 | .flags = IORESOURCE_MEM, | 325 | .flags = IORESOURCE_MEM, |
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7705.c b/arch/sh/kernel/cpu/sh3/setup-sh7705.c index 7b892d60e3a0..5e45fb7338fd 100644 --- a/arch/sh/kernel/cpu/sh3/setup-sh7705.c +++ b/arch/sh/kernel/cpu/sh3/setup-sh7705.c | |||
@@ -124,7 +124,6 @@ static struct platform_device rtc_device = { | |||
124 | }; | 124 | }; |
125 | 125 | ||
126 | static struct sh_timer_config tmu0_platform_data = { | 126 | static struct sh_timer_config tmu0_platform_data = { |
127 | .name = "TMU0", | ||
128 | .channel_offset = 0x02, | 127 | .channel_offset = 0x02, |
129 | .timer_bit = 0, | 128 | .timer_bit = 0, |
130 | .clk = "peripheral_clk", | 129 | .clk = "peripheral_clk", |
@@ -133,7 +132,6 @@ static struct sh_timer_config tmu0_platform_data = { | |||
133 | 132 | ||
134 | static struct resource tmu0_resources[] = { | 133 | static struct resource tmu0_resources[] = { |
135 | [0] = { | 134 | [0] = { |
136 | .name = "TMU0", | ||
137 | .start = 0xfffffe94, | 135 | .start = 0xfffffe94, |
138 | .end = 0xfffffe9f, | 136 | .end = 0xfffffe9f, |
139 | .flags = IORESOURCE_MEM, | 137 | .flags = IORESOURCE_MEM, |
@@ -155,7 +153,6 @@ static struct platform_device tmu0_device = { | |||
155 | }; | 153 | }; |
156 | 154 | ||
157 | static struct sh_timer_config tmu1_platform_data = { | 155 | static struct sh_timer_config tmu1_platform_data = { |
158 | .name = "TMU1", | ||
159 | .channel_offset = 0xe, | 156 | .channel_offset = 0xe, |
160 | .timer_bit = 1, | 157 | .timer_bit = 1, |
161 | .clk = "peripheral_clk", | 158 | .clk = "peripheral_clk", |
@@ -164,7 +161,6 @@ static struct sh_timer_config tmu1_platform_data = { | |||
164 | 161 | ||
165 | static struct resource tmu1_resources[] = { | 162 | static struct resource tmu1_resources[] = { |
166 | [0] = { | 163 | [0] = { |
167 | .name = "TMU1", | ||
168 | .start = 0xfffffea0, | 164 | .start = 0xfffffea0, |
169 | .end = 0xfffffeab, | 165 | .end = 0xfffffeab, |
170 | .flags = IORESOURCE_MEM, | 166 | .flags = IORESOURCE_MEM, |
@@ -186,7 +182,6 @@ static struct platform_device tmu1_device = { | |||
186 | }; | 182 | }; |
187 | 183 | ||
188 | static struct sh_timer_config tmu2_platform_data = { | 184 | static struct sh_timer_config tmu2_platform_data = { |
189 | .name = "TMU2", | ||
190 | .channel_offset = 0x1a, | 185 | .channel_offset = 0x1a, |
191 | .timer_bit = 2, | 186 | .timer_bit = 2, |
192 | .clk = "peripheral_clk", | 187 | .clk = "peripheral_clk", |
@@ -194,7 +189,6 @@ static struct sh_timer_config tmu2_platform_data = { | |||
194 | 189 | ||
195 | static struct resource tmu2_resources[] = { | 190 | static struct resource tmu2_resources[] = { |
196 | [0] = { | 191 | [0] = { |
197 | .name = "TMU2", | ||
198 | .start = 0xfffffeac, | 192 | .start = 0xfffffeac, |
199 | .end = 0xfffffebb, | 193 | .end = 0xfffffebb, |
200 | .flags = IORESOURCE_MEM, | 194 | .flags = IORESOURCE_MEM, |
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh770x.c b/arch/sh/kernel/cpu/sh3/setup-sh770x.c index bc0c4f68c7c7..9adb853a9184 100644 --- a/arch/sh/kernel/cpu/sh3/setup-sh770x.c +++ b/arch/sh/kernel/cpu/sh3/setup-sh770x.c | |||
@@ -157,7 +157,6 @@ static struct platform_device scif2_device = { | |||
157 | #endif | 157 | #endif |
158 | 158 | ||
159 | static struct sh_timer_config tmu0_platform_data = { | 159 | static struct sh_timer_config tmu0_platform_data = { |
160 | .name = "TMU0", | ||
161 | .channel_offset = 0x02, | 160 | .channel_offset = 0x02, |
162 | .timer_bit = 0, | 161 | .timer_bit = 0, |
163 | .clk = "peripheral_clk", | 162 | .clk = "peripheral_clk", |
@@ -166,7 +165,6 @@ static struct sh_timer_config tmu0_platform_data = { | |||
166 | 165 | ||
167 | static struct resource tmu0_resources[] = { | 166 | static struct resource tmu0_resources[] = { |
168 | [0] = { | 167 | [0] = { |
169 | .name = "TMU0", | ||
170 | .start = 0xfffffe94, | 168 | .start = 0xfffffe94, |
171 | .end = 0xfffffe9f, | 169 | .end = 0xfffffe9f, |
172 | .flags = IORESOURCE_MEM, | 170 | .flags = IORESOURCE_MEM, |
@@ -188,7 +186,6 @@ static struct platform_device tmu0_device = { | |||
188 | }; | 186 | }; |
189 | 187 | ||
190 | static struct sh_timer_config tmu1_platform_data = { | 188 | static struct sh_timer_config tmu1_platform_data = { |
191 | .name = "TMU1", | ||
192 | .channel_offset = 0xe, | 189 | .channel_offset = 0xe, |
193 | .timer_bit = 1, | 190 | .timer_bit = 1, |
194 | .clk = "peripheral_clk", | 191 | .clk = "peripheral_clk", |
@@ -197,7 +194,6 @@ static struct sh_timer_config tmu1_platform_data = { | |||
197 | 194 | ||
198 | static struct resource tmu1_resources[] = { | 195 | static struct resource tmu1_resources[] = { |
199 | [0] = { | 196 | [0] = { |
200 | .name = "TMU1", | ||
201 | .start = 0xfffffea0, | 197 | .start = 0xfffffea0, |
202 | .end = 0xfffffeab, | 198 | .end = 0xfffffeab, |
203 | .flags = IORESOURCE_MEM, | 199 | .flags = IORESOURCE_MEM, |
@@ -219,7 +215,6 @@ static struct platform_device tmu1_device = { | |||
219 | }; | 215 | }; |
220 | 216 | ||
221 | static struct sh_timer_config tmu2_platform_data = { | 217 | static struct sh_timer_config tmu2_platform_data = { |
222 | .name = "TMU2", | ||
223 | .channel_offset = 0x1a, | 218 | .channel_offset = 0x1a, |
224 | .timer_bit = 2, | 219 | .timer_bit = 2, |
225 | .clk = "peripheral_clk", | 220 | .clk = "peripheral_clk", |
@@ -227,7 +222,6 @@ static struct sh_timer_config tmu2_platform_data = { | |||
227 | 222 | ||
228 | static struct resource tmu2_resources[] = { | 223 | static struct resource tmu2_resources[] = { |
229 | [0] = { | 224 | [0] = { |
230 | .name = "TMU2", | ||
231 | .start = 0xfffffeac, | 225 | .start = 0xfffffeac, |
232 | .end = 0xfffffebb, | 226 | .end = 0xfffffebb, |
233 | .flags = IORESOURCE_MEM, | 227 | .flags = IORESOURCE_MEM, |
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7710.c b/arch/sh/kernel/cpu/sh3/setup-sh7710.c index 0845a3ad006d..2e581e30d13d 100644 --- a/arch/sh/kernel/cpu/sh3/setup-sh7710.c +++ b/arch/sh/kernel/cpu/sh3/setup-sh7710.c | |||
@@ -127,7 +127,6 @@ static struct platform_device scif1_device = { | |||
127 | }; | 127 | }; |
128 | 128 | ||
129 | static struct sh_timer_config tmu0_platform_data = { | 129 | static struct sh_timer_config tmu0_platform_data = { |
130 | .name = "TMU0", | ||
131 | .channel_offset = 0x02, | 130 | .channel_offset = 0x02, |
132 | .timer_bit = 0, | 131 | .timer_bit = 0, |
133 | .clk = "peripheral_clk", | 132 | .clk = "peripheral_clk", |
@@ -136,7 +135,6 @@ static struct sh_timer_config tmu0_platform_data = { | |||
136 | 135 | ||
137 | static struct resource tmu0_resources[] = { | 136 | static struct resource tmu0_resources[] = { |
138 | [0] = { | 137 | [0] = { |
139 | .name = "TMU0", | ||
140 | .start = 0xa412fe94, | 138 | .start = 0xa412fe94, |
141 | .end = 0xa412fe9f, | 139 | .end = 0xa412fe9f, |
142 | .flags = IORESOURCE_MEM, | 140 | .flags = IORESOURCE_MEM, |
@@ -158,7 +156,6 @@ static struct platform_device tmu0_device = { | |||
158 | }; | 156 | }; |
159 | 157 | ||
160 | static struct sh_timer_config tmu1_platform_data = { | 158 | static struct sh_timer_config tmu1_platform_data = { |
161 | .name = "TMU1", | ||
162 | .channel_offset = 0xe, | 159 | .channel_offset = 0xe, |
163 | .timer_bit = 1, | 160 | .timer_bit = 1, |
164 | .clk = "peripheral_clk", | 161 | .clk = "peripheral_clk", |
@@ -167,7 +164,6 @@ static struct sh_timer_config tmu1_platform_data = { | |||
167 | 164 | ||
168 | static struct resource tmu1_resources[] = { | 165 | static struct resource tmu1_resources[] = { |
169 | [0] = { | 166 | [0] = { |
170 | .name = "TMU1", | ||
171 | .start = 0xa412fea0, | 167 | .start = 0xa412fea0, |
172 | .end = 0xa412feab, | 168 | .end = 0xa412feab, |
173 | .flags = IORESOURCE_MEM, | 169 | .flags = IORESOURCE_MEM, |
@@ -189,7 +185,6 @@ static struct platform_device tmu1_device = { | |||
189 | }; | 185 | }; |
190 | 186 | ||
191 | static struct sh_timer_config tmu2_platform_data = { | 187 | static struct sh_timer_config tmu2_platform_data = { |
192 | .name = "TMU2", | ||
193 | .channel_offset = 0x1a, | 188 | .channel_offset = 0x1a, |
194 | .timer_bit = 2, | 189 | .timer_bit = 2, |
195 | .clk = "peripheral_clk", | 190 | .clk = "peripheral_clk", |
@@ -197,7 +192,6 @@ static struct sh_timer_config tmu2_platform_data = { | |||
197 | 192 | ||
198 | static struct resource tmu2_resources[] = { | 193 | static struct resource tmu2_resources[] = { |
199 | [0] = { | 194 | [0] = { |
200 | .name = "TMU2", | ||
201 | .start = 0xa412feac, | 195 | .start = 0xa412feac, |
202 | .end = 0xa412feb5, | 196 | .end = 0xa412feb5, |
203 | .flags = IORESOURCE_MEM, | 197 | .flags = IORESOURCE_MEM, |
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7720.c b/arch/sh/kernel/cpu/sh3/setup-sh7720.c index a718a6231091..9a006e13b41d 100644 --- a/arch/sh/kernel/cpu/sh3/setup-sh7720.c +++ b/arch/sh/kernel/cpu/sh3/setup-sh7720.c | |||
@@ -130,7 +130,6 @@ static struct platform_device usbf_device = { | |||
130 | }; | 130 | }; |
131 | 131 | ||
132 | static struct sh_timer_config cmt0_platform_data = { | 132 | static struct sh_timer_config cmt0_platform_data = { |
133 | .name = "CMT0", | ||
134 | .channel_offset = 0x10, | 133 | .channel_offset = 0x10, |
135 | .timer_bit = 0, | 134 | .timer_bit = 0, |
136 | .clk = "peripheral_clk", | 135 | .clk = "peripheral_clk", |
@@ -140,7 +139,6 @@ static struct sh_timer_config cmt0_platform_data = { | |||
140 | 139 | ||
141 | static struct resource cmt0_resources[] = { | 140 | static struct resource cmt0_resources[] = { |
142 | [0] = { | 141 | [0] = { |
143 | .name = "CMT0", | ||
144 | .start = 0x044a0010, | 142 | .start = 0x044a0010, |
145 | .end = 0x044a001b, | 143 | .end = 0x044a001b, |
146 | .flags = IORESOURCE_MEM, | 144 | .flags = IORESOURCE_MEM, |
@@ -162,7 +160,6 @@ static struct platform_device cmt0_device = { | |||
162 | }; | 160 | }; |
163 | 161 | ||
164 | static struct sh_timer_config cmt1_platform_data = { | 162 | static struct sh_timer_config cmt1_platform_data = { |
165 | .name = "CMT1", | ||
166 | .channel_offset = 0x20, | 163 | .channel_offset = 0x20, |
167 | .timer_bit = 1, | 164 | .timer_bit = 1, |
168 | .clk = "peripheral_clk", | 165 | .clk = "peripheral_clk", |
@@ -170,7 +167,6 @@ static struct sh_timer_config cmt1_platform_data = { | |||
170 | 167 | ||
171 | static struct resource cmt1_resources[] = { | 168 | static struct resource cmt1_resources[] = { |
172 | [0] = { | 169 | [0] = { |
173 | .name = "CMT1", | ||
174 | .start = 0x044a0020, | 170 | .start = 0x044a0020, |
175 | .end = 0x044a002b, | 171 | .end = 0x044a002b, |
176 | .flags = IORESOURCE_MEM, | 172 | .flags = IORESOURCE_MEM, |
@@ -192,7 +188,6 @@ static struct platform_device cmt1_device = { | |||
192 | }; | 188 | }; |
193 | 189 | ||
194 | static struct sh_timer_config cmt2_platform_data = { | 190 | static struct sh_timer_config cmt2_platform_data = { |
195 | .name = "CMT2", | ||
196 | .channel_offset = 0x30, | 191 | .channel_offset = 0x30, |
197 | .timer_bit = 2, | 192 | .timer_bit = 2, |
198 | .clk = "peripheral_clk", | 193 | .clk = "peripheral_clk", |
@@ -200,7 +195,6 @@ static struct sh_timer_config cmt2_platform_data = { | |||
200 | 195 | ||
201 | static struct resource cmt2_resources[] = { | 196 | static struct resource cmt2_resources[] = { |
202 | [0] = { | 197 | [0] = { |
203 | .name = "CMT2", | ||
204 | .start = 0x044a0030, | 198 | .start = 0x044a0030, |
205 | .end = 0x044a003b, | 199 | .end = 0x044a003b, |
206 | .flags = IORESOURCE_MEM, | 200 | .flags = IORESOURCE_MEM, |
@@ -222,7 +216,6 @@ static struct platform_device cmt2_device = { | |||
222 | }; | 216 | }; |
223 | 217 | ||
224 | static struct sh_timer_config cmt3_platform_data = { | 218 | static struct sh_timer_config cmt3_platform_data = { |
225 | .name = "CMT3", | ||
226 | .channel_offset = 0x40, | 219 | .channel_offset = 0x40, |
227 | .timer_bit = 3, | 220 | .timer_bit = 3, |
228 | .clk = "peripheral_clk", | 221 | .clk = "peripheral_clk", |
@@ -230,7 +223,6 @@ static struct sh_timer_config cmt3_platform_data = { | |||
230 | 223 | ||
231 | static struct resource cmt3_resources[] = { | 224 | static struct resource cmt3_resources[] = { |
232 | [0] = { | 225 | [0] = { |
233 | .name = "CMT3", | ||
234 | .start = 0x044a0040, | 226 | .start = 0x044a0040, |
235 | .end = 0x044a004b, | 227 | .end = 0x044a004b, |
236 | .flags = IORESOURCE_MEM, | 228 | .flags = IORESOURCE_MEM, |
@@ -252,7 +244,6 @@ static struct platform_device cmt3_device = { | |||
252 | }; | 244 | }; |
253 | 245 | ||
254 | static struct sh_timer_config cmt4_platform_data = { | 246 | static struct sh_timer_config cmt4_platform_data = { |
255 | .name = "CMT4", | ||
256 | .channel_offset = 0x50, | 247 | .channel_offset = 0x50, |
257 | .timer_bit = 4, | 248 | .timer_bit = 4, |
258 | .clk = "peripheral_clk", | 249 | .clk = "peripheral_clk", |
@@ -260,7 +251,6 @@ static struct sh_timer_config cmt4_platform_data = { | |||
260 | 251 | ||
261 | static struct resource cmt4_resources[] = { | 252 | static struct resource cmt4_resources[] = { |
262 | [0] = { | 253 | [0] = { |
263 | .name = "CMT4", | ||
264 | .start = 0x044a0050, | 254 | .start = 0x044a0050, |
265 | .end = 0x044a005b, | 255 | .end = 0x044a005b, |
266 | .flags = IORESOURCE_MEM, | 256 | .flags = IORESOURCE_MEM, |
@@ -282,7 +272,6 @@ static struct platform_device cmt4_device = { | |||
282 | }; | 272 | }; |
283 | 273 | ||
284 | static struct sh_timer_config tmu0_platform_data = { | 274 | static struct sh_timer_config tmu0_platform_data = { |
285 | .name = "TMU0", | ||
286 | .channel_offset = 0x02, | 275 | .channel_offset = 0x02, |
287 | .timer_bit = 0, | 276 | .timer_bit = 0, |
288 | .clk = "peripheral_clk", | 277 | .clk = "peripheral_clk", |
@@ -291,7 +280,6 @@ static struct sh_timer_config tmu0_platform_data = { | |||
291 | 280 | ||
292 | static struct resource tmu0_resources[] = { | 281 | static struct resource tmu0_resources[] = { |
293 | [0] = { | 282 | [0] = { |
294 | .name = "TMU0", | ||
295 | .start = 0xa412fe94, | 283 | .start = 0xa412fe94, |
296 | .end = 0xa412fe9f, | 284 | .end = 0xa412fe9f, |
297 | .flags = IORESOURCE_MEM, | 285 | .flags = IORESOURCE_MEM, |
@@ -313,7 +301,6 @@ static struct platform_device tmu0_device = { | |||
313 | }; | 301 | }; |
314 | 302 | ||
315 | static struct sh_timer_config tmu1_platform_data = { | 303 | static struct sh_timer_config tmu1_platform_data = { |
316 | .name = "TMU1", | ||
317 | .channel_offset = 0xe, | 304 | .channel_offset = 0xe, |
318 | .timer_bit = 1, | 305 | .timer_bit = 1, |
319 | .clk = "peripheral_clk", | 306 | .clk = "peripheral_clk", |
@@ -322,7 +309,6 @@ static struct sh_timer_config tmu1_platform_data = { | |||
322 | 309 | ||
323 | static struct resource tmu1_resources[] = { | 310 | static struct resource tmu1_resources[] = { |
324 | [0] = { | 311 | [0] = { |
325 | .name = "TMU1", | ||
326 | .start = 0xa412fea0, | 312 | .start = 0xa412fea0, |
327 | .end = 0xa412feab, | 313 | .end = 0xa412feab, |
328 | .flags = IORESOURCE_MEM, | 314 | .flags = IORESOURCE_MEM, |
@@ -344,7 +330,6 @@ static struct platform_device tmu1_device = { | |||
344 | }; | 330 | }; |
345 | 331 | ||
346 | static struct sh_timer_config tmu2_platform_data = { | 332 | static struct sh_timer_config tmu2_platform_data = { |
347 | .name = "TMU2", | ||
348 | .channel_offset = 0x1a, | 333 | .channel_offset = 0x1a, |
349 | .timer_bit = 2, | 334 | .timer_bit = 2, |
350 | .clk = "peripheral_clk", | 335 | .clk = "peripheral_clk", |
@@ -352,7 +337,6 @@ static struct sh_timer_config tmu2_platform_data = { | |||
352 | 337 | ||
353 | static struct resource tmu2_resources[] = { | 338 | static struct resource tmu2_resources[] = { |
354 | [0] = { | 339 | [0] = { |
355 | .name = "TMU2", | ||
356 | .start = 0xa412feac, | 340 | .start = 0xa412feac, |
357 | .end = 0xa412feb5, | 341 | .end = 0xa412feb5, |
358 | .flags = IORESOURCE_MEM, | 342 | .flags = IORESOURCE_MEM, |
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh4-202.c b/arch/sh/kernel/cpu/sh4/setup-sh4-202.c index b9b7e10ad68f..223d06657775 100644 --- a/arch/sh/kernel/cpu/sh4/setup-sh4-202.c +++ b/arch/sh/kernel/cpu/sh4/setup-sh4-202.c | |||
@@ -31,7 +31,6 @@ static struct platform_device scif0_device = { | |||
31 | }; | 31 | }; |
32 | 32 | ||
33 | static struct sh_timer_config tmu0_platform_data = { | 33 | static struct sh_timer_config tmu0_platform_data = { |
34 | .name = "TMU0", | ||
35 | .channel_offset = 0x04, | 34 | .channel_offset = 0x04, |
36 | .timer_bit = 0, | 35 | .timer_bit = 0, |
37 | .clk = "peripheral_clk", | 36 | .clk = "peripheral_clk", |
@@ -40,7 +39,6 @@ static struct sh_timer_config tmu0_platform_data = { | |||
40 | 39 | ||
41 | static struct resource tmu0_resources[] = { | 40 | static struct resource tmu0_resources[] = { |
42 | [0] = { | 41 | [0] = { |
43 | .name = "TMU0", | ||
44 | .start = 0xffd80008, | 42 | .start = 0xffd80008, |
45 | .end = 0xffd80013, | 43 | .end = 0xffd80013, |
46 | .flags = IORESOURCE_MEM, | 44 | .flags = IORESOURCE_MEM, |
@@ -62,7 +60,6 @@ static struct platform_device tmu0_device = { | |||
62 | }; | 60 | }; |
63 | 61 | ||
64 | static struct sh_timer_config tmu1_platform_data = { | 62 | static struct sh_timer_config tmu1_platform_data = { |
65 | .name = "TMU1", | ||
66 | .channel_offset = 0x10, | 63 | .channel_offset = 0x10, |
67 | .timer_bit = 1, | 64 | .timer_bit = 1, |
68 | .clk = "peripheral_clk", | 65 | .clk = "peripheral_clk", |
@@ -71,7 +68,6 @@ static struct sh_timer_config tmu1_platform_data = { | |||
71 | 68 | ||
72 | static struct resource tmu1_resources[] = { | 69 | static struct resource tmu1_resources[] = { |
73 | [0] = { | 70 | [0] = { |
74 | .name = "TMU1", | ||
75 | .start = 0xffd80014, | 71 | .start = 0xffd80014, |
76 | .end = 0xffd8001f, | 72 | .end = 0xffd8001f, |
77 | .flags = IORESOURCE_MEM, | 73 | .flags = IORESOURCE_MEM, |
@@ -93,7 +89,6 @@ static struct platform_device tmu1_device = { | |||
93 | }; | 89 | }; |
94 | 90 | ||
95 | static struct sh_timer_config tmu2_platform_data = { | 91 | static struct sh_timer_config tmu2_platform_data = { |
96 | .name = "TMU2", | ||
97 | .channel_offset = 0x1c, | 92 | .channel_offset = 0x1c, |
98 | .timer_bit = 2, | 93 | .timer_bit = 2, |
99 | .clk = "peripheral_clk", | 94 | .clk = "peripheral_clk", |
@@ -101,7 +96,6 @@ static struct sh_timer_config tmu2_platform_data = { | |||
101 | 96 | ||
102 | static struct resource tmu2_resources[] = { | 97 | static struct resource tmu2_resources[] = { |
103 | [0] = { | 98 | [0] = { |
104 | .name = "TMU2", | ||
105 | .start = 0xffd80020, | 99 | .start = 0xffd80020, |
106 | .end = 0xffd8002f, | 100 | .end = 0xffd8002f, |
107 | .flags = IORESOURCE_MEM, | 101 | .flags = IORESOURCE_MEM, |
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7750.c b/arch/sh/kernel/cpu/sh4/setup-sh7750.c index ffd79e57254f..2f337b143c8f 100644 --- a/arch/sh/kernel/cpu/sh4/setup-sh7750.c +++ b/arch/sh/kernel/cpu/sh4/setup-sh7750.c | |||
@@ -66,7 +66,6 @@ static struct platform_device scif1_device = { | |||
66 | }; | 66 | }; |
67 | 67 | ||
68 | static struct sh_timer_config tmu0_platform_data = { | 68 | static struct sh_timer_config tmu0_platform_data = { |
69 | .name = "TMU0", | ||
70 | .channel_offset = 0x04, | 69 | .channel_offset = 0x04, |
71 | .timer_bit = 0, | 70 | .timer_bit = 0, |
72 | .clk = "peripheral_clk", | 71 | .clk = "peripheral_clk", |
@@ -75,7 +74,6 @@ static struct sh_timer_config tmu0_platform_data = { | |||
75 | 74 | ||
76 | static struct resource tmu0_resources[] = { | 75 | static struct resource tmu0_resources[] = { |
77 | [0] = { | 76 | [0] = { |
78 | .name = "TMU0", | ||
79 | .start = 0xffd80008, | 77 | .start = 0xffd80008, |
80 | .end = 0xffd80013, | 78 | .end = 0xffd80013, |
81 | .flags = IORESOURCE_MEM, | 79 | .flags = IORESOURCE_MEM, |
@@ -97,7 +95,6 @@ static struct platform_device tmu0_device = { | |||
97 | }; | 95 | }; |
98 | 96 | ||
99 | static struct sh_timer_config tmu1_platform_data = { | 97 | static struct sh_timer_config tmu1_platform_data = { |
100 | .name = "TMU1", | ||
101 | .channel_offset = 0x10, | 98 | .channel_offset = 0x10, |
102 | .timer_bit = 1, | 99 | .timer_bit = 1, |
103 | .clk = "peripheral_clk", | 100 | .clk = "peripheral_clk", |
@@ -106,7 +103,6 @@ static struct sh_timer_config tmu1_platform_data = { | |||
106 | 103 | ||
107 | static struct resource tmu1_resources[] = { | 104 | static struct resource tmu1_resources[] = { |
108 | [0] = { | 105 | [0] = { |
109 | .name = "TMU1", | ||
110 | .start = 0xffd80014, | 106 | .start = 0xffd80014, |
111 | .end = 0xffd8001f, | 107 | .end = 0xffd8001f, |
112 | .flags = IORESOURCE_MEM, | 108 | .flags = IORESOURCE_MEM, |
@@ -128,7 +124,6 @@ static struct platform_device tmu1_device = { | |||
128 | }; | 124 | }; |
129 | 125 | ||
130 | static struct sh_timer_config tmu2_platform_data = { | 126 | static struct sh_timer_config tmu2_platform_data = { |
131 | .name = "TMU2", | ||
132 | .channel_offset = 0x1c, | 127 | .channel_offset = 0x1c, |
133 | .timer_bit = 2, | 128 | .timer_bit = 2, |
134 | .clk = "peripheral_clk", | 129 | .clk = "peripheral_clk", |
@@ -136,7 +131,6 @@ static struct sh_timer_config tmu2_platform_data = { | |||
136 | 131 | ||
137 | static struct resource tmu2_resources[] = { | 132 | static struct resource tmu2_resources[] = { |
138 | [0] = { | 133 | [0] = { |
139 | .name = "TMU2", | ||
140 | .start = 0xffd80020, | 134 | .start = 0xffd80020, |
141 | .end = 0xffd8002f, | 135 | .end = 0xffd8002f, |
142 | .flags = IORESOURCE_MEM, | 136 | .flags = IORESOURCE_MEM, |
@@ -163,7 +157,6 @@ static struct platform_device tmu2_device = { | |||
163 | defined(CONFIG_CPU_SUBTYPE_SH7751R) | 157 | defined(CONFIG_CPU_SUBTYPE_SH7751R) |
164 | 158 | ||
165 | static struct sh_timer_config tmu3_platform_data = { | 159 | static struct sh_timer_config tmu3_platform_data = { |
166 | .name = "TMU3", | ||
167 | .channel_offset = 0x04, | 160 | .channel_offset = 0x04, |
168 | .timer_bit = 0, | 161 | .timer_bit = 0, |
169 | .clk = "peripheral_clk", | 162 | .clk = "peripheral_clk", |
@@ -171,7 +164,6 @@ static struct sh_timer_config tmu3_platform_data = { | |||
171 | 164 | ||
172 | static struct resource tmu3_resources[] = { | 165 | static struct resource tmu3_resources[] = { |
173 | [0] = { | 166 | [0] = { |
174 | .name = "TMU3", | ||
175 | .start = 0xfe100008, | 167 | .start = 0xfe100008, |
176 | .end = 0xfe100013, | 168 | .end = 0xfe100013, |
177 | .flags = IORESOURCE_MEM, | 169 | .flags = IORESOURCE_MEM, |
@@ -193,7 +185,6 @@ static struct platform_device tmu3_device = { | |||
193 | }; | 185 | }; |
194 | 186 | ||
195 | static struct sh_timer_config tmu4_platform_data = { | 187 | static struct sh_timer_config tmu4_platform_data = { |
196 | .name = "TMU4", | ||
197 | .channel_offset = 0x10, | 188 | .channel_offset = 0x10, |
198 | .timer_bit = 1, | 189 | .timer_bit = 1, |
199 | .clk = "peripheral_clk", | 190 | .clk = "peripheral_clk", |
@@ -201,7 +192,6 @@ static struct sh_timer_config tmu4_platform_data = { | |||
201 | 192 | ||
202 | static struct resource tmu4_resources[] = { | 193 | static struct resource tmu4_resources[] = { |
203 | [0] = { | 194 | [0] = { |
204 | .name = "TMU4", | ||
205 | .start = 0xfe100014, | 195 | .start = 0xfe100014, |
206 | .end = 0xfe10001f, | 196 | .end = 0xfe10001f, |
207 | .flags = IORESOURCE_MEM, | 197 | .flags = IORESOURCE_MEM, |
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7760.c b/arch/sh/kernel/cpu/sh4/setup-sh7760.c index a16eb3656f4b..fa43da0502bd 100644 --- a/arch/sh/kernel/cpu/sh4/setup-sh7760.c +++ b/arch/sh/kernel/cpu/sh4/setup-sh7760.c | |||
@@ -187,7 +187,6 @@ static struct platform_device scif3_device = { | |||
187 | }; | 187 | }; |
188 | 188 | ||
189 | static struct sh_timer_config tmu0_platform_data = { | 189 | static struct sh_timer_config tmu0_platform_data = { |
190 | .name = "TMU0", | ||
191 | .channel_offset = 0x04, | 190 | .channel_offset = 0x04, |
192 | .timer_bit = 0, | 191 | .timer_bit = 0, |
193 | .clk = "peripheral_clk", | 192 | .clk = "peripheral_clk", |
@@ -196,7 +195,6 @@ static struct sh_timer_config tmu0_platform_data = { | |||
196 | 195 | ||
197 | static struct resource tmu0_resources[] = { | 196 | static struct resource tmu0_resources[] = { |
198 | [0] = { | 197 | [0] = { |
199 | .name = "TMU0", | ||
200 | .start = 0xffd80008, | 198 | .start = 0xffd80008, |
201 | .end = 0xffd80013, | 199 | .end = 0xffd80013, |
202 | .flags = IORESOURCE_MEM, | 200 | .flags = IORESOURCE_MEM, |
@@ -218,7 +216,6 @@ static struct platform_device tmu0_device = { | |||
218 | }; | 216 | }; |
219 | 217 | ||
220 | static struct sh_timer_config tmu1_platform_data = { | 218 | static struct sh_timer_config tmu1_platform_data = { |
221 | .name = "TMU1", | ||
222 | .channel_offset = 0x10, | 219 | .channel_offset = 0x10, |
223 | .timer_bit = 1, | 220 | .timer_bit = 1, |
224 | .clk = "peripheral_clk", | 221 | .clk = "peripheral_clk", |
@@ -227,7 +224,6 @@ static struct sh_timer_config tmu1_platform_data = { | |||
227 | 224 | ||
228 | static struct resource tmu1_resources[] = { | 225 | static struct resource tmu1_resources[] = { |
229 | [0] = { | 226 | [0] = { |
230 | .name = "TMU1", | ||
231 | .start = 0xffd80014, | 227 | .start = 0xffd80014, |
232 | .end = 0xffd8001f, | 228 | .end = 0xffd8001f, |
233 | .flags = IORESOURCE_MEM, | 229 | .flags = IORESOURCE_MEM, |
@@ -249,7 +245,6 @@ static struct platform_device tmu1_device = { | |||
249 | }; | 245 | }; |
250 | 246 | ||
251 | static struct sh_timer_config tmu2_platform_data = { | 247 | static struct sh_timer_config tmu2_platform_data = { |
252 | .name = "TMU2", | ||
253 | .channel_offset = 0x1c, | 248 | .channel_offset = 0x1c, |
254 | .timer_bit = 2, | 249 | .timer_bit = 2, |
255 | .clk = "peripheral_clk", | 250 | .clk = "peripheral_clk", |
@@ -257,7 +252,6 @@ static struct sh_timer_config tmu2_platform_data = { | |||
257 | 252 | ||
258 | static struct resource tmu2_resources[] = { | 253 | static struct resource tmu2_resources[] = { |
259 | [0] = { | 254 | [0] = { |
260 | .name = "TMU2", | ||
261 | .start = 0xffd80020, | 255 | .start = 0xffd80020, |
262 | .end = 0xffd8002f, | 256 | .end = 0xffd8002f, |
263 | .flags = IORESOURCE_MEM, | 257 | .flags = IORESOURCE_MEM, |
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/sh/kernel/cpu/sh4a/setup-sh7343.c b/arch/sh/kernel/cpu/sh4a/setup-sh7343.c index 45eb1bfd42c9..fdbd7d07a69f 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7343.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7343.c | |||
@@ -207,7 +207,6 @@ static struct platform_device jpu_device = { | |||
207 | }; | 207 | }; |
208 | 208 | ||
209 | static struct sh_timer_config cmt_platform_data = { | 209 | static struct sh_timer_config cmt_platform_data = { |
210 | .name = "CMT", | ||
211 | .channel_offset = 0x60, | 210 | .channel_offset = 0x60, |
212 | .timer_bit = 5, | 211 | .timer_bit = 5, |
213 | .clk = "cmt0", | 212 | .clk = "cmt0", |
@@ -217,7 +216,6 @@ static struct sh_timer_config cmt_platform_data = { | |||
217 | 216 | ||
218 | static struct resource cmt_resources[] = { | 217 | static struct resource cmt_resources[] = { |
219 | [0] = { | 218 | [0] = { |
220 | .name = "CMT", | ||
221 | .start = 0x044a0060, | 219 | .start = 0x044a0060, |
222 | .end = 0x044a006b, | 220 | .end = 0x044a006b, |
223 | .flags = IORESOURCE_MEM, | 221 | .flags = IORESOURCE_MEM, |
@@ -239,7 +237,6 @@ static struct platform_device cmt_device = { | |||
239 | }; | 237 | }; |
240 | 238 | ||
241 | static struct sh_timer_config tmu0_platform_data = { | 239 | static struct sh_timer_config tmu0_platform_data = { |
242 | .name = "TMU0", | ||
243 | .channel_offset = 0x04, | 240 | .channel_offset = 0x04, |
244 | .timer_bit = 0, | 241 | .timer_bit = 0, |
245 | .clk = "tmu0", | 242 | .clk = "tmu0", |
@@ -248,7 +245,6 @@ static struct sh_timer_config tmu0_platform_data = { | |||
248 | 245 | ||
249 | static struct resource tmu0_resources[] = { | 246 | static struct resource tmu0_resources[] = { |
250 | [0] = { | 247 | [0] = { |
251 | .name = "TMU0", | ||
252 | .start = 0xffd80008, | 248 | .start = 0xffd80008, |
253 | .end = 0xffd80013, | 249 | .end = 0xffd80013, |
254 | .flags = IORESOURCE_MEM, | 250 | .flags = IORESOURCE_MEM, |
@@ -270,7 +266,6 @@ static struct platform_device tmu0_device = { | |||
270 | }; | 266 | }; |
271 | 267 | ||
272 | static struct sh_timer_config tmu1_platform_data = { | 268 | static struct sh_timer_config tmu1_platform_data = { |
273 | .name = "TMU1", | ||
274 | .channel_offset = 0x10, | 269 | .channel_offset = 0x10, |
275 | .timer_bit = 1, | 270 | .timer_bit = 1, |
276 | .clk = "tmu0", | 271 | .clk = "tmu0", |
@@ -279,7 +274,6 @@ static struct sh_timer_config tmu1_platform_data = { | |||
279 | 274 | ||
280 | static struct resource tmu1_resources[] = { | 275 | static struct resource tmu1_resources[] = { |
281 | [0] = { | 276 | [0] = { |
282 | .name = "TMU1", | ||
283 | .start = 0xffd80014, | 277 | .start = 0xffd80014, |
284 | .end = 0xffd8001f, | 278 | .end = 0xffd8001f, |
285 | .flags = IORESOURCE_MEM, | 279 | .flags = IORESOURCE_MEM, |
@@ -301,7 +295,6 @@ static struct platform_device tmu1_device = { | |||
301 | }; | 295 | }; |
302 | 296 | ||
303 | static struct sh_timer_config tmu2_platform_data = { | 297 | static struct sh_timer_config tmu2_platform_data = { |
304 | .name = "TMU2", | ||
305 | .channel_offset = 0x1c, | 298 | .channel_offset = 0x1c, |
306 | .timer_bit = 2, | 299 | .timer_bit = 2, |
307 | .clk = "tmu0", | 300 | .clk = "tmu0", |
@@ -309,7 +302,6 @@ static struct sh_timer_config tmu2_platform_data = { | |||
309 | 302 | ||
310 | static struct resource tmu2_resources[] = { | 303 | static struct resource tmu2_resources[] = { |
311 | [0] = { | 304 | [0] = { |
312 | .name = "TMU2", | ||
313 | .start = 0xffd80020, | 305 | .start = 0xffd80020, |
314 | .end = 0xffd8002b, | 306 | .end = 0xffd8002b, |
315 | .flags = IORESOURCE_MEM, | 307 | .flags = IORESOURCE_MEM, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c index c494c193e3b6..d90fe0a65c2a 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c | |||
@@ -169,7 +169,6 @@ static struct platform_device veu1_device = { | |||
169 | }; | 169 | }; |
170 | 170 | ||
171 | static struct sh_timer_config cmt_platform_data = { | 171 | static struct sh_timer_config cmt_platform_data = { |
172 | .name = "CMT", | ||
173 | .channel_offset = 0x60, | 172 | .channel_offset = 0x60, |
174 | .timer_bit = 5, | 173 | .timer_bit = 5, |
175 | .clk = "cmt0", | 174 | .clk = "cmt0", |
@@ -179,7 +178,6 @@ static struct sh_timer_config cmt_platform_data = { | |||
179 | 178 | ||
180 | static struct resource cmt_resources[] = { | 179 | static struct resource cmt_resources[] = { |
181 | [0] = { | 180 | [0] = { |
182 | .name = "CMT", | ||
183 | .start = 0x044a0060, | 181 | .start = 0x044a0060, |
184 | .end = 0x044a006b, | 182 | .end = 0x044a006b, |
185 | .flags = IORESOURCE_MEM, | 183 | .flags = IORESOURCE_MEM, |
@@ -201,7 +199,6 @@ static struct platform_device cmt_device = { | |||
201 | }; | 199 | }; |
202 | 200 | ||
203 | static struct sh_timer_config tmu0_platform_data = { | 201 | static struct sh_timer_config tmu0_platform_data = { |
204 | .name = "TMU0", | ||
205 | .channel_offset = 0x04, | 202 | .channel_offset = 0x04, |
206 | .timer_bit = 0, | 203 | .timer_bit = 0, |
207 | .clk = "tmu0", | 204 | .clk = "tmu0", |
@@ -210,7 +207,6 @@ static struct sh_timer_config tmu0_platform_data = { | |||
210 | 207 | ||
211 | static struct resource tmu0_resources[] = { | 208 | static struct resource tmu0_resources[] = { |
212 | [0] = { | 209 | [0] = { |
213 | .name = "TMU0", | ||
214 | .start = 0xffd80008, | 210 | .start = 0xffd80008, |
215 | .end = 0xffd80013, | 211 | .end = 0xffd80013, |
216 | .flags = IORESOURCE_MEM, | 212 | .flags = IORESOURCE_MEM, |
@@ -232,7 +228,6 @@ static struct platform_device tmu0_device = { | |||
232 | }; | 228 | }; |
233 | 229 | ||
234 | static struct sh_timer_config tmu1_platform_data = { | 230 | static struct sh_timer_config tmu1_platform_data = { |
235 | .name = "TMU1", | ||
236 | .channel_offset = 0x10, | 231 | .channel_offset = 0x10, |
237 | .timer_bit = 1, | 232 | .timer_bit = 1, |
238 | .clk = "tmu0", | 233 | .clk = "tmu0", |
@@ -241,7 +236,6 @@ static struct sh_timer_config tmu1_platform_data = { | |||
241 | 236 | ||
242 | static struct resource tmu1_resources[] = { | 237 | static struct resource tmu1_resources[] = { |
243 | [0] = { | 238 | [0] = { |
244 | .name = "TMU1", | ||
245 | .start = 0xffd80014, | 239 | .start = 0xffd80014, |
246 | .end = 0xffd8001f, | 240 | .end = 0xffd8001f, |
247 | .flags = IORESOURCE_MEM, | 241 | .flags = IORESOURCE_MEM, |
@@ -263,7 +257,6 @@ static struct platform_device tmu1_device = { | |||
263 | }; | 257 | }; |
264 | 258 | ||
265 | static struct sh_timer_config tmu2_platform_data = { | 259 | static struct sh_timer_config tmu2_platform_data = { |
266 | .name = "TMU2", | ||
267 | .channel_offset = 0x1c, | 260 | .channel_offset = 0x1c, |
268 | .timer_bit = 2, | 261 | .timer_bit = 2, |
269 | .clk = "tmu0", | 262 | .clk = "tmu0", |
@@ -271,7 +264,6 @@ static struct sh_timer_config tmu2_platform_data = { | |||
271 | 264 | ||
272 | static struct resource tmu2_resources[] = { | 265 | static struct resource tmu2_resources[] = { |
273 | [0] = { | 266 | [0] = { |
274 | .name = "TMU2", | ||
275 | .start = 0xffd80020, | 267 | .start = 0xffd80020, |
276 | .end = 0xffd8002b, | 268 | .end = 0xffd8002b, |
277 | .flags = IORESOURCE_MEM, | 269 | .flags = IORESOURCE_MEM, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c index fd7e3639e845..83ae9ad19874 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c | |||
@@ -401,7 +401,6 @@ static struct platform_device jpu_device = { | |||
401 | }; | 401 | }; |
402 | 402 | ||
403 | static struct sh_timer_config cmt_platform_data = { | 403 | static struct sh_timer_config cmt_platform_data = { |
404 | .name = "CMT", | ||
405 | .channel_offset = 0x60, | 404 | .channel_offset = 0x60, |
406 | .timer_bit = 5, | 405 | .timer_bit = 5, |
407 | .clk = "cmt0", | 406 | .clk = "cmt0", |
@@ -411,7 +410,6 @@ static struct sh_timer_config cmt_platform_data = { | |||
411 | 410 | ||
412 | static struct resource cmt_resources[] = { | 411 | static struct resource cmt_resources[] = { |
413 | [0] = { | 412 | [0] = { |
414 | .name = "CMT", | ||
415 | .start = 0x044a0060, | 413 | .start = 0x044a0060, |
416 | .end = 0x044a006b, | 414 | .end = 0x044a006b, |
417 | .flags = IORESOURCE_MEM, | 415 | .flags = IORESOURCE_MEM, |
@@ -436,7 +434,6 @@ static struct platform_device cmt_device = { | |||
436 | }; | 434 | }; |
437 | 435 | ||
438 | static struct sh_timer_config tmu0_platform_data = { | 436 | static struct sh_timer_config tmu0_platform_data = { |
439 | .name = "TMU0", | ||
440 | .channel_offset = 0x04, | 437 | .channel_offset = 0x04, |
441 | .timer_bit = 0, | 438 | .timer_bit = 0, |
442 | .clk = "tmu0", | 439 | .clk = "tmu0", |
@@ -445,7 +442,6 @@ static struct sh_timer_config tmu0_platform_data = { | |||
445 | 442 | ||
446 | static struct resource tmu0_resources[] = { | 443 | static struct resource tmu0_resources[] = { |
447 | [0] = { | 444 | [0] = { |
448 | .name = "TMU0", | ||
449 | .start = 0xffd80008, | 445 | .start = 0xffd80008, |
450 | .end = 0xffd80013, | 446 | .end = 0xffd80013, |
451 | .flags = IORESOURCE_MEM, | 447 | .flags = IORESOURCE_MEM, |
@@ -470,7 +466,6 @@ static struct platform_device tmu0_device = { | |||
470 | }; | 466 | }; |
471 | 467 | ||
472 | static struct sh_timer_config tmu1_platform_data = { | 468 | static struct sh_timer_config tmu1_platform_data = { |
473 | .name = "TMU1", | ||
474 | .channel_offset = 0x10, | 469 | .channel_offset = 0x10, |
475 | .timer_bit = 1, | 470 | .timer_bit = 1, |
476 | .clk = "tmu0", | 471 | .clk = "tmu0", |
@@ -479,7 +474,6 @@ static struct sh_timer_config tmu1_platform_data = { | |||
479 | 474 | ||
480 | static struct resource tmu1_resources[] = { | 475 | static struct resource tmu1_resources[] = { |
481 | [0] = { | 476 | [0] = { |
482 | .name = "TMU1", | ||
483 | .start = 0xffd80014, | 477 | .start = 0xffd80014, |
484 | .end = 0xffd8001f, | 478 | .end = 0xffd8001f, |
485 | .flags = IORESOURCE_MEM, | 479 | .flags = IORESOURCE_MEM, |
@@ -504,7 +498,6 @@ static struct platform_device tmu1_device = { | |||
504 | }; | 498 | }; |
505 | 499 | ||
506 | static struct sh_timer_config tmu2_platform_data = { | 500 | static struct sh_timer_config tmu2_platform_data = { |
507 | .name = "TMU2", | ||
508 | .channel_offset = 0x1c, | 501 | .channel_offset = 0x1c, |
509 | .timer_bit = 2, | 502 | .timer_bit = 2, |
510 | .clk = "tmu0", | 503 | .clk = "tmu0", |
@@ -512,7 +505,6 @@ static struct sh_timer_config tmu2_platform_data = { | |||
512 | 505 | ||
513 | static struct resource tmu2_resources[] = { | 506 | static struct resource tmu2_resources[] = { |
514 | [0] = { | 507 | [0] = { |
515 | .name = "TMU2", | ||
516 | .start = 0xffd80020, | 508 | .start = 0xffd80020, |
517 | .end = 0xffd8002b, | 509 | .end = 0xffd8002b, |
518 | .flags = IORESOURCE_MEM, | 510 | .flags = IORESOURCE_MEM, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c index 85c61f624702..68446b3f06af 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c | |||
@@ -211,7 +211,6 @@ static struct platform_device veu1_device = { | |||
211 | }; | 211 | }; |
212 | 212 | ||
213 | static struct sh_timer_config cmt_platform_data = { | 213 | static struct sh_timer_config cmt_platform_data = { |
214 | .name = "CMT", | ||
215 | .channel_offset = 0x60, | 214 | .channel_offset = 0x60, |
216 | .timer_bit = 5, | 215 | .timer_bit = 5, |
217 | .clk = "cmt0", | 216 | .clk = "cmt0", |
@@ -221,7 +220,6 @@ static struct sh_timer_config cmt_platform_data = { | |||
221 | 220 | ||
222 | static struct resource cmt_resources[] = { | 221 | static struct resource cmt_resources[] = { |
223 | [0] = { | 222 | [0] = { |
224 | .name = "CMT", | ||
225 | .start = 0x044a0060, | 223 | .start = 0x044a0060, |
226 | .end = 0x044a006b, | 224 | .end = 0x044a006b, |
227 | .flags = IORESOURCE_MEM, | 225 | .flags = IORESOURCE_MEM, |
@@ -246,7 +244,6 @@ static struct platform_device cmt_device = { | |||
246 | }; | 244 | }; |
247 | 245 | ||
248 | static struct sh_timer_config tmu0_platform_data = { | 246 | static struct sh_timer_config tmu0_platform_data = { |
249 | .name = "TMU0", | ||
250 | .channel_offset = 0x04, | 247 | .channel_offset = 0x04, |
251 | .timer_bit = 0, | 248 | .timer_bit = 0, |
252 | .clk = "tmu0", | 249 | .clk = "tmu0", |
@@ -255,7 +252,6 @@ static struct sh_timer_config tmu0_platform_data = { | |||
255 | 252 | ||
256 | static struct resource tmu0_resources[] = { | 253 | static struct resource tmu0_resources[] = { |
257 | [0] = { | 254 | [0] = { |
258 | .name = "TMU0", | ||
259 | .start = 0xffd80008, | 255 | .start = 0xffd80008, |
260 | .end = 0xffd80013, | 256 | .end = 0xffd80013, |
261 | .flags = IORESOURCE_MEM, | 257 | .flags = IORESOURCE_MEM, |
@@ -280,7 +276,6 @@ static struct platform_device tmu0_device = { | |||
280 | }; | 276 | }; |
281 | 277 | ||
282 | static struct sh_timer_config tmu1_platform_data = { | 278 | static struct sh_timer_config tmu1_platform_data = { |
283 | .name = "TMU1", | ||
284 | .channel_offset = 0x10, | 279 | .channel_offset = 0x10, |
285 | .timer_bit = 1, | 280 | .timer_bit = 1, |
286 | .clk = "tmu0", | 281 | .clk = "tmu0", |
@@ -289,7 +284,6 @@ static struct sh_timer_config tmu1_platform_data = { | |||
289 | 284 | ||
290 | static struct resource tmu1_resources[] = { | 285 | static struct resource tmu1_resources[] = { |
291 | [0] = { | 286 | [0] = { |
292 | .name = "TMU1", | ||
293 | .start = 0xffd80014, | 287 | .start = 0xffd80014, |
294 | .end = 0xffd8001f, | 288 | .end = 0xffd8001f, |
295 | .flags = IORESOURCE_MEM, | 289 | .flags = IORESOURCE_MEM, |
@@ -314,7 +308,6 @@ static struct platform_device tmu1_device = { | |||
314 | }; | 308 | }; |
315 | 309 | ||
316 | static struct sh_timer_config tmu2_platform_data = { | 310 | static struct sh_timer_config tmu2_platform_data = { |
317 | .name = "TMU2", | ||
318 | .channel_offset = 0x1c, | 311 | .channel_offset = 0x1c, |
319 | .timer_bit = 2, | 312 | .timer_bit = 2, |
320 | .clk = "tmu0", | 313 | .clk = "tmu0", |
@@ -322,7 +315,6 @@ static struct sh_timer_config tmu2_platform_data = { | |||
322 | 315 | ||
323 | static struct resource tmu2_resources[] = { | 316 | static struct resource tmu2_resources[] = { |
324 | [0] = { | 317 | [0] = { |
325 | .name = "TMU2", | ||
326 | .start = 0xffd80020, | 318 | .start = 0xffd80020, |
327 | .end = 0xffd8002b, | 319 | .end = 0xffd8002b, |
328 | .flags = IORESOURCE_MEM, | 320 | .flags = IORESOURCE_MEM, |
@@ -347,7 +339,6 @@ static struct platform_device tmu2_device = { | |||
347 | }; | 339 | }; |
348 | 340 | ||
349 | static struct sh_timer_config tmu3_platform_data = { | 341 | static struct sh_timer_config tmu3_platform_data = { |
350 | .name = "TMU3", | ||
351 | .channel_offset = 0x04, | 342 | .channel_offset = 0x04, |
352 | .timer_bit = 0, | 343 | .timer_bit = 0, |
353 | .clk = "tmu1", | 344 | .clk = "tmu1", |
@@ -355,7 +346,6 @@ static struct sh_timer_config tmu3_platform_data = { | |||
355 | 346 | ||
356 | static struct resource tmu3_resources[] = { | 347 | static struct resource tmu3_resources[] = { |
357 | [0] = { | 348 | [0] = { |
358 | .name = "TMU3", | ||
359 | .start = 0xffd90008, | 349 | .start = 0xffd90008, |
360 | .end = 0xffd90013, | 350 | .end = 0xffd90013, |
361 | .flags = IORESOURCE_MEM, | 351 | .flags = IORESOURCE_MEM, |
@@ -380,7 +370,6 @@ static struct platform_device tmu3_device = { | |||
380 | }; | 370 | }; |
381 | 371 | ||
382 | static struct sh_timer_config tmu4_platform_data = { | 372 | static struct sh_timer_config tmu4_platform_data = { |
383 | .name = "TMU4", | ||
384 | .channel_offset = 0x10, | 373 | .channel_offset = 0x10, |
385 | .timer_bit = 1, | 374 | .timer_bit = 1, |
386 | .clk = "tmu1", | 375 | .clk = "tmu1", |
@@ -388,7 +377,6 @@ static struct sh_timer_config tmu4_platform_data = { | |||
388 | 377 | ||
389 | static struct resource tmu4_resources[] = { | 378 | static struct resource tmu4_resources[] = { |
390 | [0] = { | 379 | [0] = { |
391 | .name = "TMU4", | ||
392 | .start = 0xffd90014, | 380 | .start = 0xffd90014, |
393 | .end = 0xffd9001f, | 381 | .end = 0xffd9001f, |
394 | .flags = IORESOURCE_MEM, | 382 | .flags = IORESOURCE_MEM, |
@@ -413,7 +401,6 @@ static struct platform_device tmu4_device = { | |||
413 | }; | 401 | }; |
414 | 402 | ||
415 | static struct sh_timer_config tmu5_platform_data = { | 403 | static struct sh_timer_config tmu5_platform_data = { |
416 | .name = "TMU5", | ||
417 | .channel_offset = 0x1c, | 404 | .channel_offset = 0x1c, |
418 | .timer_bit = 2, | 405 | .timer_bit = 2, |
419 | .clk = "tmu1", | 406 | .clk = "tmu1", |
@@ -421,7 +408,6 @@ static struct sh_timer_config tmu5_platform_data = { | |||
421 | 408 | ||
422 | static struct resource tmu5_resources[] = { | 409 | static struct resource tmu5_resources[] = { |
423 | [0] = { | 410 | [0] = { |
424 | .name = "TMU5", | ||
425 | .start = 0xffd90020, | 411 | .start = 0xffd90020, |
426 | .end = 0xffd9002b, | 412 | .end = 0xffd9002b, |
427 | .flags = IORESOURCE_MEM, | 413 | .flags = IORESOURCE_MEM, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c index e7fa2a92fc1f..abc98b0fef91 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c | |||
@@ -485,7 +485,6 @@ static struct platform_device veu1_device = { | |||
485 | }; | 485 | }; |
486 | 486 | ||
487 | static struct sh_timer_config cmt_platform_data = { | 487 | static struct sh_timer_config cmt_platform_data = { |
488 | .name = "CMT", | ||
489 | .channel_offset = 0x60, | 488 | .channel_offset = 0x60, |
490 | .timer_bit = 5, | 489 | .timer_bit = 5, |
491 | .clk = "cmt0", | 490 | .clk = "cmt0", |
@@ -495,7 +494,6 @@ static struct sh_timer_config cmt_platform_data = { | |||
495 | 494 | ||
496 | static struct resource cmt_resources[] = { | 495 | static struct resource cmt_resources[] = { |
497 | [0] = { | 496 | [0] = { |
498 | .name = "CMT", | ||
499 | .start = 0x044a0060, | 497 | .start = 0x044a0060, |
500 | .end = 0x044a006b, | 498 | .end = 0x044a006b, |
501 | .flags = IORESOURCE_MEM, | 499 | .flags = IORESOURCE_MEM, |
@@ -520,7 +518,6 @@ static struct platform_device cmt_device = { | |||
520 | }; | 518 | }; |
521 | 519 | ||
522 | static struct sh_timer_config tmu0_platform_data = { | 520 | static struct sh_timer_config tmu0_platform_data = { |
523 | .name = "TMU0", | ||
524 | .channel_offset = 0x04, | 521 | .channel_offset = 0x04, |
525 | .timer_bit = 0, | 522 | .timer_bit = 0, |
526 | .clk = "tmu0", | 523 | .clk = "tmu0", |
@@ -529,7 +526,6 @@ static struct sh_timer_config tmu0_platform_data = { | |||
529 | 526 | ||
530 | static struct resource tmu0_resources[] = { | 527 | static struct resource tmu0_resources[] = { |
531 | [0] = { | 528 | [0] = { |
532 | .name = "TMU0", | ||
533 | .start = 0xffd80008, | 529 | .start = 0xffd80008, |
534 | .end = 0xffd80013, | 530 | .end = 0xffd80013, |
535 | .flags = IORESOURCE_MEM, | 531 | .flags = IORESOURCE_MEM, |
@@ -554,7 +550,6 @@ static struct platform_device tmu0_device = { | |||
554 | }; | 550 | }; |
555 | 551 | ||
556 | static struct sh_timer_config tmu1_platform_data = { | 552 | static struct sh_timer_config tmu1_platform_data = { |
557 | .name = "TMU1", | ||
558 | .channel_offset = 0x10, | 553 | .channel_offset = 0x10, |
559 | .timer_bit = 1, | 554 | .timer_bit = 1, |
560 | .clk = "tmu0", | 555 | .clk = "tmu0", |
@@ -563,7 +558,6 @@ static struct sh_timer_config tmu1_platform_data = { | |||
563 | 558 | ||
564 | static struct resource tmu1_resources[] = { | 559 | static struct resource tmu1_resources[] = { |
565 | [0] = { | 560 | [0] = { |
566 | .name = "TMU1", | ||
567 | .start = 0xffd80014, | 561 | .start = 0xffd80014, |
568 | .end = 0xffd8001f, | 562 | .end = 0xffd8001f, |
569 | .flags = IORESOURCE_MEM, | 563 | .flags = IORESOURCE_MEM, |
@@ -588,7 +582,6 @@ static struct platform_device tmu1_device = { | |||
588 | }; | 582 | }; |
589 | 583 | ||
590 | static struct sh_timer_config tmu2_platform_data = { | 584 | static struct sh_timer_config tmu2_platform_data = { |
591 | .name = "TMU2", | ||
592 | .channel_offset = 0x1c, | 585 | .channel_offset = 0x1c, |
593 | .timer_bit = 2, | 586 | .timer_bit = 2, |
594 | .clk = "tmu0", | 587 | .clk = "tmu0", |
@@ -596,7 +589,6 @@ static struct sh_timer_config tmu2_platform_data = { | |||
596 | 589 | ||
597 | static struct resource tmu2_resources[] = { | 590 | static struct resource tmu2_resources[] = { |
598 | [0] = { | 591 | [0] = { |
599 | .name = "TMU2", | ||
600 | .start = 0xffd80020, | 592 | .start = 0xffd80020, |
601 | .end = 0xffd8002b, | 593 | .end = 0xffd8002b, |
602 | .flags = IORESOURCE_MEM, | 594 | .flags = IORESOURCE_MEM, |
@@ -622,7 +614,6 @@ static struct platform_device tmu2_device = { | |||
622 | 614 | ||
623 | 615 | ||
624 | static struct sh_timer_config tmu3_platform_data = { | 616 | static struct sh_timer_config tmu3_platform_data = { |
625 | .name = "TMU3", | ||
626 | .channel_offset = 0x04, | 617 | .channel_offset = 0x04, |
627 | .timer_bit = 0, | 618 | .timer_bit = 0, |
628 | .clk = "tmu1", | 619 | .clk = "tmu1", |
@@ -630,7 +621,6 @@ static struct sh_timer_config tmu3_platform_data = { | |||
630 | 621 | ||
631 | static struct resource tmu3_resources[] = { | 622 | static struct resource tmu3_resources[] = { |
632 | [0] = { | 623 | [0] = { |
633 | .name = "TMU3", | ||
634 | .start = 0xffd90008, | 624 | .start = 0xffd90008, |
635 | .end = 0xffd90013, | 625 | .end = 0xffd90013, |
636 | .flags = IORESOURCE_MEM, | 626 | .flags = IORESOURCE_MEM, |
@@ -655,7 +645,6 @@ static struct platform_device tmu3_device = { | |||
655 | }; | 645 | }; |
656 | 646 | ||
657 | static struct sh_timer_config tmu4_platform_data = { | 647 | static struct sh_timer_config tmu4_platform_data = { |
658 | .name = "TMU4", | ||
659 | .channel_offset = 0x10, | 648 | .channel_offset = 0x10, |
660 | .timer_bit = 1, | 649 | .timer_bit = 1, |
661 | .clk = "tmu1", | 650 | .clk = "tmu1", |
@@ -663,7 +652,6 @@ static struct sh_timer_config tmu4_platform_data = { | |||
663 | 652 | ||
664 | static struct resource tmu4_resources[] = { | 653 | static struct resource tmu4_resources[] = { |
665 | [0] = { | 654 | [0] = { |
666 | .name = "TMU4", | ||
667 | .start = 0xffd90014, | 655 | .start = 0xffd90014, |
668 | .end = 0xffd9001f, | 656 | .end = 0xffd9001f, |
669 | .flags = IORESOURCE_MEM, | 657 | .flags = IORESOURCE_MEM, |
@@ -688,7 +676,6 @@ static struct platform_device tmu4_device = { | |||
688 | }; | 676 | }; |
689 | 677 | ||
690 | static struct sh_timer_config tmu5_platform_data = { | 678 | static struct sh_timer_config tmu5_platform_data = { |
691 | .name = "TMU5", | ||
692 | .channel_offset = 0x1c, | 679 | .channel_offset = 0x1c, |
693 | .timer_bit = 2, | 680 | .timer_bit = 2, |
694 | .clk = "tmu1", | 681 | .clk = "tmu1", |
@@ -696,7 +683,6 @@ static struct sh_timer_config tmu5_platform_data = { | |||
696 | 683 | ||
697 | static struct resource tmu5_resources[] = { | 684 | static struct resource tmu5_resources[] = { |
698 | [0] = { | 685 | [0] = { |
699 | .name = "TMU5", | ||
700 | .start = 0xffd90020, | 686 | .start = 0xffd90020, |
701 | .end = 0xffd9002b, | 687 | .end = 0xffd9002b, |
702 | .flags = IORESOURCE_MEM, | 688 | .flags = IORESOURCE_MEM, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c index e75edf58796a..25eddf24f634 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c | |||
@@ -63,7 +63,6 @@ static struct platform_device scif4_device = { | |||
63 | }; | 63 | }; |
64 | 64 | ||
65 | static struct sh_timer_config tmu0_platform_data = { | 65 | static struct sh_timer_config tmu0_platform_data = { |
66 | .name = "TMU0", | ||
67 | .channel_offset = 0x04, | 66 | .channel_offset = 0x04, |
68 | .timer_bit = 0, | 67 | .timer_bit = 0, |
69 | .clk = "peripheral_clk", | 68 | .clk = "peripheral_clk", |
@@ -72,7 +71,6 @@ static struct sh_timer_config tmu0_platform_data = { | |||
72 | 71 | ||
73 | static struct resource tmu0_resources[] = { | 72 | static struct resource tmu0_resources[] = { |
74 | [0] = { | 73 | [0] = { |
75 | .name = "TMU0", | ||
76 | .start = 0xfe430008, | 74 | .start = 0xfe430008, |
77 | .end = 0xfe430013, | 75 | .end = 0xfe430013, |
78 | .flags = IORESOURCE_MEM, | 76 | .flags = IORESOURCE_MEM, |
@@ -94,7 +92,6 @@ static struct platform_device tmu0_device = { | |||
94 | }; | 92 | }; |
95 | 93 | ||
96 | static struct sh_timer_config tmu1_platform_data = { | 94 | static struct sh_timer_config tmu1_platform_data = { |
97 | .name = "TMU1", | ||
98 | .channel_offset = 0x10, | 95 | .channel_offset = 0x10, |
99 | .timer_bit = 1, | 96 | .timer_bit = 1, |
100 | .clk = "peripheral_clk", | 97 | .clk = "peripheral_clk", |
@@ -103,7 +100,6 @@ static struct sh_timer_config tmu1_platform_data = { | |||
103 | 100 | ||
104 | static struct resource tmu1_resources[] = { | 101 | static struct resource tmu1_resources[] = { |
105 | [0] = { | 102 | [0] = { |
106 | .name = "TMU1", | ||
107 | .start = 0xfe430014, | 103 | .start = 0xfe430014, |
108 | .end = 0xfe43001f, | 104 | .end = 0xfe43001f, |
109 | .flags = IORESOURCE_MEM, | 105 | .flags = IORESOURCE_MEM, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c index 7f6b0a5f7f82..a91263e0358b 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c | |||
@@ -131,7 +131,6 @@ static struct platform_device usbf_device = { | |||
131 | }; | 131 | }; |
132 | 132 | ||
133 | static struct sh_timer_config tmu0_platform_data = { | 133 | static struct sh_timer_config tmu0_platform_data = { |
134 | .name = "TMU0", | ||
135 | .channel_offset = 0x04, | 134 | .channel_offset = 0x04, |
136 | .timer_bit = 0, | 135 | .timer_bit = 0, |
137 | .clk = "peripheral_clk", | 136 | .clk = "peripheral_clk", |
@@ -140,7 +139,6 @@ static struct sh_timer_config tmu0_platform_data = { | |||
140 | 139 | ||
141 | static struct resource tmu0_resources[] = { | 140 | static struct resource tmu0_resources[] = { |
142 | [0] = { | 141 | [0] = { |
143 | .name = "TMU0", | ||
144 | .start = 0xffd80008, | 142 | .start = 0xffd80008, |
145 | .end = 0xffd80013, | 143 | .end = 0xffd80013, |
146 | .flags = IORESOURCE_MEM, | 144 | .flags = IORESOURCE_MEM, |
@@ -162,7 +160,6 @@ static struct platform_device tmu0_device = { | |||
162 | }; | 160 | }; |
163 | 161 | ||
164 | static struct sh_timer_config tmu1_platform_data = { | 162 | static struct sh_timer_config tmu1_platform_data = { |
165 | .name = "TMU1", | ||
166 | .channel_offset = 0x10, | 163 | .channel_offset = 0x10, |
167 | .timer_bit = 1, | 164 | .timer_bit = 1, |
168 | .clk = "peripheral_clk", | 165 | .clk = "peripheral_clk", |
@@ -171,7 +168,6 @@ static struct sh_timer_config tmu1_platform_data = { | |||
171 | 168 | ||
172 | static struct resource tmu1_resources[] = { | 169 | static struct resource tmu1_resources[] = { |
173 | [0] = { | 170 | [0] = { |
174 | .name = "TMU1", | ||
175 | .start = 0xffd80014, | 171 | .start = 0xffd80014, |
176 | .end = 0xffd8001f, | 172 | .end = 0xffd8001f, |
177 | .flags = IORESOURCE_MEM, | 173 | .flags = IORESOURCE_MEM, |
@@ -193,7 +189,6 @@ static struct platform_device tmu1_device = { | |||
193 | }; | 189 | }; |
194 | 190 | ||
195 | static struct sh_timer_config tmu2_platform_data = { | 191 | static struct sh_timer_config tmu2_platform_data = { |
196 | .name = "TMU2", | ||
197 | .channel_offset = 0x1c, | 192 | .channel_offset = 0x1c, |
198 | .timer_bit = 2, | 193 | .timer_bit = 2, |
199 | .clk = "peripheral_clk", | 194 | .clk = "peripheral_clk", |
@@ -201,7 +196,6 @@ static struct sh_timer_config tmu2_platform_data = { | |||
201 | 196 | ||
202 | static struct resource tmu2_resources[] = { | 197 | static struct resource tmu2_resources[] = { |
203 | [0] = { | 198 | [0] = { |
204 | .name = "TMU2", | ||
205 | .start = 0xffd80020, | 199 | .start = 0xffd80020, |
206 | .end = 0xffd8002f, | 200 | .end = 0xffd8002f, |
207 | .flags = IORESOURCE_MEM, | 201 | .flags = IORESOURCE_MEM, |
@@ -223,7 +217,6 @@ static struct platform_device tmu2_device = { | |||
223 | }; | 217 | }; |
224 | 218 | ||
225 | static struct sh_timer_config tmu3_platform_data = { | 219 | static struct sh_timer_config tmu3_platform_data = { |
226 | .name = "TMU3", | ||
227 | .channel_offset = 0x04, | 220 | .channel_offset = 0x04, |
228 | .timer_bit = 0, | 221 | .timer_bit = 0, |
229 | .clk = "peripheral_clk", | 222 | .clk = "peripheral_clk", |
@@ -231,7 +224,6 @@ static struct sh_timer_config tmu3_platform_data = { | |||
231 | 224 | ||
232 | static struct resource tmu3_resources[] = { | 225 | static struct resource tmu3_resources[] = { |
233 | [0] = { | 226 | [0] = { |
234 | .name = "TMU3", | ||
235 | .start = 0xffd88008, | 227 | .start = 0xffd88008, |
236 | .end = 0xffd88013, | 228 | .end = 0xffd88013, |
237 | .flags = IORESOURCE_MEM, | 229 | .flags = IORESOURCE_MEM, |
@@ -253,7 +245,6 @@ static struct platform_device tmu3_device = { | |||
253 | }; | 245 | }; |
254 | 246 | ||
255 | static struct sh_timer_config tmu4_platform_data = { | 247 | static struct sh_timer_config tmu4_platform_data = { |
256 | .name = "TMU4", | ||
257 | .channel_offset = 0x10, | 248 | .channel_offset = 0x10, |
258 | .timer_bit = 1, | 249 | .timer_bit = 1, |
259 | .clk = "peripheral_clk", | 250 | .clk = "peripheral_clk", |
@@ -261,7 +252,6 @@ static struct sh_timer_config tmu4_platform_data = { | |||
261 | 252 | ||
262 | static struct resource tmu4_resources[] = { | 253 | static struct resource tmu4_resources[] = { |
263 | [0] = { | 254 | [0] = { |
264 | .name = "TMU4", | ||
265 | .start = 0xffd88014, | 255 | .start = 0xffd88014, |
266 | .end = 0xffd8801f, | 256 | .end = 0xffd8801f, |
267 | .flags = IORESOURCE_MEM, | 257 | .flags = IORESOURCE_MEM, |
@@ -283,7 +273,6 @@ static struct platform_device tmu4_device = { | |||
283 | }; | 273 | }; |
284 | 274 | ||
285 | static struct sh_timer_config tmu5_platform_data = { | 275 | static struct sh_timer_config tmu5_platform_data = { |
286 | .name = "TMU5", | ||
287 | .channel_offset = 0x1c, | 276 | .channel_offset = 0x1c, |
288 | .timer_bit = 2, | 277 | .timer_bit = 2, |
289 | .clk = "peripheral_clk", | 278 | .clk = "peripheral_clk", |
@@ -291,7 +280,6 @@ static struct sh_timer_config tmu5_platform_data = { | |||
291 | 280 | ||
292 | static struct resource tmu5_resources[] = { | 281 | static struct resource tmu5_resources[] = { |
293 | [0] = { | 282 | [0] = { |
294 | .name = "TMU5", | ||
295 | .start = 0xffd88020, | 283 | .start = 0xffd88020, |
296 | .end = 0xffd8802b, | 284 | .end = 0xffd8802b, |
297 | .flags = IORESOURCE_MEM, | 285 | .flags = IORESOURCE_MEM, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7770.c b/arch/sh/kernel/cpu/sh4a/setup-sh7770.c index 86d681ecf90e..83a27b0e4ed2 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7770.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7770.c | |||
@@ -165,7 +165,6 @@ static struct platform_device scif9_device = { | |||
165 | }; | 165 | }; |
166 | 166 | ||
167 | static struct sh_timer_config tmu0_platform_data = { | 167 | static struct sh_timer_config tmu0_platform_data = { |
168 | .name = "TMU0", | ||
169 | .channel_offset = 0x04, | 168 | .channel_offset = 0x04, |
170 | .timer_bit = 0, | 169 | .timer_bit = 0, |
171 | .clk = "peripheral_clk", | 170 | .clk = "peripheral_clk", |
@@ -174,7 +173,6 @@ static struct sh_timer_config tmu0_platform_data = { | |||
174 | 173 | ||
175 | static struct resource tmu0_resources[] = { | 174 | static struct resource tmu0_resources[] = { |
176 | [0] = { | 175 | [0] = { |
177 | .name = "TMU0", | ||
178 | .start = 0xffd80008, | 176 | .start = 0xffd80008, |
179 | .end = 0xffd80013, | 177 | .end = 0xffd80013, |
180 | .flags = IORESOURCE_MEM, | 178 | .flags = IORESOURCE_MEM, |
@@ -196,7 +194,6 @@ static struct platform_device tmu0_device = { | |||
196 | }; | 194 | }; |
197 | 195 | ||
198 | static struct sh_timer_config tmu1_platform_data = { | 196 | static struct sh_timer_config tmu1_platform_data = { |
199 | .name = "TMU1", | ||
200 | .channel_offset = 0x10, | 197 | .channel_offset = 0x10, |
201 | .timer_bit = 1, | 198 | .timer_bit = 1, |
202 | .clk = "peripheral_clk", | 199 | .clk = "peripheral_clk", |
@@ -205,7 +202,6 @@ static struct sh_timer_config tmu1_platform_data = { | |||
205 | 202 | ||
206 | static struct resource tmu1_resources[] = { | 203 | static struct resource tmu1_resources[] = { |
207 | [0] = { | 204 | [0] = { |
208 | .name = "TMU1", | ||
209 | .start = 0xffd80014, | 205 | .start = 0xffd80014, |
210 | .end = 0xffd8001f, | 206 | .end = 0xffd8001f, |
211 | .flags = IORESOURCE_MEM, | 207 | .flags = IORESOURCE_MEM, |
@@ -227,7 +223,6 @@ static struct platform_device tmu1_device = { | |||
227 | }; | 223 | }; |
228 | 224 | ||
229 | static struct sh_timer_config tmu2_platform_data = { | 225 | static struct sh_timer_config tmu2_platform_data = { |
230 | .name = "TMU2", | ||
231 | .channel_offset = 0x1c, | 226 | .channel_offset = 0x1c, |
232 | .timer_bit = 2, | 227 | .timer_bit = 2, |
233 | .clk = "peripheral_clk", | 228 | .clk = "peripheral_clk", |
@@ -235,7 +230,6 @@ static struct sh_timer_config tmu2_platform_data = { | |||
235 | 230 | ||
236 | static struct resource tmu2_resources[] = { | 231 | static struct resource tmu2_resources[] = { |
237 | [0] = { | 232 | [0] = { |
238 | .name = "TMU2", | ||
239 | .start = 0xffd80020, | 233 | .start = 0xffd80020, |
240 | .end = 0xffd8002f, | 234 | .end = 0xffd8002f, |
241 | .flags = IORESOURCE_MEM, | 235 | .flags = IORESOURCE_MEM, |
@@ -257,7 +251,6 @@ static struct platform_device tmu2_device = { | |||
257 | }; | 251 | }; |
258 | 252 | ||
259 | static struct sh_timer_config tmu3_platform_data = { | 253 | static struct sh_timer_config tmu3_platform_data = { |
260 | .name = "TMU3", | ||
261 | .channel_offset = 0x04, | 254 | .channel_offset = 0x04, |
262 | .timer_bit = 0, | 255 | .timer_bit = 0, |
263 | .clk = "peripheral_clk", | 256 | .clk = "peripheral_clk", |
@@ -265,7 +258,6 @@ static struct sh_timer_config tmu3_platform_data = { | |||
265 | 258 | ||
266 | static struct resource tmu3_resources[] = { | 259 | static struct resource tmu3_resources[] = { |
267 | [0] = { | 260 | [0] = { |
268 | .name = "TMU3", | ||
269 | .start = 0xffd81008, | 261 | .start = 0xffd81008, |
270 | .end = 0xffd81013, | 262 | .end = 0xffd81013, |
271 | .flags = IORESOURCE_MEM, | 263 | .flags = IORESOURCE_MEM, |
@@ -287,7 +279,6 @@ static struct platform_device tmu3_device = { | |||
287 | }; | 279 | }; |
288 | 280 | ||
289 | static struct sh_timer_config tmu4_platform_data = { | 281 | static struct sh_timer_config tmu4_platform_data = { |
290 | .name = "TMU4", | ||
291 | .channel_offset = 0x10, | 282 | .channel_offset = 0x10, |
292 | .timer_bit = 1, | 283 | .timer_bit = 1, |
293 | .clk = "peripheral_clk", | 284 | .clk = "peripheral_clk", |
@@ -295,7 +286,6 @@ static struct sh_timer_config tmu4_platform_data = { | |||
295 | 286 | ||
296 | static struct resource tmu4_resources[] = { | 287 | static struct resource tmu4_resources[] = { |
297 | [0] = { | 288 | [0] = { |
298 | .name = "TMU4", | ||
299 | .start = 0xffd81014, | 289 | .start = 0xffd81014, |
300 | .end = 0xffd8101f, | 290 | .end = 0xffd8101f, |
301 | .flags = IORESOURCE_MEM, | 291 | .flags = IORESOURCE_MEM, |
@@ -317,7 +307,6 @@ static struct platform_device tmu4_device = { | |||
317 | }; | 307 | }; |
318 | 308 | ||
319 | static struct sh_timer_config tmu5_platform_data = { | 309 | static struct sh_timer_config tmu5_platform_data = { |
320 | .name = "TMU5", | ||
321 | .channel_offset = 0x1c, | 310 | .channel_offset = 0x1c, |
322 | .timer_bit = 2, | 311 | .timer_bit = 2, |
323 | .clk = "peripheral_clk", | 312 | .clk = "peripheral_clk", |
@@ -325,7 +314,6 @@ static struct sh_timer_config tmu5_platform_data = { | |||
325 | 314 | ||
326 | static struct resource tmu5_resources[] = { | 315 | static struct resource tmu5_resources[] = { |
327 | [0] = { | 316 | [0] = { |
328 | .name = "TMU5", | ||
329 | .start = 0xffd81020, | 317 | .start = 0xffd81020, |
330 | .end = 0xffd8102f, | 318 | .end = 0xffd8102f, |
331 | .flags = IORESOURCE_MEM, | 319 | .flags = IORESOURCE_MEM, |
@@ -347,7 +335,6 @@ static struct platform_device tmu5_device = { | |||
347 | }; | 335 | }; |
348 | 336 | ||
349 | static struct sh_timer_config tmu6_platform_data = { | 337 | static struct sh_timer_config tmu6_platform_data = { |
350 | .name = "TMU6", | ||
351 | .channel_offset = 0x04, | 338 | .channel_offset = 0x04, |
352 | .timer_bit = 0, | 339 | .timer_bit = 0, |
353 | .clk = "peripheral_clk", | 340 | .clk = "peripheral_clk", |
@@ -355,7 +342,6 @@ static struct sh_timer_config tmu6_platform_data = { | |||
355 | 342 | ||
356 | static struct resource tmu6_resources[] = { | 343 | static struct resource tmu6_resources[] = { |
357 | [0] = { | 344 | [0] = { |
358 | .name = "TMU6", | ||
359 | .start = 0xffd82008, | 345 | .start = 0xffd82008, |
360 | .end = 0xffd82013, | 346 | .end = 0xffd82013, |
361 | .flags = IORESOURCE_MEM, | 347 | .flags = IORESOURCE_MEM, |
@@ -377,7 +363,6 @@ static struct platform_device tmu6_device = { | |||
377 | }; | 363 | }; |
378 | 364 | ||
379 | static struct sh_timer_config tmu7_platform_data = { | 365 | static struct sh_timer_config tmu7_platform_data = { |
380 | .name = "TMU7", | ||
381 | .channel_offset = 0x10, | 366 | .channel_offset = 0x10, |
382 | .timer_bit = 1, | 367 | .timer_bit = 1, |
383 | .clk = "peripheral_clk", | 368 | .clk = "peripheral_clk", |
@@ -385,7 +370,6 @@ static struct sh_timer_config tmu7_platform_data = { | |||
385 | 370 | ||
386 | static struct resource tmu7_resources[] = { | 371 | static struct resource tmu7_resources[] = { |
387 | [0] = { | 372 | [0] = { |
388 | .name = "TMU7", | ||
389 | .start = 0xffd82014, | 373 | .start = 0xffd82014, |
390 | .end = 0xffd8201f, | 374 | .end = 0xffd8201f, |
391 | .flags = IORESOURCE_MEM, | 375 | .flags = IORESOURCE_MEM, |
@@ -407,7 +391,6 @@ static struct platform_device tmu7_device = { | |||
407 | }; | 391 | }; |
408 | 392 | ||
409 | static struct sh_timer_config tmu8_platform_data = { | 393 | static struct sh_timer_config tmu8_platform_data = { |
410 | .name = "TMU8", | ||
411 | .channel_offset = 0x1c, | 394 | .channel_offset = 0x1c, |
412 | .timer_bit = 2, | 395 | .timer_bit = 2, |
413 | .clk = "peripheral_clk", | 396 | .clk = "peripheral_clk", |
@@ -415,7 +398,6 @@ static struct sh_timer_config tmu8_platform_data = { | |||
415 | 398 | ||
416 | static struct resource tmu8_resources[] = { | 399 | static struct resource tmu8_resources[] = { |
417 | [0] = { | 400 | [0] = { |
418 | .name = "TMU8", | ||
419 | .start = 0xffd82020, | 401 | .start = 0xffd82020, |
420 | .end = 0xffd8202b, | 402 | .end = 0xffd8202b, |
421 | .flags = IORESOURCE_MEM, | 403 | .flags = IORESOURCE_MEM, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c index 02e792c90de6..f7c48e92b95b 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c | |||
@@ -49,7 +49,6 @@ static struct platform_device scif1_device = { | |||
49 | }; | 49 | }; |
50 | 50 | ||
51 | static struct sh_timer_config tmu0_platform_data = { | 51 | static struct sh_timer_config tmu0_platform_data = { |
52 | .name = "TMU0", | ||
53 | .channel_offset = 0x04, | 52 | .channel_offset = 0x04, |
54 | .timer_bit = 0, | 53 | .timer_bit = 0, |
55 | .clk = "peripheral_clk", | 54 | .clk = "peripheral_clk", |
@@ -58,7 +57,6 @@ static struct sh_timer_config tmu0_platform_data = { | |||
58 | 57 | ||
59 | static struct resource tmu0_resources[] = { | 58 | static struct resource tmu0_resources[] = { |
60 | [0] = { | 59 | [0] = { |
61 | .name = "TMU0", | ||
62 | .start = 0xffd80008, | 60 | .start = 0xffd80008, |
63 | .end = 0xffd80013, | 61 | .end = 0xffd80013, |
64 | .flags = IORESOURCE_MEM, | 62 | .flags = IORESOURCE_MEM, |
@@ -80,7 +78,6 @@ static struct platform_device tmu0_device = { | |||
80 | }; | 78 | }; |
81 | 79 | ||
82 | static struct sh_timer_config tmu1_platform_data = { | 80 | static struct sh_timer_config tmu1_platform_data = { |
83 | .name = "TMU1", | ||
84 | .channel_offset = 0x10, | 81 | .channel_offset = 0x10, |
85 | .timer_bit = 1, | 82 | .timer_bit = 1, |
86 | .clk = "peripheral_clk", | 83 | .clk = "peripheral_clk", |
@@ -89,7 +86,6 @@ static struct sh_timer_config tmu1_platform_data = { | |||
89 | 86 | ||
90 | static struct resource tmu1_resources[] = { | 87 | static struct resource tmu1_resources[] = { |
91 | [0] = { | 88 | [0] = { |
92 | .name = "TMU1", | ||
93 | .start = 0xffd80014, | 89 | .start = 0xffd80014, |
94 | .end = 0xffd8001f, | 90 | .end = 0xffd8001f, |
95 | .flags = IORESOURCE_MEM, | 91 | .flags = IORESOURCE_MEM, |
@@ -111,7 +107,6 @@ static struct platform_device tmu1_device = { | |||
111 | }; | 107 | }; |
112 | 108 | ||
113 | static struct sh_timer_config tmu2_platform_data = { | 109 | static struct sh_timer_config tmu2_platform_data = { |
114 | .name = "TMU2", | ||
115 | .channel_offset = 0x1c, | 110 | .channel_offset = 0x1c, |
116 | .timer_bit = 2, | 111 | .timer_bit = 2, |
117 | .clk = "peripheral_clk", | 112 | .clk = "peripheral_clk", |
@@ -119,7 +114,6 @@ static struct sh_timer_config tmu2_platform_data = { | |||
119 | 114 | ||
120 | static struct resource tmu2_resources[] = { | 115 | static struct resource tmu2_resources[] = { |
121 | [0] = { | 116 | [0] = { |
122 | .name = "TMU2", | ||
123 | .start = 0xffd80020, | 117 | .start = 0xffd80020, |
124 | .end = 0xffd8002f, | 118 | .end = 0xffd8002f, |
125 | .flags = IORESOURCE_MEM, | 119 | .flags = IORESOURCE_MEM, |
@@ -141,7 +135,6 @@ static struct platform_device tmu2_device = { | |||
141 | }; | 135 | }; |
142 | 136 | ||
143 | static struct sh_timer_config tmu3_platform_data = { | 137 | static struct sh_timer_config tmu3_platform_data = { |
144 | .name = "TMU3", | ||
145 | .channel_offset = 0x04, | 138 | .channel_offset = 0x04, |
146 | .timer_bit = 0, | 139 | .timer_bit = 0, |
147 | .clk = "peripheral_clk", | 140 | .clk = "peripheral_clk", |
@@ -149,7 +142,6 @@ static struct sh_timer_config tmu3_platform_data = { | |||
149 | 142 | ||
150 | static struct resource tmu3_resources[] = { | 143 | static struct resource tmu3_resources[] = { |
151 | [0] = { | 144 | [0] = { |
152 | .name = "TMU3", | ||
153 | .start = 0xffdc0008, | 145 | .start = 0xffdc0008, |
154 | .end = 0xffdc0013, | 146 | .end = 0xffdc0013, |
155 | .flags = IORESOURCE_MEM, | 147 | .flags = IORESOURCE_MEM, |
@@ -171,7 +163,6 @@ static struct platform_device tmu3_device = { | |||
171 | }; | 163 | }; |
172 | 164 | ||
173 | static struct sh_timer_config tmu4_platform_data = { | 165 | static struct sh_timer_config tmu4_platform_data = { |
174 | .name = "TMU4", | ||
175 | .channel_offset = 0x10, | 166 | .channel_offset = 0x10, |
176 | .timer_bit = 1, | 167 | .timer_bit = 1, |
177 | .clk = "peripheral_clk", | 168 | .clk = "peripheral_clk", |
@@ -179,7 +170,6 @@ static struct sh_timer_config tmu4_platform_data = { | |||
179 | 170 | ||
180 | static struct resource tmu4_resources[] = { | 171 | static struct resource tmu4_resources[] = { |
181 | [0] = { | 172 | [0] = { |
182 | .name = "TMU4", | ||
183 | .start = 0xffdc0014, | 173 | .start = 0xffdc0014, |
184 | .end = 0xffdc001f, | 174 | .end = 0xffdc001f, |
185 | .flags = IORESOURCE_MEM, | 175 | .flags = IORESOURCE_MEM, |
@@ -201,7 +191,6 @@ static struct platform_device tmu4_device = { | |||
201 | }; | 191 | }; |
202 | 192 | ||
203 | static struct sh_timer_config tmu5_platform_data = { | 193 | static struct sh_timer_config tmu5_platform_data = { |
204 | .name = "TMU5", | ||
205 | .channel_offset = 0x1c, | 194 | .channel_offset = 0x1c, |
206 | .timer_bit = 2, | 195 | .timer_bit = 2, |
207 | .clk = "peripheral_clk", | 196 | .clk = "peripheral_clk", |
@@ -209,7 +198,6 @@ static struct sh_timer_config tmu5_platform_data = { | |||
209 | 198 | ||
210 | static struct resource tmu5_resources[] = { | 199 | static struct resource tmu5_resources[] = { |
211 | [0] = { | 200 | [0] = { |
212 | .name = "TMU5", | ||
213 | .start = 0xffdc0020, | 201 | .start = 0xffdc0020, |
214 | .end = 0xffdc002b, | 202 | .end = 0xffdc002b, |
215 | .flags = IORESOURCE_MEM, | 203 | .flags = IORESOURCE_MEM, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c index 1fcd88b1671e..05e9308505cf 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c | |||
@@ -117,7 +117,6 @@ static struct platform_device scif5_device = { | |||
117 | }; | 117 | }; |
118 | 118 | ||
119 | static struct sh_timer_config tmu0_platform_data = { | 119 | static struct sh_timer_config tmu0_platform_data = { |
120 | .name = "TMU0", | ||
121 | .channel_offset = 0x04, | 120 | .channel_offset = 0x04, |
122 | .timer_bit = 0, | 121 | .timer_bit = 0, |
123 | .clk = "tmu012_fck", | 122 | .clk = "tmu012_fck", |
@@ -126,7 +125,6 @@ static struct sh_timer_config tmu0_platform_data = { | |||
126 | 125 | ||
127 | static struct resource tmu0_resources[] = { | 126 | static struct resource tmu0_resources[] = { |
128 | [0] = { | 127 | [0] = { |
129 | .name = "TMU0", | ||
130 | .start = 0xffd80008, | 128 | .start = 0xffd80008, |
131 | .end = 0xffd80013, | 129 | .end = 0xffd80013, |
132 | .flags = IORESOURCE_MEM, | 130 | .flags = IORESOURCE_MEM, |
@@ -148,7 +146,6 @@ static struct platform_device tmu0_device = { | |||
148 | }; | 146 | }; |
149 | 147 | ||
150 | static struct sh_timer_config tmu1_platform_data = { | 148 | static struct sh_timer_config tmu1_platform_data = { |
151 | .name = "TMU1", | ||
152 | .channel_offset = 0x10, | 149 | .channel_offset = 0x10, |
153 | .timer_bit = 1, | 150 | .timer_bit = 1, |
154 | .clk = "tmu012_fck", | 151 | .clk = "tmu012_fck", |
@@ -157,7 +154,6 @@ static struct sh_timer_config tmu1_platform_data = { | |||
157 | 154 | ||
158 | static struct resource tmu1_resources[] = { | 155 | static struct resource tmu1_resources[] = { |
159 | [0] = { | 156 | [0] = { |
160 | .name = "TMU1", | ||
161 | .start = 0xffd80014, | 157 | .start = 0xffd80014, |
162 | .end = 0xffd8001f, | 158 | .end = 0xffd8001f, |
163 | .flags = IORESOURCE_MEM, | 159 | .flags = IORESOURCE_MEM, |
@@ -179,7 +175,6 @@ static struct platform_device tmu1_device = { | |||
179 | }; | 175 | }; |
180 | 176 | ||
181 | static struct sh_timer_config tmu2_platform_data = { | 177 | static struct sh_timer_config tmu2_platform_data = { |
182 | .name = "TMU2", | ||
183 | .channel_offset = 0x1c, | 178 | .channel_offset = 0x1c, |
184 | .timer_bit = 2, | 179 | .timer_bit = 2, |
185 | .clk = "tmu012_fck", | 180 | .clk = "tmu012_fck", |
@@ -187,7 +182,6 @@ static struct sh_timer_config tmu2_platform_data = { | |||
187 | 182 | ||
188 | static struct resource tmu2_resources[] = { | 183 | static struct resource tmu2_resources[] = { |
189 | [0] = { | 184 | [0] = { |
190 | .name = "TMU2", | ||
191 | .start = 0xffd80020, | 185 | .start = 0xffd80020, |
192 | .end = 0xffd8002f, | 186 | .end = 0xffd8002f, |
193 | .flags = IORESOURCE_MEM, | 187 | .flags = IORESOURCE_MEM, |
@@ -209,7 +203,6 @@ static struct platform_device tmu2_device = { | |||
209 | }; | 203 | }; |
210 | 204 | ||
211 | static struct sh_timer_config tmu3_platform_data = { | 205 | static struct sh_timer_config tmu3_platform_data = { |
212 | .name = "TMU3", | ||
213 | .channel_offset = 0x04, | 206 | .channel_offset = 0x04, |
214 | .timer_bit = 0, | 207 | .timer_bit = 0, |
215 | .clk = "tmu345_fck", | 208 | .clk = "tmu345_fck", |
@@ -217,7 +210,6 @@ static struct sh_timer_config tmu3_platform_data = { | |||
217 | 210 | ||
218 | static struct resource tmu3_resources[] = { | 211 | static struct resource tmu3_resources[] = { |
219 | [0] = { | 212 | [0] = { |
220 | .name = "TMU3", | ||
221 | .start = 0xffdc0008, | 213 | .start = 0xffdc0008, |
222 | .end = 0xffdc0013, | 214 | .end = 0xffdc0013, |
223 | .flags = IORESOURCE_MEM, | 215 | .flags = IORESOURCE_MEM, |
@@ -239,7 +231,6 @@ static struct platform_device tmu3_device = { | |||
239 | }; | 231 | }; |
240 | 232 | ||
241 | static struct sh_timer_config tmu4_platform_data = { | 233 | static struct sh_timer_config tmu4_platform_data = { |
242 | .name = "TMU4", | ||
243 | .channel_offset = 0x10, | 234 | .channel_offset = 0x10, |
244 | .timer_bit = 1, | 235 | .timer_bit = 1, |
245 | .clk = "tmu345_fck", | 236 | .clk = "tmu345_fck", |
@@ -247,7 +238,6 @@ static struct sh_timer_config tmu4_platform_data = { | |||
247 | 238 | ||
248 | static struct resource tmu4_resources[] = { | 239 | static struct resource tmu4_resources[] = { |
249 | [0] = { | 240 | [0] = { |
250 | .name = "TMU4", | ||
251 | .start = 0xffdc0014, | 241 | .start = 0xffdc0014, |
252 | .end = 0xffdc001f, | 242 | .end = 0xffdc001f, |
253 | .flags = IORESOURCE_MEM, | 243 | .flags = IORESOURCE_MEM, |
@@ -269,7 +259,6 @@ static struct platform_device tmu4_device = { | |||
269 | }; | 259 | }; |
270 | 260 | ||
271 | static struct sh_timer_config tmu5_platform_data = { | 261 | static struct sh_timer_config tmu5_platform_data = { |
272 | .name = "TMU5", | ||
273 | .channel_offset = 0x1c, | 262 | .channel_offset = 0x1c, |
274 | .timer_bit = 2, | 263 | .timer_bit = 2, |
275 | .clk = "tmu345_fck", | 264 | .clk = "tmu345_fck", |
@@ -277,7 +266,6 @@ static struct sh_timer_config tmu5_platform_data = { | |||
277 | 266 | ||
278 | static struct resource tmu5_resources[] = { | 267 | static struct resource tmu5_resources[] = { |
279 | [0] = { | 268 | [0] = { |
280 | .name = "TMU5", | ||
281 | .start = 0xffdc0020, | 269 | .start = 0xffdc0020, |
282 | .end = 0xffdc002b, | 270 | .end = 0xffdc002b, |
283 | .flags = IORESOURCE_MEM, | 271 | .flags = IORESOURCE_MEM, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c index 7e585320710a..542ced88e50f 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c | |||
@@ -117,7 +117,6 @@ static struct platform_device scif5_device = { | |||
117 | }; | 117 | }; |
118 | 118 | ||
119 | static struct sh_timer_config tmu0_platform_data = { | 119 | static struct sh_timer_config tmu0_platform_data = { |
120 | .name = "TMU0", | ||
121 | .channel_offset = 0x04, | 120 | .channel_offset = 0x04, |
122 | .timer_bit = 0, | 121 | .timer_bit = 0, |
123 | .clk = "peripheral_clk", | 122 | .clk = "peripheral_clk", |
@@ -126,7 +125,6 @@ static struct sh_timer_config tmu0_platform_data = { | |||
126 | 125 | ||
127 | static struct resource tmu0_resources[] = { | 126 | static struct resource tmu0_resources[] = { |
128 | [0] = { | 127 | [0] = { |
129 | .name = "TMU0", | ||
130 | .start = 0xffd80008, | 128 | .start = 0xffd80008, |
131 | .end = 0xffd80013, | 129 | .end = 0xffd80013, |
132 | .flags = IORESOURCE_MEM, | 130 | .flags = IORESOURCE_MEM, |
@@ -148,7 +146,6 @@ static struct platform_device tmu0_device = { | |||
148 | }; | 146 | }; |
149 | 147 | ||
150 | static struct sh_timer_config tmu1_platform_data = { | 148 | static struct sh_timer_config tmu1_platform_data = { |
151 | .name = "TMU1", | ||
152 | .channel_offset = 0x10, | 149 | .channel_offset = 0x10, |
153 | .timer_bit = 1, | 150 | .timer_bit = 1, |
154 | .clk = "peripheral_clk", | 151 | .clk = "peripheral_clk", |
@@ -157,7 +154,6 @@ static struct sh_timer_config tmu1_platform_data = { | |||
157 | 154 | ||
158 | static struct resource tmu1_resources[] = { | 155 | static struct resource tmu1_resources[] = { |
159 | [0] = { | 156 | [0] = { |
160 | .name = "TMU1", | ||
161 | .start = 0xffd80014, | 157 | .start = 0xffd80014, |
162 | .end = 0xffd8001f, | 158 | .end = 0xffd8001f, |
163 | .flags = IORESOURCE_MEM, | 159 | .flags = IORESOURCE_MEM, |
@@ -179,7 +175,6 @@ static struct platform_device tmu1_device = { | |||
179 | }; | 175 | }; |
180 | 176 | ||
181 | static struct sh_timer_config tmu2_platform_data = { | 177 | static struct sh_timer_config tmu2_platform_data = { |
182 | .name = "TMU2", | ||
183 | .channel_offset = 0x1c, | 178 | .channel_offset = 0x1c, |
184 | .timer_bit = 2, | 179 | .timer_bit = 2, |
185 | .clk = "peripheral_clk", | 180 | .clk = "peripheral_clk", |
@@ -187,7 +182,6 @@ static struct sh_timer_config tmu2_platform_data = { | |||
187 | 182 | ||
188 | static struct resource tmu2_resources[] = { | 183 | static struct resource tmu2_resources[] = { |
189 | [0] = { | 184 | [0] = { |
190 | .name = "TMU2", | ||
191 | .start = 0xffd80020, | 185 | .start = 0xffd80020, |
192 | .end = 0xffd8002f, | 186 | .end = 0xffd8002f, |
193 | .flags = IORESOURCE_MEM, | 187 | .flags = IORESOURCE_MEM, |
@@ -209,7 +203,6 @@ static struct platform_device tmu2_device = { | |||
209 | }; | 203 | }; |
210 | 204 | ||
211 | static struct sh_timer_config tmu3_platform_data = { | 205 | static struct sh_timer_config tmu3_platform_data = { |
212 | .name = "TMU3", | ||
213 | .channel_offset = 0x04, | 206 | .channel_offset = 0x04, |
214 | .timer_bit = 0, | 207 | .timer_bit = 0, |
215 | .clk = "peripheral_clk", | 208 | .clk = "peripheral_clk", |
@@ -217,7 +210,6 @@ static struct sh_timer_config tmu3_platform_data = { | |||
217 | 210 | ||
218 | static struct resource tmu3_resources[] = { | 211 | static struct resource tmu3_resources[] = { |
219 | [0] = { | 212 | [0] = { |
220 | .name = "TMU3", | ||
221 | .start = 0xffda0008, | 213 | .start = 0xffda0008, |
222 | .end = 0xffda0013, | 214 | .end = 0xffda0013, |
223 | .flags = IORESOURCE_MEM, | 215 | .flags = IORESOURCE_MEM, |
@@ -239,7 +231,6 @@ static struct platform_device tmu3_device = { | |||
239 | }; | 231 | }; |
240 | 232 | ||
241 | static struct sh_timer_config tmu4_platform_data = { | 233 | static struct sh_timer_config tmu4_platform_data = { |
242 | .name = "TMU4", | ||
243 | .channel_offset = 0x10, | 234 | .channel_offset = 0x10, |
244 | .timer_bit = 1, | 235 | .timer_bit = 1, |
245 | .clk = "peripheral_clk", | 236 | .clk = "peripheral_clk", |
@@ -247,7 +238,6 @@ static struct sh_timer_config tmu4_platform_data = { | |||
247 | 238 | ||
248 | static struct resource tmu4_resources[] = { | 239 | static struct resource tmu4_resources[] = { |
249 | [0] = { | 240 | [0] = { |
250 | .name = "TMU4", | ||
251 | .start = 0xffda0014, | 241 | .start = 0xffda0014, |
252 | .end = 0xffda001f, | 242 | .end = 0xffda001f, |
253 | .flags = IORESOURCE_MEM, | 243 | .flags = IORESOURCE_MEM, |
@@ -269,7 +259,6 @@ static struct platform_device tmu4_device = { | |||
269 | }; | 259 | }; |
270 | 260 | ||
271 | static struct sh_timer_config tmu5_platform_data = { | 261 | static struct sh_timer_config tmu5_platform_data = { |
272 | .name = "TMU5", | ||
273 | .channel_offset = 0x1c, | 262 | .channel_offset = 0x1c, |
274 | .timer_bit = 2, | 263 | .timer_bit = 2, |
275 | .clk = "peripheral_clk", | 264 | .clk = "peripheral_clk", |
@@ -277,7 +266,6 @@ static struct sh_timer_config tmu5_platform_data = { | |||
277 | 266 | ||
278 | static struct resource tmu5_resources[] = { | 267 | static struct resource tmu5_resources[] = { |
279 | [0] = { | 268 | [0] = { |
280 | .name = "TMU5", | ||
281 | .start = 0xffda0020, | 269 | .start = 0xffda0020, |
282 | .end = 0xffda002b, | 270 | .end = 0xffda002b, |
283 | .flags = IORESOURCE_MEM, | 271 | .flags = IORESOURCE_MEM, |
@@ -299,7 +287,6 @@ static struct platform_device tmu5_device = { | |||
299 | }; | 287 | }; |
300 | 288 | ||
301 | static struct sh_timer_config tmu6_platform_data = { | 289 | static struct sh_timer_config tmu6_platform_data = { |
302 | .name = "TMU6", | ||
303 | .channel_offset = 0x04, | 290 | .channel_offset = 0x04, |
304 | .timer_bit = 0, | 291 | .timer_bit = 0, |
305 | .clk = "peripheral_clk", | 292 | .clk = "peripheral_clk", |
@@ -307,7 +294,6 @@ static struct sh_timer_config tmu6_platform_data = { | |||
307 | 294 | ||
308 | static struct resource tmu6_resources[] = { | 295 | static struct resource tmu6_resources[] = { |
309 | [0] = { | 296 | [0] = { |
310 | .name = "TMU6", | ||
311 | .start = 0xffdc0008, | 297 | .start = 0xffdc0008, |
312 | .end = 0xffdc0013, | 298 | .end = 0xffdc0013, |
313 | .flags = IORESOURCE_MEM, | 299 | .flags = IORESOURCE_MEM, |
@@ -329,7 +315,6 @@ static struct platform_device tmu6_device = { | |||
329 | }; | 315 | }; |
330 | 316 | ||
331 | static struct sh_timer_config tmu7_platform_data = { | 317 | static struct sh_timer_config tmu7_platform_data = { |
332 | .name = "TMU7", | ||
333 | .channel_offset = 0x10, | 318 | .channel_offset = 0x10, |
334 | .timer_bit = 1, | 319 | .timer_bit = 1, |
335 | .clk = "peripheral_clk", | 320 | .clk = "peripheral_clk", |
@@ -337,7 +322,6 @@ static struct sh_timer_config tmu7_platform_data = { | |||
337 | 322 | ||
338 | static struct resource tmu7_resources[] = { | 323 | static struct resource tmu7_resources[] = { |
339 | [0] = { | 324 | [0] = { |
340 | .name = "TMU7", | ||
341 | .start = 0xffdc0014, | 325 | .start = 0xffdc0014, |
342 | .end = 0xffdc001f, | 326 | .end = 0xffdc001f, |
343 | .flags = IORESOURCE_MEM, | 327 | .flags = IORESOURCE_MEM, |
@@ -359,7 +343,6 @@ static struct platform_device tmu7_device = { | |||
359 | }; | 343 | }; |
360 | 344 | ||
361 | static struct sh_timer_config tmu8_platform_data = { | 345 | static struct sh_timer_config tmu8_platform_data = { |
362 | .name = "TMU8", | ||
363 | .channel_offset = 0x1c, | 346 | .channel_offset = 0x1c, |
364 | .timer_bit = 2, | 347 | .timer_bit = 2, |
365 | .clk = "peripheral_clk", | 348 | .clk = "peripheral_clk", |
@@ -367,7 +350,6 @@ static struct sh_timer_config tmu8_platform_data = { | |||
367 | 350 | ||
368 | static struct resource tmu8_resources[] = { | 351 | static struct resource tmu8_resources[] = { |
369 | [0] = { | 352 | [0] = { |
370 | .name = "TMU8", | ||
371 | .start = 0xffdc0020, | 353 | .start = 0xffdc0020, |
372 | .end = 0xffdc002b, | 354 | .end = 0xffdc002b, |
373 | .flags = IORESOURCE_MEM, | 355 | .flags = IORESOURCE_MEM, |
@@ -389,7 +371,6 @@ static struct platform_device tmu8_device = { | |||
389 | }; | 371 | }; |
390 | 372 | ||
391 | static struct sh_timer_config tmu9_platform_data = { | 373 | static struct sh_timer_config tmu9_platform_data = { |
392 | .name = "TMU9", | ||
393 | .channel_offset = 0x04, | 374 | .channel_offset = 0x04, |
394 | .timer_bit = 0, | 375 | .timer_bit = 0, |
395 | .clk = "peripheral_clk", | 376 | .clk = "peripheral_clk", |
@@ -397,7 +378,6 @@ static struct sh_timer_config tmu9_platform_data = { | |||
397 | 378 | ||
398 | static struct resource tmu9_resources[] = { | 379 | static struct resource tmu9_resources[] = { |
399 | [0] = { | 380 | [0] = { |
400 | .name = "TMU9", | ||
401 | .start = 0xffde0008, | 381 | .start = 0xffde0008, |
402 | .end = 0xffde0013, | 382 | .end = 0xffde0013, |
403 | .flags = IORESOURCE_MEM, | 383 | .flags = IORESOURCE_MEM, |
@@ -419,7 +399,6 @@ static struct platform_device tmu9_device = { | |||
419 | }; | 399 | }; |
420 | 400 | ||
421 | static struct sh_timer_config tmu10_platform_data = { | 401 | static struct sh_timer_config tmu10_platform_data = { |
422 | .name = "TMU10", | ||
423 | .channel_offset = 0x10, | 402 | .channel_offset = 0x10, |
424 | .timer_bit = 1, | 403 | .timer_bit = 1, |
425 | .clk = "peripheral_clk", | 404 | .clk = "peripheral_clk", |
@@ -427,7 +406,6 @@ static struct sh_timer_config tmu10_platform_data = { | |||
427 | 406 | ||
428 | static struct resource tmu10_resources[] = { | 407 | static struct resource tmu10_resources[] = { |
429 | [0] = { | 408 | [0] = { |
430 | .name = "TMU10", | ||
431 | .start = 0xffde0014, | 409 | .start = 0xffde0014, |
432 | .end = 0xffde001f, | 410 | .end = 0xffde001f, |
433 | .flags = IORESOURCE_MEM, | 411 | .flags = IORESOURCE_MEM, |
@@ -449,7 +427,6 @@ static struct platform_device tmu10_device = { | |||
449 | }; | 427 | }; |
450 | 428 | ||
451 | static struct sh_timer_config tmu11_platform_data = { | 429 | static struct sh_timer_config tmu11_platform_data = { |
452 | .name = "TMU11", | ||
453 | .channel_offset = 0x1c, | 430 | .channel_offset = 0x1c, |
454 | .timer_bit = 2, | 431 | .timer_bit = 2, |
455 | .clk = "peripheral_clk", | 432 | .clk = "peripheral_clk", |
@@ -457,7 +434,6 @@ static struct sh_timer_config tmu11_platform_data = { | |||
457 | 434 | ||
458 | static struct resource tmu11_resources[] = { | 435 | static struct resource tmu11_resources[] = { |
459 | [0] = { | 436 | [0] = { |
460 | .name = "TMU11", | ||
461 | .start = 0xffde0020, | 437 | .start = 0xffde0020, |
462 | .end = 0xffde002b, | 438 | .end = 0xffde002b, |
463 | .flags = IORESOURCE_MEM, | 439 | .flags = IORESOURCE_MEM, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-shx3.c b/arch/sh/kernel/cpu/sh4a/setup-shx3.c index 780ba17a5599..ba545b5ccc15 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-shx3.c +++ b/arch/sh/kernel/cpu/sh4a/setup-shx3.c | |||
@@ -70,7 +70,6 @@ static struct platform_device scif2_device = { | |||
70 | }; | 70 | }; |
71 | 71 | ||
72 | static struct sh_timer_config tmu0_platform_data = { | 72 | static struct sh_timer_config tmu0_platform_data = { |
73 | .name = "TMU0", | ||
74 | .channel_offset = 0x04, | 73 | .channel_offset = 0x04, |
75 | .timer_bit = 0, | 74 | .timer_bit = 0, |
76 | .clk = "peripheral_clk", | 75 | .clk = "peripheral_clk", |
@@ -79,7 +78,6 @@ static struct sh_timer_config tmu0_platform_data = { | |||
79 | 78 | ||
80 | static struct resource tmu0_resources[] = { | 79 | static struct resource tmu0_resources[] = { |
81 | [0] = { | 80 | [0] = { |
82 | .name = "TMU0", | ||
83 | .start = 0xffc10008, | 81 | .start = 0xffc10008, |
84 | .end = 0xffc10013, | 82 | .end = 0xffc10013, |
85 | .flags = IORESOURCE_MEM, | 83 | .flags = IORESOURCE_MEM, |
@@ -101,7 +99,6 @@ static struct platform_device tmu0_device = { | |||
101 | }; | 99 | }; |
102 | 100 | ||
103 | static struct sh_timer_config tmu1_platform_data = { | 101 | static struct sh_timer_config tmu1_platform_data = { |
104 | .name = "TMU1", | ||
105 | .channel_offset = 0x10, | 102 | .channel_offset = 0x10, |
106 | .timer_bit = 1, | 103 | .timer_bit = 1, |
107 | .clk = "peripheral_clk", | 104 | .clk = "peripheral_clk", |
@@ -110,7 +107,6 @@ static struct sh_timer_config tmu1_platform_data = { | |||
110 | 107 | ||
111 | static struct resource tmu1_resources[] = { | 108 | static struct resource tmu1_resources[] = { |
112 | [0] = { | 109 | [0] = { |
113 | .name = "TMU1", | ||
114 | .start = 0xffc10014, | 110 | .start = 0xffc10014, |
115 | .end = 0xffc1001f, | 111 | .end = 0xffc1001f, |
116 | .flags = IORESOURCE_MEM, | 112 | .flags = IORESOURCE_MEM, |
@@ -132,7 +128,6 @@ static struct platform_device tmu1_device = { | |||
132 | }; | 128 | }; |
133 | 129 | ||
134 | static struct sh_timer_config tmu2_platform_data = { | 130 | static struct sh_timer_config tmu2_platform_data = { |
135 | .name = "TMU2", | ||
136 | .channel_offset = 0x1c, | 131 | .channel_offset = 0x1c, |
137 | .timer_bit = 2, | 132 | .timer_bit = 2, |
138 | .clk = "peripheral_clk", | 133 | .clk = "peripheral_clk", |
@@ -140,7 +135,6 @@ static struct sh_timer_config tmu2_platform_data = { | |||
140 | 135 | ||
141 | static struct resource tmu2_resources[] = { | 136 | static struct resource tmu2_resources[] = { |
142 | [0] = { | 137 | [0] = { |
143 | .name = "TMU2", | ||
144 | .start = 0xffc10020, | 138 | .start = 0xffc10020, |
145 | .end = 0xffc1002f, | 139 | .end = 0xffc1002f, |
146 | .flags = IORESOURCE_MEM, | 140 | .flags = IORESOURCE_MEM, |
@@ -162,7 +156,6 @@ static struct platform_device tmu2_device = { | |||
162 | }; | 156 | }; |
163 | 157 | ||
164 | static struct sh_timer_config tmu3_platform_data = { | 158 | static struct sh_timer_config tmu3_platform_data = { |
165 | .name = "TMU3", | ||
166 | .channel_offset = 0x04, | 159 | .channel_offset = 0x04, |
167 | .timer_bit = 0, | 160 | .timer_bit = 0, |
168 | .clk = "peripheral_clk", | 161 | .clk = "peripheral_clk", |
@@ -170,7 +163,6 @@ static struct sh_timer_config tmu3_platform_data = { | |||
170 | 163 | ||
171 | static struct resource tmu3_resources[] = { | 164 | static struct resource tmu3_resources[] = { |
172 | [0] = { | 165 | [0] = { |
173 | .name = "TMU3", | ||
174 | .start = 0xffc20008, | 166 | .start = 0xffc20008, |
175 | .end = 0xffc20013, | 167 | .end = 0xffc20013, |
176 | .flags = IORESOURCE_MEM, | 168 | .flags = IORESOURCE_MEM, |
@@ -192,7 +184,6 @@ static struct platform_device tmu3_device = { | |||
192 | }; | 184 | }; |
193 | 185 | ||
194 | static struct sh_timer_config tmu4_platform_data = { | 186 | static struct sh_timer_config tmu4_platform_data = { |
195 | .name = "TMU4", | ||
196 | .channel_offset = 0x10, | 187 | .channel_offset = 0x10, |
197 | .timer_bit = 1, | 188 | .timer_bit = 1, |
198 | .clk = "peripheral_clk", | 189 | .clk = "peripheral_clk", |
@@ -200,7 +191,6 @@ static struct sh_timer_config tmu4_platform_data = { | |||
200 | 191 | ||
201 | static struct resource tmu4_resources[] = { | 192 | static struct resource tmu4_resources[] = { |
202 | [0] = { | 193 | [0] = { |
203 | .name = "TMU4", | ||
204 | .start = 0xffc20014, | 194 | .start = 0xffc20014, |
205 | .end = 0xffc2001f, | 195 | .end = 0xffc2001f, |
206 | .flags = IORESOURCE_MEM, | 196 | .flags = IORESOURCE_MEM, |
@@ -222,7 +212,6 @@ static struct platform_device tmu4_device = { | |||
222 | }; | 212 | }; |
223 | 213 | ||
224 | static struct sh_timer_config tmu5_platform_data = { | 214 | static struct sh_timer_config tmu5_platform_data = { |
225 | .name = "TMU5", | ||
226 | .channel_offset = 0x1c, | 215 | .channel_offset = 0x1c, |
227 | .timer_bit = 2, | 216 | .timer_bit = 2, |
228 | .clk = "peripheral_clk", | 217 | .clk = "peripheral_clk", |
@@ -230,7 +219,6 @@ static struct sh_timer_config tmu5_platform_data = { | |||
230 | 219 | ||
231 | static struct resource tmu5_resources[] = { | 220 | static struct resource tmu5_resources[] = { |
232 | [0] = { | 221 | [0] = { |
233 | .name = "TMU5", | ||
234 | .start = 0xffc20020, | 222 | .start = 0xffc20020, |
235 | .end = 0xffc2002b, | 223 | .end = 0xffc2002b, |
236 | .flags = IORESOURCE_MEM, | 224 | .flags = IORESOURCE_MEM, |
diff --git a/arch/sh/kernel/cpu/sh5/setup-sh5.c b/arch/sh/kernel/cpu/sh5/setup-sh5.c index e7a3c1e4b604..c84ca204240b 100644 --- a/arch/sh/kernel/cpu/sh5/setup-sh5.c +++ b/arch/sh/kernel/cpu/sh5/setup-sh5.c | |||
@@ -68,7 +68,6 @@ static struct platform_device rtc_device = { | |||
68 | #define TMU2_BASE (TMU_BASE + 0x8 + (0xc * 0x2)) | 68 | #define TMU2_BASE (TMU_BASE + 0x8 + (0xc * 0x2)) |
69 | 69 | ||
70 | static struct sh_timer_config tmu0_platform_data = { | 70 | static struct sh_timer_config tmu0_platform_data = { |
71 | .name = "TMU0", | ||
72 | .channel_offset = 0x04, | 71 | .channel_offset = 0x04, |
73 | .timer_bit = 0, | 72 | .timer_bit = 0, |
74 | .clk = "peripheral_clk", | 73 | .clk = "peripheral_clk", |
@@ -77,7 +76,6 @@ static struct sh_timer_config tmu0_platform_data = { | |||
77 | 76 | ||
78 | static struct resource tmu0_resources[] = { | 77 | static struct resource tmu0_resources[] = { |
79 | [0] = { | 78 | [0] = { |
80 | .name = "TMU0", | ||
81 | .start = TMU0_BASE, | 79 | .start = TMU0_BASE, |
82 | .end = TMU0_BASE + 0xc - 1, | 80 | .end = TMU0_BASE + 0xc - 1, |
83 | .flags = IORESOURCE_MEM, | 81 | .flags = IORESOURCE_MEM, |
@@ -99,7 +97,6 @@ static struct platform_device tmu0_device = { | |||
99 | }; | 97 | }; |
100 | 98 | ||
101 | static struct sh_timer_config tmu1_platform_data = { | 99 | static struct sh_timer_config tmu1_platform_data = { |
102 | .name = "TMU1", | ||
103 | .channel_offset = 0x10, | 100 | .channel_offset = 0x10, |
104 | .timer_bit = 1, | 101 | .timer_bit = 1, |
105 | .clk = "peripheral_clk", | 102 | .clk = "peripheral_clk", |
@@ -108,7 +105,6 @@ static struct sh_timer_config tmu1_platform_data = { | |||
108 | 105 | ||
109 | static struct resource tmu1_resources[] = { | 106 | static struct resource tmu1_resources[] = { |
110 | [0] = { | 107 | [0] = { |
111 | .name = "TMU1", | ||
112 | .start = TMU1_BASE, | 108 | .start = TMU1_BASE, |
113 | .end = TMU1_BASE + 0xc - 1, | 109 | .end = TMU1_BASE + 0xc - 1, |
114 | .flags = IORESOURCE_MEM, | 110 | .flags = IORESOURCE_MEM, |
@@ -130,7 +126,6 @@ static struct platform_device tmu1_device = { | |||
130 | }; | 126 | }; |
131 | 127 | ||
132 | static struct sh_timer_config tmu2_platform_data = { | 128 | static struct sh_timer_config tmu2_platform_data = { |
133 | .name = "TMU2", | ||
134 | .channel_offset = 0x1c, | 129 | .channel_offset = 0x1c, |
135 | .timer_bit = 2, | 130 | .timer_bit = 2, |
136 | .clk = "peripheral_clk", | 131 | .clk = "peripheral_clk", |
@@ -138,7 +133,6 @@ static struct sh_timer_config tmu2_platform_data = { | |||
138 | 133 | ||
139 | static struct resource tmu2_resources[] = { | 134 | static struct resource tmu2_resources[] = { |
140 | [0] = { | 135 | [0] = { |
141 | .name = "TMU2", | ||
142 | .start = TMU2_BASE, | 136 | .start = TMU2_BASE, |
143 | .end = TMU2_BASE + 0xc - 1, | 137 | .end = TMU2_BASE + 0xc - 1, |
144 | .flags = IORESOURCE_MEM, | 138 | .flags = IORESOURCE_MEM, |
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..d2d4926c5c4c 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]) { |
@@ -1181,6 +1239,25 @@ static int __init early_platform_driver_probe_id(char *class_str, | |||
1181 | } | 1239 | } |
1182 | 1240 | ||
1183 | if (match) { | 1241 | if (match) { |
1242 | /* | ||
1243 | * Set up a sensible init_name to enable | ||
1244 | * dev_name() and others to be used before the | ||
1245 | * rest of the driver core is initialized. | ||
1246 | */ | ||
1247 | if (!match->dev.init_name) { | ||
1248 | char buf[32]; | ||
1249 | |||
1250 | if (match->id != -1) | ||
1251 | snprintf(buf, sizeof(buf), "%s.%d", | ||
1252 | match->name, match->id); | ||
1253 | else | ||
1254 | snprintf(buf, sizeof(buf), "%s", | ||
1255 | match->name); | ||
1256 | |||
1257 | match->dev.init_name = kstrdup(buf, GFP_KERNEL); | ||
1258 | if (!match->dev.init_name) | ||
1259 | return -ENOMEM; | ||
1260 | } | ||
1184 | if (epdrv->pdrv->probe(match)) | 1261 | if (epdrv->pdrv->probe(match)) |
1185 | pr_warning("%s: unable to probe %s early.\n", | 1262 | pr_warning("%s: unable to probe %s early.\n", |
1186 | class_str, match->name); | 1263 | class_str, match->name); |
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/char/hvc_iucv.c b/drivers/char/hvc_iucv.c index 21681a81cc35..37b0542a4eeb 100644 --- a/drivers/char/hvc_iucv.c +++ b/drivers/char/hvc_iucv.c | |||
@@ -139,6 +139,8 @@ struct hvc_iucv_private *hvc_iucv_get_private(uint32_t num) | |||
139 | * | 139 | * |
140 | * This function allocates a new struct iucv_tty_buffer element and, optionally, | 140 | * This function allocates a new struct iucv_tty_buffer element and, optionally, |
141 | * allocates an internal data buffer with the specified size @size. | 141 | * allocates an internal data buffer with the specified size @size. |
142 | * The internal data buffer is always allocated with GFP_DMA which is | ||
143 | * required for receiving and sending data with IUCV. | ||
142 | * Note: The total message size arises from the internal buffer size and the | 144 | * Note: The total message size arises from the internal buffer size and the |
143 | * members of the iucv_tty_msg structure. | 145 | * members of the iucv_tty_msg structure. |
144 | * The function returns NULL if memory allocation has failed. | 146 | * The function returns NULL if memory allocation has failed. |
@@ -154,7 +156,7 @@ static struct iucv_tty_buffer *alloc_tty_buffer(size_t size, gfp_t flags) | |||
154 | 156 | ||
155 | if (size > 0) { | 157 | if (size > 0) { |
156 | bufp->msg.length = MSG_SIZE(size); | 158 | bufp->msg.length = MSG_SIZE(size); |
157 | bufp->mbuf = kmalloc(bufp->msg.length, flags); | 159 | bufp->mbuf = kmalloc(bufp->msg.length, flags | GFP_DMA); |
158 | if (!bufp->mbuf) { | 160 | if (!bufp->mbuf) { |
159 | mempool_free(bufp, hvc_iucv_mempool); | 161 | mempool_free(bufp, hvc_iucv_mempool); |
160 | return NULL; | 162 | return NULL; |
@@ -237,7 +239,7 @@ static int hvc_iucv_write(struct hvc_iucv_private *priv, | |||
237 | if (!rb->mbuf) { /* message not yet received ... */ | 239 | if (!rb->mbuf) { /* message not yet received ... */ |
238 | /* allocate mem to store msg data; if no memory is available | 240 | /* allocate mem to store msg data; if no memory is available |
239 | * then leave the buffer on the list and re-try later */ | 241 | * then leave the buffer on the list and re-try later */ |
240 | rb->mbuf = kmalloc(rb->msg.length, GFP_ATOMIC); | 242 | rb->mbuf = kmalloc(rb->msg.length, GFP_ATOMIC | GFP_DMA); |
241 | if (!rb->mbuf) | 243 | if (!rb->mbuf) |
242 | return -ENOMEM; | 244 | return -ENOMEM; |
243 | 245 | ||
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c index 578595c4425d..a1d381171388 100644 --- a/drivers/clocksource/sh_cmt.c +++ b/drivers/clocksource/sh_cmt.c | |||
@@ -149,13 +149,12 @@ static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start) | |||
149 | 149 | ||
150 | static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate) | 150 | static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate) |
151 | { | 151 | { |
152 | struct sh_timer_config *cfg = p->pdev->dev.platform_data; | ||
153 | int ret; | 152 | int ret; |
154 | 153 | ||
155 | /* enable clock */ | 154 | /* enable clock */ |
156 | ret = clk_enable(p->clk); | 155 | ret = clk_enable(p->clk); |
157 | if (ret) { | 156 | if (ret) { |
158 | pr_err("sh_cmt: cannot enable clock \"%s\"\n", cfg->clk); | 157 | dev_err(&p->pdev->dev, "cannot enable clock\n"); |
159 | return ret; | 158 | return ret; |
160 | } | 159 | } |
161 | 160 | ||
@@ -278,7 +277,7 @@ static void sh_cmt_clock_event_program_verify(struct sh_cmt_priv *p, | |||
278 | delay = 1; | 277 | delay = 1; |
279 | 278 | ||
280 | if (!delay) | 279 | if (!delay) |
281 | pr_warning("sh_cmt: too long delay\n"); | 280 | dev_warn(&p->pdev->dev, "too long delay\n"); |
282 | 281 | ||
283 | } while (delay); | 282 | } while (delay); |
284 | } | 283 | } |
@@ -288,7 +287,7 @@ static void sh_cmt_set_next(struct sh_cmt_priv *p, unsigned long delta) | |||
288 | unsigned long flags; | 287 | unsigned long flags; |
289 | 288 | ||
290 | if (delta > p->max_match_value) | 289 | if (delta > p->max_match_value) |
291 | pr_warning("sh_cmt: delta out of range\n"); | 290 | dev_warn(&p->pdev->dev, "delta out of range\n"); |
292 | 291 | ||
293 | spin_lock_irqsave(&p->lock, flags); | 292 | spin_lock_irqsave(&p->lock, flags); |
294 | p->next_match_value = delta; | 293 | p->next_match_value = delta; |
@@ -450,7 +449,7 @@ static int sh_cmt_register_clocksource(struct sh_cmt_priv *p, | |||
450 | cs->resume = sh_cmt_clocksource_resume; | 449 | cs->resume = sh_cmt_clocksource_resume; |
451 | cs->mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8); | 450 | cs->mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8); |
452 | cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; | 451 | cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; |
453 | pr_info("sh_cmt: %s used as clock source\n", cs->name); | 452 | dev_info(&p->pdev->dev, "used as clock source\n"); |
454 | clocksource_register(cs); | 453 | clocksource_register(cs); |
455 | return 0; | 454 | return 0; |
456 | } | 455 | } |
@@ -496,13 +495,11 @@ static void sh_cmt_clock_event_mode(enum clock_event_mode mode, | |||
496 | 495 | ||
497 | switch (mode) { | 496 | switch (mode) { |
498 | case CLOCK_EVT_MODE_PERIODIC: | 497 | case CLOCK_EVT_MODE_PERIODIC: |
499 | pr_info("sh_cmt: %s used for periodic clock events\n", | 498 | dev_info(&p->pdev->dev, "used for periodic clock events\n"); |
500 | ced->name); | ||
501 | sh_cmt_clock_event_start(p, 1); | 499 | sh_cmt_clock_event_start(p, 1); |
502 | break; | 500 | break; |
503 | case CLOCK_EVT_MODE_ONESHOT: | 501 | case CLOCK_EVT_MODE_ONESHOT: |
504 | pr_info("sh_cmt: %s used for oneshot clock events\n", | 502 | dev_info(&p->pdev->dev, "used for oneshot clock events\n"); |
505 | ced->name); | ||
506 | sh_cmt_clock_event_start(p, 0); | 503 | sh_cmt_clock_event_start(p, 0); |
507 | break; | 504 | break; |
508 | case CLOCK_EVT_MODE_SHUTDOWN: | 505 | case CLOCK_EVT_MODE_SHUTDOWN: |
@@ -543,7 +540,7 @@ static void sh_cmt_register_clockevent(struct sh_cmt_priv *p, | |||
543 | ced->set_next_event = sh_cmt_clock_event_next; | 540 | ced->set_next_event = sh_cmt_clock_event_next; |
544 | ced->set_mode = sh_cmt_clock_event_mode; | 541 | ced->set_mode = sh_cmt_clock_event_mode; |
545 | 542 | ||
546 | pr_info("sh_cmt: %s used for clock events\n", ced->name); | 543 | dev_info(&p->pdev->dev, "used for clock events\n"); |
547 | clockevents_register_device(ced); | 544 | clockevents_register_device(ced); |
548 | } | 545 | } |
549 | 546 | ||
@@ -600,12 +597,12 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev) | |||
600 | /* map memory, let mapbase point to our channel */ | 597 | /* map memory, let mapbase point to our channel */ |
601 | p->mapbase = ioremap_nocache(res->start, resource_size(res)); | 598 | p->mapbase = ioremap_nocache(res->start, resource_size(res)); |
602 | if (p->mapbase == NULL) { | 599 | if (p->mapbase == NULL) { |
603 | pr_err("sh_cmt: failed to remap I/O memory\n"); | 600 | dev_err(&p->pdev->dev, "failed to remap I/O memory\n"); |
604 | goto err0; | 601 | goto err0; |
605 | } | 602 | } |
606 | 603 | ||
607 | /* request irq using setup_irq() (too early for request_irq()) */ | 604 | /* request irq using setup_irq() (too early for request_irq()) */ |
608 | p->irqaction.name = cfg->name; | 605 | p->irqaction.name = dev_name(&p->pdev->dev); |
609 | p->irqaction.handler = sh_cmt_interrupt; | 606 | p->irqaction.handler = sh_cmt_interrupt; |
610 | p->irqaction.dev_id = p; | 607 | p->irqaction.dev_id = p; |
611 | p->irqaction.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL; | 608 | p->irqaction.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL; |
@@ -613,7 +610,7 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev) | |||
613 | /* get hold of clock */ | 610 | /* get hold of clock */ |
614 | p->clk = clk_get(&p->pdev->dev, cfg->clk); | 611 | p->clk = clk_get(&p->pdev->dev, cfg->clk); |
615 | if (IS_ERR(p->clk)) { | 612 | if (IS_ERR(p->clk)) { |
616 | pr_err("sh_cmt: cannot get clock \"%s\"\n", cfg->clk); | 613 | dev_err(&p->pdev->dev, "cannot get clock\n"); |
617 | ret = PTR_ERR(p->clk); | 614 | ret = PTR_ERR(p->clk); |
618 | goto err1; | 615 | goto err1; |
619 | } | 616 | } |
@@ -628,17 +625,17 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev) | |||
628 | p->clear_bits = ~0xc000; | 625 | p->clear_bits = ~0xc000; |
629 | } | 626 | } |
630 | 627 | ||
631 | ret = sh_cmt_register(p, cfg->name, | 628 | ret = sh_cmt_register(p, (char *)dev_name(&p->pdev->dev), |
632 | cfg->clockevent_rating, | 629 | cfg->clockevent_rating, |
633 | cfg->clocksource_rating); | 630 | cfg->clocksource_rating); |
634 | if (ret) { | 631 | if (ret) { |
635 | pr_err("sh_cmt: registration failed\n"); | 632 | dev_err(&p->pdev->dev, "registration failed\n"); |
636 | goto err1; | 633 | goto err1; |
637 | } | 634 | } |
638 | 635 | ||
639 | ret = setup_irq(irq, &p->irqaction); | 636 | ret = setup_irq(irq, &p->irqaction); |
640 | if (ret) { | 637 | if (ret) { |
641 | pr_err("sh_cmt: failed to request irq %d\n", irq); | 638 | dev_err(&p->pdev->dev, "failed to request irq %d\n", irq); |
642 | goto err1; | 639 | goto err1; |
643 | } | 640 | } |
644 | 641 | ||
@@ -653,11 +650,10 @@ err0: | |||
653 | static int __devinit sh_cmt_probe(struct platform_device *pdev) | 650 | static int __devinit sh_cmt_probe(struct platform_device *pdev) |
654 | { | 651 | { |
655 | struct sh_cmt_priv *p = platform_get_drvdata(pdev); | 652 | struct sh_cmt_priv *p = platform_get_drvdata(pdev); |
656 | struct sh_timer_config *cfg = pdev->dev.platform_data; | ||
657 | int ret; | 653 | int ret; |
658 | 654 | ||
659 | if (p) { | 655 | if (p) { |
660 | pr_info("sh_cmt: %s kept as earlytimer\n", cfg->name); | 656 | dev_info(&pdev->dev, "kept as earlytimer\n"); |
661 | return 0; | 657 | return 0; |
662 | } | 658 | } |
663 | 659 | ||
diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c index 4c8a759e60cd..8ce355572d16 100644 --- a/drivers/clocksource/sh_mtu2.c +++ b/drivers/clocksource/sh_mtu2.c | |||
@@ -118,13 +118,12 @@ static void sh_mtu2_start_stop_ch(struct sh_mtu2_priv *p, int start) | |||
118 | 118 | ||
119 | static int sh_mtu2_enable(struct sh_mtu2_priv *p) | 119 | static int sh_mtu2_enable(struct sh_mtu2_priv *p) |
120 | { | 120 | { |
121 | struct sh_timer_config *cfg = p->pdev->dev.platform_data; | ||
122 | int ret; | 121 | int ret; |
123 | 122 | ||
124 | /* enable clock */ | 123 | /* enable clock */ |
125 | ret = clk_enable(p->clk); | 124 | ret = clk_enable(p->clk); |
126 | if (ret) { | 125 | if (ret) { |
127 | pr_err("sh_mtu2: cannot enable clock \"%s\"\n", cfg->clk); | 126 | dev_err(&p->pdev->dev, "cannot enable clock\n"); |
128 | return ret; | 127 | return ret; |
129 | } | 128 | } |
130 | 129 | ||
@@ -193,8 +192,7 @@ static void sh_mtu2_clock_event_mode(enum clock_event_mode mode, | |||
193 | 192 | ||
194 | switch (mode) { | 193 | switch (mode) { |
195 | case CLOCK_EVT_MODE_PERIODIC: | 194 | case CLOCK_EVT_MODE_PERIODIC: |
196 | pr_info("sh_mtu2: %s used for periodic clock events\n", | 195 | dev_info(&p->pdev->dev, "used for periodic clock events\n"); |
197 | ced->name); | ||
198 | sh_mtu2_enable(p); | 196 | sh_mtu2_enable(p); |
199 | break; | 197 | break; |
200 | case CLOCK_EVT_MODE_UNUSED: | 198 | case CLOCK_EVT_MODE_UNUSED: |
@@ -221,13 +219,13 @@ static void sh_mtu2_register_clockevent(struct sh_mtu2_priv *p, | |||
221 | ced->cpumask = cpumask_of(0); | 219 | ced->cpumask = cpumask_of(0); |
222 | ced->set_mode = sh_mtu2_clock_event_mode; | 220 | ced->set_mode = sh_mtu2_clock_event_mode; |
223 | 221 | ||
224 | pr_info("sh_mtu2: %s used for clock events\n", ced->name); | 222 | dev_info(&p->pdev->dev, "used for clock events\n"); |
225 | clockevents_register_device(ced); | 223 | clockevents_register_device(ced); |
226 | 224 | ||
227 | ret = setup_irq(p->irqaction.irq, &p->irqaction); | 225 | ret = setup_irq(p->irqaction.irq, &p->irqaction); |
228 | if (ret) { | 226 | if (ret) { |
229 | pr_err("sh_mtu2: failed to request irq %d\n", | 227 | dev_err(&p->pdev->dev, "failed to request irq %d\n", |
230 | p->irqaction.irq); | 228 | p->irqaction.irq); |
231 | return; | 229 | return; |
232 | } | 230 | } |
233 | } | 231 | } |
@@ -273,12 +271,12 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev) | |||
273 | /* map memory, let mapbase point to our channel */ | 271 | /* map memory, let mapbase point to our channel */ |
274 | p->mapbase = ioremap_nocache(res->start, resource_size(res)); | 272 | p->mapbase = ioremap_nocache(res->start, resource_size(res)); |
275 | if (p->mapbase == NULL) { | 273 | if (p->mapbase == NULL) { |
276 | pr_err("sh_mtu2: failed to remap I/O memory\n"); | 274 | dev_err(&p->pdev->dev, "failed to remap I/O memory\n"); |
277 | goto err0; | 275 | goto err0; |
278 | } | 276 | } |
279 | 277 | ||
280 | /* setup data for setup_irq() (too early for request_irq()) */ | 278 | /* setup data for setup_irq() (too early for request_irq()) */ |
281 | p->irqaction.name = cfg->name; | 279 | p->irqaction.name = dev_name(&p->pdev->dev); |
282 | p->irqaction.handler = sh_mtu2_interrupt; | 280 | p->irqaction.handler = sh_mtu2_interrupt; |
283 | p->irqaction.dev_id = p; | 281 | p->irqaction.dev_id = p; |
284 | p->irqaction.irq = irq; | 282 | p->irqaction.irq = irq; |
@@ -287,12 +285,13 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev) | |||
287 | /* get hold of clock */ | 285 | /* get hold of clock */ |
288 | p->clk = clk_get(&p->pdev->dev, cfg->clk); | 286 | p->clk = clk_get(&p->pdev->dev, cfg->clk); |
289 | if (IS_ERR(p->clk)) { | 287 | if (IS_ERR(p->clk)) { |
290 | pr_err("sh_mtu2: cannot get clock \"%s\"\n", cfg->clk); | 288 | dev_err(&p->pdev->dev, "cannot get clock\n"); |
291 | ret = PTR_ERR(p->clk); | 289 | ret = PTR_ERR(p->clk); |
292 | goto err1; | 290 | goto err1; |
293 | } | 291 | } |
294 | 292 | ||
295 | return sh_mtu2_register(p, cfg->name, cfg->clockevent_rating); | 293 | return sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev), |
294 | cfg->clockevent_rating); | ||
296 | err1: | 295 | err1: |
297 | iounmap(p->mapbase); | 296 | iounmap(p->mapbase); |
298 | err0: | 297 | err0: |
@@ -302,11 +301,10 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev) | |||
302 | static int __devinit sh_mtu2_probe(struct platform_device *pdev) | 301 | static int __devinit sh_mtu2_probe(struct platform_device *pdev) |
303 | { | 302 | { |
304 | struct sh_mtu2_priv *p = platform_get_drvdata(pdev); | 303 | struct sh_mtu2_priv *p = platform_get_drvdata(pdev); |
305 | struct sh_timer_config *cfg = pdev->dev.platform_data; | ||
306 | int ret; | 304 | int ret; |
307 | 305 | ||
308 | if (p) { | 306 | if (p) { |
309 | pr_info("sh_mtu2: %s kept as earlytimer\n", cfg->name); | 307 | dev_info(&pdev->dev, "kept as earlytimer\n"); |
310 | return 0; | 308 | return 0; |
311 | } | 309 | } |
312 | 310 | ||
diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c index 961f5b5ef6a3..34239453ebaf 100644 --- a/drivers/clocksource/sh_tmu.c +++ b/drivers/clocksource/sh_tmu.c | |||
@@ -106,13 +106,12 @@ static void sh_tmu_start_stop_ch(struct sh_tmu_priv *p, int start) | |||
106 | 106 | ||
107 | static int sh_tmu_enable(struct sh_tmu_priv *p) | 107 | static int sh_tmu_enable(struct sh_tmu_priv *p) |
108 | { | 108 | { |
109 | struct sh_timer_config *cfg = p->pdev->dev.platform_data; | ||
110 | int ret; | 109 | int ret; |
111 | 110 | ||
112 | /* enable clock */ | 111 | /* enable clock */ |
113 | ret = clk_enable(p->clk); | 112 | ret = clk_enable(p->clk); |
114 | if (ret) { | 113 | if (ret) { |
115 | pr_err("sh_tmu: cannot enable clock \"%s\"\n", cfg->clk); | 114 | dev_err(&p->pdev->dev, "cannot enable clock\n"); |
116 | return ret; | 115 | return ret; |
117 | } | 116 | } |
118 | 117 | ||
@@ -228,7 +227,7 @@ static int sh_tmu_register_clocksource(struct sh_tmu_priv *p, | |||
228 | cs->disable = sh_tmu_clocksource_disable; | 227 | cs->disable = sh_tmu_clocksource_disable; |
229 | cs->mask = CLOCKSOURCE_MASK(32); | 228 | cs->mask = CLOCKSOURCE_MASK(32); |
230 | cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; | 229 | cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; |
231 | pr_info("sh_tmu: %s used as clock source\n", cs->name); | 230 | dev_info(&p->pdev->dev, "used as clock source\n"); |
232 | clocksource_register(cs); | 231 | clocksource_register(cs); |
233 | return 0; | 232 | return 0; |
234 | } | 233 | } |
@@ -276,13 +275,11 @@ static void sh_tmu_clock_event_mode(enum clock_event_mode mode, | |||
276 | 275 | ||
277 | switch (mode) { | 276 | switch (mode) { |
278 | case CLOCK_EVT_MODE_PERIODIC: | 277 | case CLOCK_EVT_MODE_PERIODIC: |
279 | pr_info("sh_tmu: %s used for periodic clock events\n", | 278 | dev_info(&p->pdev->dev, "used for periodic clock events\n"); |
280 | ced->name); | ||
281 | sh_tmu_clock_event_start(p, 1); | 279 | sh_tmu_clock_event_start(p, 1); |
282 | break; | 280 | break; |
283 | case CLOCK_EVT_MODE_ONESHOT: | 281 | case CLOCK_EVT_MODE_ONESHOT: |
284 | pr_info("sh_tmu: %s used for oneshot clock events\n", | 282 | dev_info(&p->pdev->dev, "used for oneshot clock events\n"); |
285 | ced->name); | ||
286 | sh_tmu_clock_event_start(p, 0); | 283 | sh_tmu_clock_event_start(p, 0); |
287 | break; | 284 | break; |
288 | case CLOCK_EVT_MODE_UNUSED: | 285 | case CLOCK_EVT_MODE_UNUSED: |
@@ -323,13 +320,13 @@ static void sh_tmu_register_clockevent(struct sh_tmu_priv *p, | |||
323 | ced->set_next_event = sh_tmu_clock_event_next; | 320 | ced->set_next_event = sh_tmu_clock_event_next; |
324 | ced->set_mode = sh_tmu_clock_event_mode; | 321 | ced->set_mode = sh_tmu_clock_event_mode; |
325 | 322 | ||
326 | pr_info("sh_tmu: %s used for clock events\n", ced->name); | 323 | dev_info(&p->pdev->dev, "used for clock events\n"); |
327 | clockevents_register_device(ced); | 324 | clockevents_register_device(ced); |
328 | 325 | ||
329 | ret = setup_irq(p->irqaction.irq, &p->irqaction); | 326 | ret = setup_irq(p->irqaction.irq, &p->irqaction); |
330 | if (ret) { | 327 | if (ret) { |
331 | pr_err("sh_tmu: failed to request irq %d\n", | 328 | dev_err(&p->pdev->dev, "failed to request irq %d\n", |
332 | p->irqaction.irq); | 329 | p->irqaction.irq); |
333 | return; | 330 | return; |
334 | } | 331 | } |
335 | } | 332 | } |
@@ -378,12 +375,12 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev) | |||
378 | /* map memory, let mapbase point to our channel */ | 375 | /* map memory, let mapbase point to our channel */ |
379 | p->mapbase = ioremap_nocache(res->start, resource_size(res)); | 376 | p->mapbase = ioremap_nocache(res->start, resource_size(res)); |
380 | if (p->mapbase == NULL) { | 377 | if (p->mapbase == NULL) { |
381 | pr_err("sh_tmu: failed to remap I/O memory\n"); | 378 | dev_err(&p->pdev->dev, "failed to remap I/O memory\n"); |
382 | goto err0; | 379 | goto err0; |
383 | } | 380 | } |
384 | 381 | ||
385 | /* setup data for setup_irq() (too early for request_irq()) */ | 382 | /* setup data for setup_irq() (too early for request_irq()) */ |
386 | p->irqaction.name = cfg->name; | 383 | p->irqaction.name = dev_name(&p->pdev->dev); |
387 | p->irqaction.handler = sh_tmu_interrupt; | 384 | p->irqaction.handler = sh_tmu_interrupt; |
388 | p->irqaction.dev_id = p; | 385 | p->irqaction.dev_id = p; |
389 | p->irqaction.irq = irq; | 386 | p->irqaction.irq = irq; |
@@ -392,12 +389,12 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev) | |||
392 | /* get hold of clock */ | 389 | /* get hold of clock */ |
393 | p->clk = clk_get(&p->pdev->dev, cfg->clk); | 390 | p->clk = clk_get(&p->pdev->dev, cfg->clk); |
394 | if (IS_ERR(p->clk)) { | 391 | if (IS_ERR(p->clk)) { |
395 | pr_err("sh_tmu: cannot get clock \"%s\"\n", cfg->clk); | 392 | dev_err(&p->pdev->dev, "cannot get clock\n"); |
396 | ret = PTR_ERR(p->clk); | 393 | ret = PTR_ERR(p->clk); |
397 | goto err1; | 394 | goto err1; |
398 | } | 395 | } |
399 | 396 | ||
400 | return sh_tmu_register(p, cfg->name, | 397 | return sh_tmu_register(p, (char *)dev_name(&p->pdev->dev), |
401 | cfg->clockevent_rating, | 398 | cfg->clockevent_rating, |
402 | cfg->clocksource_rating); | 399 | cfg->clocksource_rating); |
403 | err1: | 400 | err1: |
@@ -409,11 +406,10 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev) | |||
409 | static int __devinit sh_tmu_probe(struct platform_device *pdev) | 406 | static int __devinit sh_tmu_probe(struct platform_device *pdev) |
410 | { | 407 | { |
411 | struct sh_tmu_priv *p = platform_get_drvdata(pdev); | 408 | struct sh_tmu_priv *p = platform_get_drvdata(pdev); |
412 | struct sh_timer_config *cfg = pdev->dev.platform_data; | ||
413 | int ret; | 409 | int ret; |
414 | 410 | ||
415 | if (p) { | 411 | if (p) { |
416 | pr_info("sh_tmu: %s kept as earlytimer\n", cfg->name); | 412 | dev_info(&pdev->dev, "kept as earlytimer\n"); |
417 | return 0; | 413 | return 0; |
418 | } | 414 | } |
419 | 415 | ||
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/s390/block/dasd.c b/drivers/s390/block/dasd.c index 4951aa82e9f5..bbea90baf98f 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <asm/ebcdic.h> | 26 | #include <asm/ebcdic.h> |
27 | #include <asm/idals.h> | 27 | #include <asm/idals.h> |
28 | #include <asm/itcw.h> | 28 | #include <asm/itcw.h> |
29 | #include <asm/diag.h> | ||
29 | 30 | ||
30 | /* This is ugly... */ | 31 | /* This is ugly... */ |
31 | #define PRINTK_HEADER "dasd:" | 32 | #define PRINTK_HEADER "dasd:" |
@@ -2212,6 +2213,13 @@ static int dasd_open(struct block_device *bdev, fmode_t mode) | |||
2212 | goto out; | 2213 | goto out; |
2213 | } | 2214 | } |
2214 | 2215 | ||
2216 | if ((mode & FMODE_WRITE) && | ||
2217 | (test_bit(DASD_FLAG_DEVICE_RO, &base->flags) || | ||
2218 | (base->features & DASD_FEATURE_READONLY))) { | ||
2219 | rc = -EROFS; | ||
2220 | goto out; | ||
2221 | } | ||
2222 | |||
2215 | return 0; | 2223 | return 0; |
2216 | 2224 | ||
2217 | out: | 2225 | out: |
@@ -2289,6 +2297,34 @@ dasd_exit(void) | |||
2289 | * SECTION: common functions for ccw_driver use | 2297 | * SECTION: common functions for ccw_driver use |
2290 | */ | 2298 | */ |
2291 | 2299 | ||
2300 | /* | ||
2301 | * Is the device read-only? | ||
2302 | * Note that this function does not report the setting of the | ||
2303 | * readonly device attribute, but how it is configured in z/VM. | ||
2304 | */ | ||
2305 | int dasd_device_is_ro(struct dasd_device *device) | ||
2306 | { | ||
2307 | struct ccw_dev_id dev_id; | ||
2308 | struct diag210 diag_data; | ||
2309 | int rc; | ||
2310 | |||
2311 | if (!MACHINE_IS_VM) | ||
2312 | return 0; | ||
2313 | ccw_device_get_id(device->cdev, &dev_id); | ||
2314 | memset(&diag_data, 0, sizeof(diag_data)); | ||
2315 | diag_data.vrdcdvno = dev_id.devno; | ||
2316 | diag_data.vrdclen = sizeof(diag_data); | ||
2317 | rc = diag210(&diag_data); | ||
2318 | if (rc == 0 || rc == 2) { | ||
2319 | return diag_data.vrdcvfla & 0x80; | ||
2320 | } else { | ||
2321 | DBF_EVENT(DBF_WARNING, "diag210 failed for dev=%04x with rc=%d", | ||
2322 | dev_id.devno, rc); | ||
2323 | return 0; | ||
2324 | } | ||
2325 | } | ||
2326 | EXPORT_SYMBOL_GPL(dasd_device_is_ro); | ||
2327 | |||
2292 | static void dasd_generic_auto_online(void *data, async_cookie_t cookie) | 2328 | static void dasd_generic_auto_online(void *data, async_cookie_t cookie) |
2293 | { | 2329 | { |
2294 | struct ccw_device *cdev = data; | 2330 | struct ccw_device *cdev = data; |
diff --git a/drivers/s390/block/dasd_3990_erp.c b/drivers/s390/block/dasd_3990_erp.c index 44796ba4eb9b..51224f76b980 100644 --- a/drivers/s390/block/dasd_3990_erp.c +++ b/drivers/s390/block/dasd_3990_erp.c | |||
@@ -1045,6 +1045,10 @@ dasd_3990_erp_com_rej(struct dasd_ccw_req * erp, char *sense) | |||
1045 | 1045 | ||
1046 | erp->retries = 5; | 1046 | erp->retries = 5; |
1047 | 1047 | ||
1048 | } else if (sense[1] & SNS1_WRITE_INHIBITED) { | ||
1049 | dev_err(&device->cdev->dev, "An I/O request was rejected" | ||
1050 | " because writing is inhibited\n"); | ||
1051 | erp = dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED); | ||
1048 | } else { | 1052 | } else { |
1049 | /* fatal error - set status to FAILED | 1053 | /* fatal error - set status to FAILED |
1050 | internal error 09 - Command Reject */ | 1054 | internal error 09 - Command Reject */ |
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index d49766f3b940..8e23919c8704 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c | |||
@@ -742,6 +742,7 @@ dasd_ro_store(struct device *dev, struct device_attribute *attr, | |||
742 | const char *buf, size_t count) | 742 | const char *buf, size_t count) |
743 | { | 743 | { |
744 | struct dasd_devmap *devmap; | 744 | struct dasd_devmap *devmap; |
745 | struct dasd_device *device; | ||
745 | int val; | 746 | int val; |
746 | char *endp; | 747 | char *endp; |
747 | 748 | ||
@@ -758,12 +759,14 @@ dasd_ro_store(struct device *dev, struct device_attribute *attr, | |||
758 | devmap->features |= DASD_FEATURE_READONLY; | 759 | devmap->features |= DASD_FEATURE_READONLY; |
759 | else | 760 | else |
760 | devmap->features &= ~DASD_FEATURE_READONLY; | 761 | devmap->features &= ~DASD_FEATURE_READONLY; |
761 | if (devmap->device) | 762 | device = devmap->device; |
762 | devmap->device->features = devmap->features; | 763 | if (device) { |
763 | if (devmap->device && devmap->device->block | 764 | device->features = devmap->features; |
764 | && devmap->device->block->gdp) | 765 | val = val || test_bit(DASD_FLAG_DEVICE_RO, &device->flags); |
765 | set_disk_ro(devmap->device->block->gdp, val); | 766 | } |
766 | spin_unlock(&dasd_devmap_lock); | 767 | spin_unlock(&dasd_devmap_lock); |
768 | if (device && device->block && device->block->gdp) | ||
769 | set_disk_ro(device->block->gdp, val); | ||
767 | return count; | 770 | return count; |
768 | } | 771 | } |
769 | 772 | ||
diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c index 6e14863f5c70..687f323cdc38 100644 --- a/drivers/s390/block/dasd_diag.c +++ b/drivers/s390/block/dasd_diag.c | |||
@@ -145,12 +145,10 @@ dasd_diag_erp(struct dasd_device *device) | |||
145 | mdsk_term_io(device); | 145 | mdsk_term_io(device); |
146 | rc = mdsk_init_io(device, device->block->bp_block, 0, NULL); | 146 | rc = mdsk_init_io(device, device->block->bp_block, 0, NULL); |
147 | if (rc == 4) { | 147 | if (rc == 4) { |
148 | if (!(device->features & DASD_FEATURE_READONLY)) { | 148 | if (!(test_and_set_bit(DASD_FLAG_DEVICE_RO, &device->flags))) |
149 | pr_warning("%s: The access mode of a DIAG device " | 149 | pr_warning("%s: The access mode of a DIAG device " |
150 | "changed to read-only\n", | 150 | "changed to read-only\n", |
151 | dev_name(&device->cdev->dev)); | 151 | dev_name(&device->cdev->dev)); |
152 | device->features |= DASD_FEATURE_READONLY; | ||
153 | } | ||
154 | rc = 0; | 152 | rc = 0; |
155 | } | 153 | } |
156 | if (rc) | 154 | if (rc) |
@@ -449,7 +447,7 @@ dasd_diag_check_device(struct dasd_device *device) | |||
449 | rc = -EIO; | 447 | rc = -EIO; |
450 | } else { | 448 | } else { |
451 | if (rc == 4) | 449 | if (rc == 4) |
452 | device->features |= DASD_FEATURE_READONLY; | 450 | set_bit(DASD_FLAG_DEVICE_RO, &device->flags); |
453 | pr_info("%s: New DASD with %ld byte/block, total size %ld " | 451 | pr_info("%s: New DASD with %ld byte/block, total size %ld " |
454 | "KB%s\n", dev_name(&device->cdev->dev), | 452 | "KB%s\n", dev_name(&device->cdev->dev), |
455 | (unsigned long) block->bp_block, | 453 | (unsigned long) block->bp_block, |
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index 1cca21aafaba..01f4e7a34aa8 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
@@ -1089,6 +1089,7 @@ dasd_eckd_check_characteristics(struct dasd_device *device) | |||
1089 | struct dasd_eckd_private *private; | 1089 | struct dasd_eckd_private *private; |
1090 | struct dasd_block *block; | 1090 | struct dasd_block *block; |
1091 | int is_known, rc; | 1091 | int is_known, rc; |
1092 | int readonly; | ||
1092 | 1093 | ||
1093 | if (!ccw_device_is_pathgroup(device->cdev)) { | 1094 | if (!ccw_device_is_pathgroup(device->cdev)) { |
1094 | dev_warn(&device->cdev->dev, | 1095 | dev_warn(&device->cdev->dev, |
@@ -1182,15 +1183,20 @@ dasd_eckd_check_characteristics(struct dasd_device *device) | |||
1182 | else | 1183 | else |
1183 | private->real_cyl = private->rdc_data.no_cyl; | 1184 | private->real_cyl = private->rdc_data.no_cyl; |
1184 | 1185 | ||
1186 | readonly = dasd_device_is_ro(device); | ||
1187 | if (readonly) | ||
1188 | set_bit(DASD_FLAG_DEVICE_RO, &device->flags); | ||
1189 | |||
1185 | dev_info(&device->cdev->dev, "New DASD %04X/%02X (CU %04X/%02X) " | 1190 | dev_info(&device->cdev->dev, "New DASD %04X/%02X (CU %04X/%02X) " |
1186 | "with %d cylinders, %d heads, %d sectors\n", | 1191 | "with %d cylinders, %d heads, %d sectors%s\n", |
1187 | private->rdc_data.dev_type, | 1192 | private->rdc_data.dev_type, |
1188 | private->rdc_data.dev_model, | 1193 | private->rdc_data.dev_model, |
1189 | private->rdc_data.cu_type, | 1194 | private->rdc_data.cu_type, |
1190 | private->rdc_data.cu_model.model, | 1195 | private->rdc_data.cu_model.model, |
1191 | private->real_cyl, | 1196 | private->real_cyl, |
1192 | private->rdc_data.trk_per_cyl, | 1197 | private->rdc_data.trk_per_cyl, |
1193 | private->rdc_data.sec_per_trk); | 1198 | private->rdc_data.sec_per_trk, |
1199 | readonly ? ", read-only device" : ""); | ||
1194 | return 0; | 1200 | return 0; |
1195 | 1201 | ||
1196 | out_err3: | 1202 | out_err3: |
@@ -2839,8 +2845,13 @@ static int dasd_symm_io(struct dasd_device *device, void __user *argp) | |||
2839 | char *psf_data, *rssd_result; | 2845 | char *psf_data, *rssd_result; |
2840 | struct dasd_ccw_req *cqr; | 2846 | struct dasd_ccw_req *cqr; |
2841 | struct ccw1 *ccw; | 2847 | struct ccw1 *ccw; |
2848 | char psf0, psf1; | ||
2842 | int rc; | 2849 | int rc; |
2843 | 2850 | ||
2851 | if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RAWIO)) | ||
2852 | return -EACCES; | ||
2853 | psf0 = psf1 = 0; | ||
2854 | |||
2844 | /* Copy parms from caller */ | 2855 | /* Copy parms from caller */ |
2845 | rc = -EFAULT; | 2856 | rc = -EFAULT; |
2846 | if (copy_from_user(&usrparm, argp, sizeof(usrparm))) | 2857 | if (copy_from_user(&usrparm, argp, sizeof(usrparm))) |
@@ -2869,12 +2880,8 @@ static int dasd_symm_io(struct dasd_device *device, void __user *argp) | |||
2869 | (void __user *)(unsigned long) usrparm.psf_data, | 2880 | (void __user *)(unsigned long) usrparm.psf_data, |
2870 | usrparm.psf_data_len)) | 2881 | usrparm.psf_data_len)) |
2871 | goto out_free; | 2882 | goto out_free; |
2872 | 2883 | psf0 = psf_data[0]; | |
2873 | /* sanity check on syscall header */ | 2884 | psf1 = psf_data[1]; |
2874 | if (psf_data[0] != 0x17 && psf_data[1] != 0xce) { | ||
2875 | rc = -EINVAL; | ||
2876 | goto out_free; | ||
2877 | } | ||
2878 | 2885 | ||
2879 | /* setup CCWs for PSF + RSSD */ | 2886 | /* setup CCWs for PSF + RSSD */ |
2880 | cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 2 , 0, device); | 2887 | cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 2 , 0, device); |
@@ -2925,7 +2932,9 @@ out_free: | |||
2925 | kfree(rssd_result); | 2932 | kfree(rssd_result); |
2926 | kfree(psf_data); | 2933 | kfree(psf_data); |
2927 | out: | 2934 | out: |
2928 | DBF_DEV_EVENT(DBF_WARNING, device, "Symmetrix ioctl: rc=%d", rc); | 2935 | DBF_DEV_EVENT(DBF_WARNING, device, |
2936 | "Symmetrix ioctl (0x%02x 0x%02x): rc=%d", | ||
2937 | (int) psf0, (int) psf1, rc); | ||
2929 | return rc; | 2938 | return rc; |
2930 | } | 2939 | } |
2931 | 2940 | ||
diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c index 0f152444ac77..37282b90eecc 100644 --- a/drivers/s390/block/dasd_fba.c +++ b/drivers/s390/block/dasd_fba.c | |||
@@ -124,6 +124,7 @@ dasd_fba_check_characteristics(struct dasd_device *device) | |||
124 | struct dasd_fba_private *private; | 124 | struct dasd_fba_private *private; |
125 | struct ccw_device *cdev = device->cdev; | 125 | struct ccw_device *cdev = device->cdev; |
126 | int rc; | 126 | int rc; |
127 | int readonly; | ||
127 | 128 | ||
128 | private = (struct dasd_fba_private *) device->private; | 129 | private = (struct dasd_fba_private *) device->private; |
129 | if (!private) { | 130 | if (!private) { |
@@ -162,16 +163,21 @@ dasd_fba_check_characteristics(struct dasd_device *device) | |||
162 | return rc; | 163 | return rc; |
163 | } | 164 | } |
164 | 165 | ||
166 | readonly = dasd_device_is_ro(device); | ||
167 | if (readonly) | ||
168 | set_bit(DASD_FLAG_DEVICE_RO, &device->flags); | ||
169 | |||
165 | dev_info(&device->cdev->dev, | 170 | dev_info(&device->cdev->dev, |
166 | "New FBA DASD %04X/%02X (CU %04X/%02X) with %d MB " | 171 | "New FBA DASD %04X/%02X (CU %04X/%02X) with %d MB " |
167 | "and %d B/blk\n", | 172 | "and %d B/blk%s\n", |
168 | cdev->id.dev_type, | 173 | cdev->id.dev_type, |
169 | cdev->id.dev_model, | 174 | cdev->id.dev_model, |
170 | cdev->id.cu_type, | 175 | cdev->id.cu_type, |
171 | cdev->id.cu_model, | 176 | cdev->id.cu_model, |
172 | ((private->rdc_data.blk_bdsa * | 177 | ((private->rdc_data.blk_bdsa * |
173 | (private->rdc_data.blk_size >> 9)) >> 11), | 178 | (private->rdc_data.blk_size >> 9)) >> 11), |
174 | private->rdc_data.blk_size); | 179 | private->rdc_data.blk_size, |
180 | readonly ? ", read-only device" : ""); | ||
175 | return 0; | 181 | return 0; |
176 | } | 182 | } |
177 | 183 | ||
diff --git a/drivers/s390/block/dasd_genhd.c b/drivers/s390/block/dasd_genhd.c index 94f92a1247f2..30a1ca3d08b7 100644 --- a/drivers/s390/block/dasd_genhd.c +++ b/drivers/s390/block/dasd_genhd.c | |||
@@ -70,7 +70,8 @@ int dasd_gendisk_alloc(struct dasd_block *block) | |||
70 | } | 70 | } |
71 | len += sprintf(gdp->disk_name + len, "%c", 'a'+(base->devindex%26)); | 71 | len += sprintf(gdp->disk_name + len, "%c", 'a'+(base->devindex%26)); |
72 | 72 | ||
73 | if (block->base->features & DASD_FEATURE_READONLY) | 73 | if (base->features & DASD_FEATURE_READONLY || |
74 | test_bit(DASD_FLAG_DEVICE_RO, &base->flags)) | ||
74 | set_disk_ro(gdp, 1); | 75 | set_disk_ro(gdp, 1); |
75 | gdp->private_data = block; | 76 | gdp->private_data = block; |
76 | gdp->queue = block->request_queue; | 77 | gdp->queue = block->request_queue; |
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h index ed73ce550822..a91d4a97d4f2 100644 --- a/drivers/s390/block/dasd_int.h +++ b/drivers/s390/block/dasd_int.h | |||
@@ -436,6 +436,10 @@ struct dasd_block { | |||
436 | #define DASD_FLAG_OFFLINE 3 /* device is in offline processing */ | 436 | #define DASD_FLAG_OFFLINE 3 /* device is in offline processing */ |
437 | #define DASD_FLAG_EER_SNSS 4 /* A SNSS is required */ | 437 | #define DASD_FLAG_EER_SNSS 4 /* A SNSS is required */ |
438 | #define DASD_FLAG_EER_IN_USE 5 /* A SNSS request is running */ | 438 | #define DASD_FLAG_EER_IN_USE 5 /* A SNSS request is running */ |
439 | #define DASD_FLAG_DEVICE_RO 6 /* The device itself is read-only. Don't | ||
440 | * confuse this with the user specified | ||
441 | * read-only feature. | ||
442 | */ | ||
439 | 443 | ||
440 | void dasd_put_device_wake(struct dasd_device *); | 444 | void dasd_put_device_wake(struct dasd_device *); |
441 | 445 | ||
@@ -609,6 +613,9 @@ char *dasd_get_sense(struct irb *); | |||
609 | void dasd_device_set_stop_bits(struct dasd_device *, int); | 613 | void dasd_device_set_stop_bits(struct dasd_device *, int); |
610 | void dasd_device_remove_stop_bits(struct dasd_device *, int); | 614 | void dasd_device_remove_stop_bits(struct dasd_device *, int); |
611 | 615 | ||
616 | int dasd_device_is_ro(struct dasd_device *); | ||
617 | |||
618 | |||
612 | /* externals in dasd_devmap.c */ | 619 | /* externals in dasd_devmap.c */ |
613 | extern int dasd_max_devindex; | 620 | extern int dasd_max_devindex; |
614 | extern int dasd_probeonly; | 621 | extern int dasd_probeonly; |
diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c index 7039d9cf0fb4..3479f8158a1b 100644 --- a/drivers/s390/block/dasd_ioctl.c +++ b/drivers/s390/block/dasd_ioctl.c | |||
@@ -199,7 +199,8 @@ dasd_ioctl_format(struct block_device *bdev, void __user *argp) | |||
199 | if (!argp) | 199 | if (!argp) |
200 | return -EINVAL; | 200 | return -EINVAL; |
201 | 201 | ||
202 | if (block->base->features & DASD_FEATURE_READONLY) | 202 | if (block->base->features & DASD_FEATURE_READONLY || |
203 | test_bit(DASD_FLAG_DEVICE_RO, &block->base->flags)) | ||
203 | return -EROFS; | 204 | return -EROFS; |
204 | if (copy_from_user(&fdata, argp, sizeof(struct format_data_t))) | 205 | if (copy_from_user(&fdata, argp, sizeof(struct format_data_t))) |
205 | return -EFAULT; | 206 | return -EFAULT; |
@@ -349,7 +350,8 @@ dasd_ioctl_set_ro(struct block_device *bdev, void __user *argp) | |||
349 | return -EINVAL; | 350 | return -EINVAL; |
350 | if (get_user(intval, (int __user *)argp)) | 351 | if (get_user(intval, (int __user *)argp)) |
351 | return -EFAULT; | 352 | return -EFAULT; |
352 | 353 | if (!intval && test_bit(DASD_FLAG_DEVICE_RO, &block->base->flags)) | |
354 | return -EROFS; | ||
353 | set_disk_ro(bdev->bd_disk, intval); | 355 | set_disk_ro(bdev->bd_disk, intval); |
354 | return dasd_set_feature(block->base->cdev, DASD_FEATURE_READONLY, intval); | 356 | return dasd_set_feature(block->base->cdev, DASD_FEATURE_READONLY, intval); |
355 | } | 357 | } |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index c6abb75c4615..6d229f3523a0 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -764,7 +764,7 @@ static void sch_create_and_recog_new_device(struct subchannel *sch) | |||
764 | static void io_subchannel_register(struct ccw_device *cdev) | 764 | static void io_subchannel_register(struct ccw_device *cdev) |
765 | { | 765 | { |
766 | struct subchannel *sch; | 766 | struct subchannel *sch; |
767 | int ret; | 767 | int ret, adjust_init_count = 1; |
768 | unsigned long flags; | 768 | unsigned long flags; |
769 | 769 | ||
770 | sch = to_subchannel(cdev->dev.parent); | 770 | sch = to_subchannel(cdev->dev.parent); |
@@ -793,6 +793,7 @@ static void io_subchannel_register(struct ccw_device *cdev) | |||
793 | cdev->private->dev_id.ssid, | 793 | cdev->private->dev_id.ssid, |
794 | cdev->private->dev_id.devno); | 794 | cdev->private->dev_id.devno); |
795 | } | 795 | } |
796 | adjust_init_count = 0; | ||
796 | goto out; | 797 | goto out; |
797 | } | 798 | } |
798 | /* | 799 | /* |
@@ -818,7 +819,7 @@ out: | |||
818 | cdev->private->flags.recog_done = 1; | 819 | cdev->private->flags.recog_done = 1; |
819 | wake_up(&cdev->private->wait_q); | 820 | wake_up(&cdev->private->wait_q); |
820 | out_err: | 821 | out_err: |
821 | if (atomic_dec_and_test(&ccw_device_init_count)) | 822 | if (adjust_init_count && atomic_dec_and_test(&ccw_device_init_count)) |
822 | wake_up(&ccw_device_init_wq); | 823 | wake_up(&ccw_device_init_wq); |
823 | } | 824 | } |
824 | 825 | ||
diff --git a/drivers/s390/cio/qdio_debug.c b/drivers/s390/cio/qdio_debug.c index c94eb2a0fa2e..6ce83f56d537 100644 --- a/drivers/s390/cio/qdio_debug.c +++ b/drivers/s390/cio/qdio_debug.c | |||
@@ -33,7 +33,6 @@ void qdio_allocate_dbf(struct qdio_initialize *init_data, | |||
33 | DBF_HEX(&init_data->input_handler, sizeof(void *)); | 33 | DBF_HEX(&init_data->input_handler, sizeof(void *)); |
34 | DBF_HEX(&init_data->output_handler, sizeof(void *)); | 34 | DBF_HEX(&init_data->output_handler, sizeof(void *)); |
35 | DBF_HEX(&init_data->int_parm, sizeof(long)); | 35 | DBF_HEX(&init_data->int_parm, sizeof(long)); |
36 | DBF_HEX(&init_data->flags, sizeof(long)); | ||
37 | DBF_HEX(&init_data->input_sbal_addr_array, sizeof(void *)); | 36 | DBF_HEX(&init_data->input_sbal_addr_array, sizeof(void *)); |
38 | DBF_HEX(&init_data->output_sbal_addr_array, sizeof(void *)); | 37 | DBF_HEX(&init_data->output_sbal_addr_array, sizeof(void *)); |
39 | DBF_EVENT("irq:%8lx", (unsigned long)irq_ptr); | 38 | DBF_EVENT("irq:%8lx", (unsigned long)irq_ptr); |
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c index 232ef047ba34..4f8f74311778 100644 --- a/drivers/s390/cio/qdio_main.c +++ b/drivers/s390/cio/qdio_main.c | |||
@@ -588,10 +588,11 @@ static void qdio_kick_handler(struct qdio_q *q) | |||
588 | if (q->is_input_q) { | 588 | if (q->is_input_q) { |
589 | qperf_inc(q, inbound_handler); | 589 | qperf_inc(q, inbound_handler); |
590 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "kih s:%02x c:%02x", start, count); | 590 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "kih s:%02x c:%02x", start, count); |
591 | } else | 591 | } else { |
592 | qperf_inc(q, outbound_handler); | 592 | qperf_inc(q, outbound_handler); |
593 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "koh: s:%02x c:%02x", | 593 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "koh: s:%02x c:%02x", |
594 | start, count); | 594 | start, count); |
595 | } | ||
595 | 596 | ||
596 | q->handler(q->irq_ptr->cdev, q->qdio_error, q->nr, start, count, | 597 | q->handler(q->irq_ptr->cdev, q->qdio_error, q->nr, start, count, |
597 | q->irq_ptr->int_parm); | 598 | q->irq_ptr->int_parm); |
diff --git a/drivers/s390/net/Kconfig b/drivers/s390/net/Kconfig index cb909a5b5047..977bb4d4ed15 100644 --- a/drivers/s390/net/Kconfig +++ b/drivers/s390/net/Kconfig | |||
@@ -43,6 +43,16 @@ config SMSGIUCV | |||
43 | Select this option if you want to be able to receive SMSG messages | 43 | Select this option if you want to be able to receive SMSG messages |
44 | from other VM guest systems. | 44 | from other VM guest systems. |
45 | 45 | ||
46 | config SMSGIUCV_EVENT | ||
47 | tristate "Deliver IUCV special messages as uevents (VM only)" | ||
48 | depends on SMSGIUCV | ||
49 | help | ||
50 | Select this option to deliver CP special messages (SMSGs) as | ||
51 | uevents. The driver handles only those special messages that | ||
52 | start with "APP". | ||
53 | |||
54 | To compile as a module, choose M. The module name is "smsgiucv_app". | ||
55 | |||
46 | config CLAW | 56 | config CLAW |
47 | tristate "CLAW device support" | 57 | tristate "CLAW device support" |
48 | depends on CCW && NETDEVICES | 58 | depends on CCW && NETDEVICES |
diff --git a/drivers/s390/net/Makefile b/drivers/s390/net/Makefile index 6cab5a62f99e..4dfe8c1092da 100644 --- a/drivers/s390/net/Makefile +++ b/drivers/s390/net/Makefile | |||
@@ -6,6 +6,7 @@ ctcm-y += ctcm_main.o ctcm_fsms.o ctcm_mpc.o ctcm_sysfs.o ctcm_dbug.o | |||
6 | obj-$(CONFIG_CTCM) += ctcm.o fsm.o | 6 | obj-$(CONFIG_CTCM) += ctcm.o fsm.o |
7 | obj-$(CONFIG_NETIUCV) += netiucv.o fsm.o | 7 | obj-$(CONFIG_NETIUCV) += netiucv.o fsm.o |
8 | obj-$(CONFIG_SMSGIUCV) += smsgiucv.o | 8 | obj-$(CONFIG_SMSGIUCV) += smsgiucv.o |
9 | obj-$(CONFIG_SMSGIUCV_EVENT) += smsgiucv_app.o | ||
9 | obj-$(CONFIG_LCS) += lcs.o | 10 | obj-$(CONFIG_LCS) += lcs.o |
10 | obj-$(CONFIG_CLAW) += claw.o | 11 | obj-$(CONFIG_CLAW) += claw.o |
11 | qeth-y += qeth_core_sys.o qeth_core_main.o qeth_core_mpc.o | 12 | qeth-y += qeth_core_sys.o qeth_core_main.o qeth_core_mpc.o |
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index fa8a519218ac..7d25bdd443cd 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -3805,9 +3805,6 @@ static int qeth_qdio_establish(struct qeth_card *card) | |||
3805 | init_data.input_handler = card->discipline.input_handler; | 3805 | init_data.input_handler = card->discipline.input_handler; |
3806 | init_data.output_handler = card->discipline.output_handler; | 3806 | init_data.output_handler = card->discipline.output_handler; |
3807 | init_data.int_parm = (unsigned long) card; | 3807 | init_data.int_parm = (unsigned long) card; |
3808 | init_data.flags = QDIO_INBOUND_0COPY_SBALS | | ||
3809 | QDIO_OUTBOUND_0COPY_SBALS | | ||
3810 | QDIO_USE_OUTBOUND_PCIS; | ||
3811 | init_data.input_sbal_addr_array = (void **) in_sbal_ptrs; | 3808 | init_data.input_sbal_addr_array = (void **) in_sbal_ptrs; |
3812 | init_data.output_sbal_addr_array = (void **) out_sbal_ptrs; | 3809 | init_data.output_sbal_addr_array = (void **) out_sbal_ptrs; |
3813 | 3810 | ||
diff --git a/drivers/s390/net/smsgiucv.c b/drivers/s390/net/smsgiucv.c index 67f2485d2372..ecef1edee701 100644 --- a/drivers/s390/net/smsgiucv.c +++ b/drivers/s390/net/smsgiucv.c | |||
@@ -31,9 +31,9 @@ | |||
31 | 31 | ||
32 | struct smsg_callback { | 32 | struct smsg_callback { |
33 | struct list_head list; | 33 | struct list_head list; |
34 | char *prefix; | 34 | const char *prefix; |
35 | int len; | 35 | int len; |
36 | void (*callback)(char *from, char *str); | 36 | void (*callback)(const char *from, char *str); |
37 | }; | 37 | }; |
38 | 38 | ||
39 | MODULE_AUTHOR | 39 | MODULE_AUTHOR |
@@ -100,8 +100,8 @@ static void smsg_message_pending(struct iucv_path *path, | |||
100 | kfree(buffer); | 100 | kfree(buffer); |
101 | } | 101 | } |
102 | 102 | ||
103 | int smsg_register_callback(char *prefix, | 103 | int smsg_register_callback(const char *prefix, |
104 | void (*callback)(char *from, char *str)) | 104 | void (*callback)(const char *from, char *str)) |
105 | { | 105 | { |
106 | struct smsg_callback *cb; | 106 | struct smsg_callback *cb; |
107 | 107 | ||
@@ -117,8 +117,9 @@ int smsg_register_callback(char *prefix, | |||
117 | return 0; | 117 | return 0; |
118 | } | 118 | } |
119 | 119 | ||
120 | void smsg_unregister_callback(char *prefix, | 120 | void smsg_unregister_callback(const char *prefix, |
121 | void (*callback)(char *from, char *str)) | 121 | void (*callback)(const char *from, |
122 | char *str)) | ||
122 | { | 123 | { |
123 | struct smsg_callback *cb, *tmp; | 124 | struct smsg_callback *cb, *tmp; |
124 | 125 | ||
@@ -176,7 +177,7 @@ static const struct dev_pm_ops smsg_pm_ops = { | |||
176 | 177 | ||
177 | static struct device_driver smsg_driver = { | 178 | static struct device_driver smsg_driver = { |
178 | .owner = THIS_MODULE, | 179 | .owner = THIS_MODULE, |
179 | .name = "SMSGIUCV", | 180 | .name = SMSGIUCV_DRV_NAME, |
180 | .bus = &iucv_bus, | 181 | .bus = &iucv_bus, |
181 | .pm = &smsg_pm_ops, | 182 | .pm = &smsg_pm_ops, |
182 | }; | 183 | }; |
diff --git a/drivers/s390/net/smsgiucv.h b/drivers/s390/net/smsgiucv.h index 67f5d4f8378d..149a1151608d 100644 --- a/drivers/s390/net/smsgiucv.h +++ b/drivers/s390/net/smsgiucv.h | |||
@@ -5,6 +5,10 @@ | |||
5 | * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) | 5 | * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) |
6 | */ | 6 | */ |
7 | 7 | ||
8 | int smsg_register_callback(char *, void (*)(char *, char *)); | 8 | #define SMSGIUCV_DRV_NAME "SMSGIUCV" |
9 | void smsg_unregister_callback(char *, void (*)(char *, char *)); | 9 | |
10 | int smsg_register_callback(const char *, | ||
11 | void (*)(const char *, char *)); | ||
12 | void smsg_unregister_callback(const char *, | ||
13 | void (*)(const char *, char *)); | ||
10 | 14 | ||
diff --git a/drivers/s390/net/smsgiucv_app.c b/drivers/s390/net/smsgiucv_app.c new file mode 100644 index 000000000000..91579dc6a2b0 --- /dev/null +++ b/drivers/s390/net/smsgiucv_app.c | |||
@@ -0,0 +1,211 @@ | |||
1 | /* | ||
2 | * Deliver z/VM CP special messages (SMSG) as uevents. | ||
3 | * | ||
4 | * The driver registers for z/VM CP special messages with the | ||
5 | * "APP" prefix. Incoming messages are delivered to user space | ||
6 | * as uevents. | ||
7 | * | ||
8 | * Copyright IBM Corp. 2010 | ||
9 | * Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com> | ||
10 | * | ||
11 | */ | ||
12 | #define KMSG_COMPONENT "smsgiucv_app" | ||
13 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt | ||
14 | |||
15 | #include <linux/ctype.h> | ||
16 | #include <linux/err.h> | ||
17 | #include <linux/device.h> | ||
18 | #include <linux/list.h> | ||
19 | #include <linux/kobject.h> | ||
20 | #include <linux/module.h> | ||
21 | #include <linux/spinlock.h> | ||
22 | #include <linux/workqueue.h> | ||
23 | #include <net/iucv/iucv.h> | ||
24 | #include "smsgiucv.h" | ||
25 | |||
26 | /* prefix used for SMSG registration */ | ||
27 | #define SMSG_PREFIX "APP" | ||
28 | |||
29 | /* SMSG related uevent environment variables */ | ||
30 | #define ENV_SENDER_STR "SMSG_SENDER=" | ||
31 | #define ENV_SENDER_LEN (strlen(ENV_SENDER_STR) + 8 + 1) | ||
32 | #define ENV_PREFIX_STR "SMSG_ID=" | ||
33 | #define ENV_PREFIX_LEN (strlen(ENV_PREFIX_STR) + \ | ||
34 | strlen(SMSG_PREFIX) + 1) | ||
35 | #define ENV_TEXT_STR "SMSG_TEXT=" | ||
36 | #define ENV_TEXT_LEN(msg) (strlen(ENV_TEXT_STR) + strlen((msg)) + 1) | ||
37 | |||
38 | /* z/VM user ID which is permitted to send SMSGs | ||
39 | * If the value is undefined or empty (""), special messages are | ||
40 | * accepted from any z/VM user ID. */ | ||
41 | static char *sender; | ||
42 | module_param(sender, charp, 0400); | ||
43 | MODULE_PARM_DESC(sender, "z/VM user ID from which CP SMSGs are accepted"); | ||
44 | |||
45 | /* SMSG device representation */ | ||
46 | static struct device *smsg_app_dev; | ||
47 | |||
48 | /* list element for queuing received messages for delivery */ | ||
49 | struct smsg_app_event { | ||
50 | struct list_head list; | ||
51 | char *buf; | ||
52 | char *envp[4]; | ||
53 | }; | ||
54 | |||
55 | /* queue for outgoing uevents */ | ||
56 | static LIST_HEAD(smsg_event_queue); | ||
57 | static DEFINE_SPINLOCK(smsg_event_queue_lock); | ||
58 | |||
59 | static void smsg_app_event_free(struct smsg_app_event *ev) | ||
60 | { | ||
61 | kfree(ev->buf); | ||
62 | kfree(ev); | ||
63 | } | ||
64 | |||
65 | static struct smsg_app_event *smsg_app_event_alloc(const char *from, | ||
66 | const char *msg) | ||
67 | { | ||
68 | struct smsg_app_event *ev; | ||
69 | |||
70 | ev = kzalloc(sizeof(*ev), GFP_ATOMIC); | ||
71 | if (!ev) | ||
72 | return NULL; | ||
73 | |||
74 | ev->buf = kzalloc(ENV_SENDER_LEN + ENV_PREFIX_LEN + | ||
75 | ENV_TEXT_LEN(msg), GFP_ATOMIC); | ||
76 | if (!ev->buf) { | ||
77 | kfree(ev); | ||
78 | return NULL; | ||
79 | } | ||
80 | |||
81 | /* setting up environment pointers into buf */ | ||
82 | ev->envp[0] = ev->buf; | ||
83 | ev->envp[1] = ev->envp[0] + ENV_SENDER_LEN; | ||
84 | ev->envp[2] = ev->envp[1] + ENV_PREFIX_LEN; | ||
85 | ev->envp[3] = NULL; | ||
86 | |||
87 | /* setting up environment: sender, prefix name, and message text */ | ||
88 | snprintf(ev->envp[0], ENV_SENDER_LEN, ENV_SENDER_STR "%s", from); | ||
89 | snprintf(ev->envp[1], ENV_PREFIX_LEN, ENV_PREFIX_STR "%s", SMSG_PREFIX); | ||
90 | snprintf(ev->envp[2], ENV_TEXT_LEN(msg), ENV_TEXT_STR "%s", msg); | ||
91 | |||
92 | return ev; | ||
93 | } | ||
94 | |||
95 | static void smsg_event_work_fn(struct work_struct *work) | ||
96 | { | ||
97 | LIST_HEAD(event_queue); | ||
98 | struct smsg_app_event *p, *n; | ||
99 | struct device *dev; | ||
100 | |||
101 | dev = get_device(smsg_app_dev); | ||
102 | if (!dev) | ||
103 | return; | ||
104 | |||
105 | spin_lock_bh(&smsg_event_queue_lock); | ||
106 | list_splice_init(&smsg_event_queue, &event_queue); | ||
107 | spin_unlock_bh(&smsg_event_queue_lock); | ||
108 | |||
109 | list_for_each_entry_safe(p, n, &event_queue, list) { | ||
110 | list_del(&p->list); | ||
111 | kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, p->envp); | ||
112 | smsg_app_event_free(p); | ||
113 | } | ||
114 | |||
115 | put_device(dev); | ||
116 | } | ||
117 | static DECLARE_WORK(smsg_event_work, smsg_event_work_fn); | ||
118 | |||
119 | static void smsg_app_callback(const char *from, char *msg) | ||
120 | { | ||
121 | struct smsg_app_event *se; | ||
122 | |||
123 | /* check if the originating z/VM user ID matches | ||
124 | * the configured sender. */ | ||
125 | if (sender && strlen(sender) > 0 && strcmp(from, sender) != 0) | ||
126 | return; | ||
127 | |||
128 | /* get start of message text (skip prefix and leading blanks) */ | ||
129 | msg += strlen(SMSG_PREFIX); | ||
130 | while (*msg && isspace(*msg)) | ||
131 | msg++; | ||
132 | if (*msg == '\0') | ||
133 | return; | ||
134 | |||
135 | /* allocate event list element and its environment */ | ||
136 | se = smsg_app_event_alloc(from, msg); | ||
137 | if (!se) | ||
138 | return; | ||
139 | |||
140 | /* queue event and schedule work function */ | ||
141 | spin_lock(&smsg_event_queue_lock); | ||
142 | list_add_tail(&se->list, &smsg_event_queue); | ||
143 | spin_unlock(&smsg_event_queue_lock); | ||
144 | |||
145 | schedule_work(&smsg_event_work); | ||
146 | return; | ||
147 | } | ||
148 | |||
149 | static int __init smsgiucv_app_init(void) | ||
150 | { | ||
151 | struct device_driver *smsgiucv_drv; | ||
152 | int rc; | ||
153 | |||
154 | if (!MACHINE_IS_VM) | ||
155 | return -ENODEV; | ||
156 | |||
157 | smsg_app_dev = kzalloc(sizeof(*smsg_app_dev), GFP_KERNEL); | ||
158 | if (!smsg_app_dev) | ||
159 | return -ENOMEM; | ||
160 | |||
161 | smsgiucv_drv = driver_find(SMSGIUCV_DRV_NAME, &iucv_bus); | ||
162 | if (!smsgiucv_drv) { | ||
163 | kfree(smsg_app_dev); | ||
164 | return -ENODEV; | ||
165 | } | ||
166 | |||
167 | rc = dev_set_name(smsg_app_dev, KMSG_COMPONENT); | ||
168 | if (rc) { | ||
169 | kfree(smsg_app_dev); | ||
170 | goto fail_put_driver; | ||
171 | } | ||
172 | smsg_app_dev->bus = &iucv_bus; | ||
173 | smsg_app_dev->parent = iucv_root; | ||
174 | smsg_app_dev->release = (void (*)(struct device *)) kfree; | ||
175 | smsg_app_dev->driver = smsgiucv_drv; | ||
176 | rc = device_register(smsg_app_dev); | ||
177 | if (rc) { | ||
178 | put_device(smsg_app_dev); | ||
179 | goto fail_put_driver; | ||
180 | } | ||
181 | |||
182 | /* register with the smsgiucv device driver */ | ||
183 | rc = smsg_register_callback(SMSG_PREFIX, smsg_app_callback); | ||
184 | if (rc) { | ||
185 | device_unregister(smsg_app_dev); | ||
186 | goto fail_put_driver; | ||
187 | } | ||
188 | |||
189 | rc = 0; | ||
190 | fail_put_driver: | ||
191 | put_driver(smsgiucv_drv); | ||
192 | return rc; | ||
193 | } | ||
194 | module_init(smsgiucv_app_init); | ||
195 | |||
196 | static void __exit smsgiucv_app_exit(void) | ||
197 | { | ||
198 | /* unregister callback */ | ||
199 | smsg_unregister_callback(SMSG_PREFIX, smsg_app_callback); | ||
200 | |||
201 | /* cancel pending work and flush any queued event work */ | ||
202 | cancel_work_sync(&smsg_event_work); | ||
203 | smsg_event_work_fn(&smsg_event_work); | ||
204 | |||
205 | device_unregister(smsg_app_dev); | ||
206 | } | ||
207 | module_exit(smsgiucv_app_exit); | ||
208 | |||
209 | MODULE_LICENSE("GPL v2"); | ||
210 | MODULE_DESCRIPTION("Deliver z/VM CP SMSG as uevents"); | ||
211 | MODULE_AUTHOR("Hendrik Brueckner <brueckner@linux.vnet.ibm.com>"); | ||
diff --git a/drivers/s390/scsi/zfcp_qdio.c b/drivers/s390/scsi/zfcp_qdio.c index 71b97ff77cf0..6479273a3094 100644 --- a/drivers/s390/scsi/zfcp_qdio.c +++ b/drivers/s390/scsi/zfcp_qdio.c | |||
@@ -319,8 +319,6 @@ static void zfcp_qdio_setup_init_data(struct qdio_initialize *id, | |||
319 | id->input_handler = zfcp_qdio_int_resp; | 319 | id->input_handler = zfcp_qdio_int_resp; |
320 | id->output_handler = zfcp_qdio_int_req; | 320 | id->output_handler = zfcp_qdio_int_req; |
321 | id->int_parm = (unsigned long) qdio; | 321 | id->int_parm = (unsigned long) qdio; |
322 | id->flags = QDIO_INBOUND_0COPY_SBALS | | ||
323 | QDIO_OUTBOUND_0COPY_SBALS | QDIO_USE_OUTBOUND_PCIS; | ||
324 | id->input_sbal_addr_array = (void **) (qdio->resp_q.sbal); | 322 | id->input_sbal_addr_array = (void **) (qdio->resp_q.sbal); |
325 | id->output_sbal_addr_array = (void **) (qdio->req_q.sbal); | 323 | id->output_sbal_addr_array = (void **) (qdio->req_q.sbal); |
326 | 324 | ||
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/watchdog/Kconfig b/drivers/watchdog/Kconfig index 3da3f48720a7..bdcdbd53da89 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -55,6 +55,11 @@ config SOFT_WATCHDOG | |||
55 | To compile this driver as a module, choose M here: the | 55 | To compile this driver as a module, choose M here: the |
56 | module will be called softdog. | 56 | module will be called softdog. |
57 | 57 | ||
58 | config MAX63XX_WATCHDOG | ||
59 | tristate "Max63xx watchdog" | ||
60 | help | ||
61 | Support for memory mapped max63{69,70,71,72,73,74} watchdog timer. | ||
62 | |||
58 | config WM831X_WATCHDOG | 63 | config WM831X_WATCHDOG |
59 | tristate "WM831x watchdog" | 64 | tristate "WM831x watchdog" |
60 | depends on MFD_WM831X | 65 | depends on MFD_WM831X |
@@ -289,6 +294,17 @@ config ADX_WATCHDOG | |||
289 | Say Y here if you want support for the watchdog timer on Avionic | 294 | Say Y here if you want support for the watchdog timer on Avionic |
290 | Design Xanthos boards. | 295 | Design Xanthos boards. |
291 | 296 | ||
297 | config TS72XX_WATCHDOG | ||
298 | tristate "TS-72XX SBC Watchdog" | ||
299 | depends on MACH_TS72XX | ||
300 | help | ||
301 | Technologic Systems TS-7200, TS-7250 and TS-7260 boards have | ||
302 | watchdog timer implemented in a external CPLD chip. Say Y here | ||
303 | if you want to support for the watchdog timer on TS-72XX boards. | ||
304 | |||
305 | To compile this driver as a module, choose M here: the | ||
306 | module will be called ts72xx_wdt. | ||
307 | |||
292 | # AVR32 Architecture | 308 | # AVR32 Architecture |
293 | 309 | ||
294 | config AT32AP700X_WDT | 310 | config AT32AP700X_WDT |
@@ -845,10 +861,10 @@ config TXX9_WDT | |||
845 | # POWERPC Architecture | 861 | # POWERPC Architecture |
846 | 862 | ||
847 | config GEF_WDT | 863 | config GEF_WDT |
848 | tristate "GE Fanuc Watchdog Timer" | 864 | tristate "GE Watchdog Timer" |
849 | depends on GEF_SBC610 || GEF_SBC310 || GEF_PPC9A | 865 | depends on GEF_SBC610 || GEF_SBC310 || GEF_PPC9A |
850 | ---help--- | 866 | ---help--- |
851 | Watchdog timer found in a number of GE Fanuc single board computers. | 867 | Watchdog timer found in a number of GE single board computers. |
852 | 868 | ||
853 | config MPC5200_WDT | 869 | config MPC5200_WDT |
854 | bool "MPC52xx Watchdog Timer" | 870 | bool "MPC52xx Watchdog Timer" |
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 475c61100069..5e3cb95bb0e9 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile | |||
@@ -46,6 +46,7 @@ obj-$(CONFIG_COH901327_WATCHDOG) += coh901327_wdt.o | |||
46 | obj-$(CONFIG_STMP3XXX_WATCHDOG) += stmp3xxx_wdt.o | 46 | obj-$(CONFIG_STMP3XXX_WATCHDOG) += stmp3xxx_wdt.o |
47 | obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o | 47 | obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o |
48 | obj-$(CONFIG_ADX_WATCHDOG) += adx_wdt.o | 48 | obj-$(CONFIG_ADX_WATCHDOG) += adx_wdt.o |
49 | obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o | ||
49 | 50 | ||
50 | # AVR32 Architecture | 51 | # AVR32 Architecture |
51 | obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o | 52 | obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o |
@@ -142,4 +143,5 @@ obj-$(CONFIG_WATCHDOG_CP1XXX) += cpwd.o | |||
142 | # Architecture Independant | 143 | # Architecture Independant |
143 | obj-$(CONFIG_WM831X_WATCHDOG) += wm831x_wdt.o | 144 | obj-$(CONFIG_WM831X_WATCHDOG) += wm831x_wdt.o |
144 | obj-$(CONFIG_WM8350_WATCHDOG) += wm8350_wdt.o | 145 | obj-$(CONFIG_WM8350_WATCHDOG) += wm8350_wdt.o |
146 | obj-$(CONFIG_MAX63XX_WATCHDOG) += max63xx_wdt.o | ||
145 | obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o | 147 | obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o |
diff --git a/drivers/watchdog/acquirewdt.c b/drivers/watchdog/acquirewdt.c index 4d18c874d963..2ffce4d75443 100644 --- a/drivers/watchdog/acquirewdt.c +++ b/drivers/watchdog/acquirewdt.c | |||
@@ -150,7 +150,7 @@ static long acq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
150 | int options, retval = -EINVAL; | 150 | int options, retval = -EINVAL; |
151 | void __user *argp = (void __user *)arg; | 151 | void __user *argp = (void __user *)arg; |
152 | int __user *p = argp; | 152 | int __user *p = argp; |
153 | static struct watchdog_info ident = { | 153 | static const struct watchdog_info ident = { |
154 | .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, | 154 | .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, |
155 | .firmware_version = 1, | 155 | .firmware_version = 1, |
156 | .identity = WATCHDOG_NAME, | 156 | .identity = WATCHDOG_NAME, |
diff --git a/drivers/watchdog/advantechwdt.c b/drivers/watchdog/advantechwdt.c index 824d076a5cd6..4d40965d2c9f 100644 --- a/drivers/watchdog/advantechwdt.c +++ b/drivers/watchdog/advantechwdt.c | |||
@@ -137,7 +137,7 @@ static long advwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
137 | int new_timeout; | 137 | int new_timeout; |
138 | void __user *argp = (void __user *)arg; | 138 | void __user *argp = (void __user *)arg; |
139 | int __user *p = argp; | 139 | int __user *p = argp; |
140 | static struct watchdog_info ident = { | 140 | static const struct watchdog_info ident = { |
141 | .options = WDIOF_KEEPALIVEPING | | 141 | .options = WDIOF_KEEPALIVEPING | |
142 | WDIOF_SETTIMEOUT | | 142 | WDIOF_SETTIMEOUT | |
143 | WDIOF_MAGICCLOSE, | 143 | WDIOF_MAGICCLOSE, |
diff --git a/drivers/watchdog/adx_wdt.c b/drivers/watchdog/adx_wdt.c index 9d7d155364f8..a5ca7a6ee133 100644 --- a/drivers/watchdog/adx_wdt.c +++ b/drivers/watchdog/adx_wdt.c | |||
@@ -37,7 +37,7 @@ struct adx_wdt { | |||
37 | spinlock_t lock; | 37 | spinlock_t lock; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | static struct watchdog_info adx_wdt_info = { | 40 | static const struct watchdog_info adx_wdt_info = { |
41 | .identity = "Avionic Design Xanthos Watchdog", | 41 | .identity = "Avionic Design Xanthos Watchdog", |
42 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, | 42 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, |
43 | }; | 43 | }; |
diff --git a/drivers/watchdog/alim1535_wdt.c b/drivers/watchdog/alim1535_wdt.c index 937a80fb61e1..1e9caea8ff8a 100644 --- a/drivers/watchdog/alim1535_wdt.c +++ b/drivers/watchdog/alim1535_wdt.c | |||
@@ -180,7 +180,7 @@ static long ali_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
180 | { | 180 | { |
181 | void __user *argp = (void __user *)arg; | 181 | void __user *argp = (void __user *)arg; |
182 | int __user *p = argp; | 182 | int __user *p = argp; |
183 | static struct watchdog_info ident = { | 183 | static const struct watchdog_info ident = { |
184 | .options = WDIOF_KEEPALIVEPING | | 184 | .options = WDIOF_KEEPALIVEPING | |
185 | WDIOF_SETTIMEOUT | | 185 | WDIOF_SETTIMEOUT | |
186 | WDIOF_MAGICCLOSE, | 186 | WDIOF_MAGICCLOSE, |
diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c index f90afdb1b255..d8d4da9a483d 100644 --- a/drivers/watchdog/alim7101_wdt.c +++ b/drivers/watchdog/alim7101_wdt.c | |||
@@ -238,7 +238,7 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
238 | { | 238 | { |
239 | void __user *argp = (void __user *)arg; | 239 | void __user *argp = (void __user *)arg; |
240 | int __user *p = argp; | 240 | int __user *p = argp; |
241 | static struct watchdog_info ident = { | 241 | static const struct watchdog_info ident = { |
242 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | 242 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
243 | | WDIOF_MAGICCLOSE, | 243 | | WDIOF_MAGICCLOSE, |
244 | .firmware_version = 1, | 244 | .firmware_version = 1, |
diff --git a/drivers/watchdog/ar7_wdt.c b/drivers/watchdog/ar7_wdt.c index 2bb95cd308c1..c764c52412e4 100644 --- a/drivers/watchdog/ar7_wdt.c +++ b/drivers/watchdog/ar7_wdt.c | |||
@@ -219,7 +219,7 @@ static ssize_t ar7_wdt_write(struct file *file, const char *data, | |||
219 | static long ar7_wdt_ioctl(struct file *file, | 219 | static long ar7_wdt_ioctl(struct file *file, |
220 | unsigned int cmd, unsigned long arg) | 220 | unsigned int cmd, unsigned long arg) |
221 | { | 221 | { |
222 | static struct watchdog_info ident = { | 222 | static const struct watchdog_info ident = { |
223 | .identity = LONGNAME, | 223 | .identity = LONGNAME, |
224 | .firmware_version = 1, | 224 | .firmware_version = 1, |
225 | .options = (WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | | 225 | .options = (WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | |
diff --git a/drivers/watchdog/at32ap700x_wdt.c b/drivers/watchdog/at32ap700x_wdt.c index 037847923dcb..6873376f986c 100644 --- a/drivers/watchdog/at32ap700x_wdt.c +++ b/drivers/watchdog/at32ap700x_wdt.c | |||
@@ -202,7 +202,7 @@ static int at32_wdt_get_status(void) | |||
202 | return status; | 202 | return status; |
203 | } | 203 | } |
204 | 204 | ||
205 | static struct watchdog_info at32_wdt_info = { | 205 | static const struct watchdog_info at32_wdt_info = { |
206 | .identity = "at32ap700x watchdog", | 206 | .identity = "at32ap700x watchdog", |
207 | .options = WDIOF_SETTIMEOUT | | 207 | .options = WDIOF_SETTIMEOUT | |
208 | WDIOF_KEEPALIVEPING | | 208 | WDIOF_KEEPALIVEPING | |
diff --git a/drivers/watchdog/at91rm9200_wdt.c b/drivers/watchdog/at91rm9200_wdt.c index b185dafe1494..b3046dc4b56c 100644 --- a/drivers/watchdog/at91rm9200_wdt.c +++ b/drivers/watchdog/at91rm9200_wdt.c | |||
@@ -121,7 +121,7 @@ static int at91_wdt_settimeout(int new_time) | |||
121 | return 0; | 121 | return 0; |
122 | } | 122 | } |
123 | 123 | ||
124 | static struct watchdog_info at91_wdt_info = { | 124 | static const struct watchdog_info at91_wdt_info = { |
125 | .identity = "at91 watchdog", | 125 | .identity = "at91 watchdog", |
126 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, | 126 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, |
127 | }; | 127 | }; |
diff --git a/drivers/watchdog/bcm47xx_wdt.c b/drivers/watchdog/bcm47xx_wdt.c index 751c003864ad..5f245522397b 100644 --- a/drivers/watchdog/bcm47xx_wdt.c +++ b/drivers/watchdog/bcm47xx_wdt.c | |||
@@ -149,7 +149,7 @@ static ssize_t bcm47xx_wdt_write(struct file *file, const char __user *data, | |||
149 | return len; | 149 | return len; |
150 | } | 150 | } |
151 | 151 | ||
152 | static struct watchdog_info bcm47xx_wdt_info = { | 152 | static const struct watchdog_info bcm47xx_wdt_info = { |
153 | .identity = DRV_NAME, | 153 | .identity = DRV_NAME, |
154 | .options = WDIOF_SETTIMEOUT | | 154 | .options = WDIOF_SETTIMEOUT | |
155 | WDIOF_KEEPALIVEPING | | 155 | WDIOF_KEEPALIVEPING | |
diff --git a/drivers/watchdog/bfin_wdt.c b/drivers/watchdog/bfin_wdt.c index 2159e668751c..9c7ccd1e9088 100644 --- a/drivers/watchdog/bfin_wdt.c +++ b/drivers/watchdog/bfin_wdt.c | |||
@@ -19,8 +19,6 @@ | |||
19 | #include <linux/miscdevice.h> | 19 | #include <linux/miscdevice.h> |
20 | #include <linux/watchdog.h> | 20 | #include <linux/watchdog.h> |
21 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
22 | #include <linux/notifier.h> | ||
23 | #include <linux/reboot.h> | ||
24 | #include <linux/init.h> | 22 | #include <linux/init.h> |
25 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
26 | #include <linux/uaccess.h> | 24 | #include <linux/uaccess.h> |
@@ -74,7 +72,7 @@ | |||
74 | 72 | ||
75 | static unsigned int timeout = WATCHDOG_TIMEOUT; | 73 | static unsigned int timeout = WATCHDOG_TIMEOUT; |
76 | static int nowayout = WATCHDOG_NOWAYOUT; | 74 | static int nowayout = WATCHDOG_NOWAYOUT; |
77 | static struct watchdog_info bfin_wdt_info; | 75 | static const struct watchdog_info bfin_wdt_info; |
78 | static unsigned long open_check; | 76 | static unsigned long open_check; |
79 | static char expect_close; | 77 | static char expect_close; |
80 | static DEFINE_SPINLOCK(bfin_wdt_spinlock); | 78 | static DEFINE_SPINLOCK(bfin_wdt_spinlock); |
@@ -309,26 +307,6 @@ static long bfin_wdt_ioctl(struct file *file, | |||
309 | } | 307 | } |
310 | } | 308 | } |
311 | 309 | ||
312 | /** | ||
313 | * bfin_wdt_notify_sys - Notifier Handler | ||
314 | * @this: notifier block | ||
315 | * @code: notifier event | ||
316 | * @unused: unused | ||
317 | * | ||
318 | * Handles specific events, such as turning off the watchdog during a | ||
319 | * shutdown event. | ||
320 | */ | ||
321 | static int bfin_wdt_notify_sys(struct notifier_block *this, | ||
322 | unsigned long code, void *unused) | ||
323 | { | ||
324 | stampit(); | ||
325 | |||
326 | if (code == SYS_DOWN || code == SYS_HALT) | ||
327 | bfin_wdt_stop(); | ||
328 | |||
329 | return NOTIFY_DONE; | ||
330 | } | ||
331 | |||
332 | #ifdef CONFIG_PM | 310 | #ifdef CONFIG_PM |
333 | static int state_before_suspend; | 311 | static int state_before_suspend; |
334 | 312 | ||
@@ -388,40 +366,28 @@ static struct miscdevice bfin_wdt_miscdev = { | |||
388 | .fops = &bfin_wdt_fops, | 366 | .fops = &bfin_wdt_fops, |
389 | }; | 367 | }; |
390 | 368 | ||
391 | static struct watchdog_info bfin_wdt_info = { | 369 | static const struct watchdog_info bfin_wdt_info = { |
392 | .identity = "Blackfin Watchdog", | 370 | .identity = "Blackfin Watchdog", |
393 | .options = WDIOF_SETTIMEOUT | | 371 | .options = WDIOF_SETTIMEOUT | |
394 | WDIOF_KEEPALIVEPING | | 372 | WDIOF_KEEPALIVEPING | |
395 | WDIOF_MAGICCLOSE, | 373 | WDIOF_MAGICCLOSE, |
396 | }; | 374 | }; |
397 | 375 | ||
398 | static struct notifier_block bfin_wdt_notifier = { | ||
399 | .notifier_call = bfin_wdt_notify_sys, | ||
400 | }; | ||
401 | |||
402 | /** | 376 | /** |
403 | * bfin_wdt_probe - Initialize module | 377 | * bfin_wdt_probe - Initialize module |
404 | * | 378 | * |
405 | * Registers the misc device and notifier handler. Actual device | 379 | * Registers the misc device. Actual device |
406 | * initialization is handled by bfin_wdt_open(). | 380 | * initialization is handled by bfin_wdt_open(). |
407 | */ | 381 | */ |
408 | static int __devinit bfin_wdt_probe(struct platform_device *pdev) | 382 | static int __devinit bfin_wdt_probe(struct platform_device *pdev) |
409 | { | 383 | { |
410 | int ret; | 384 | int ret; |
411 | 385 | ||
412 | ret = register_reboot_notifier(&bfin_wdt_notifier); | ||
413 | if (ret) { | ||
414 | pr_devinit(KERN_ERR PFX | ||
415 | "cannot register reboot notifier (err=%d)\n", ret); | ||
416 | return ret; | ||
417 | } | ||
418 | |||
419 | ret = misc_register(&bfin_wdt_miscdev); | 386 | ret = misc_register(&bfin_wdt_miscdev); |
420 | if (ret) { | 387 | if (ret) { |
421 | pr_devinit(KERN_ERR PFX | 388 | pr_devinit(KERN_ERR PFX |
422 | "cannot register miscdev on minor=%d (err=%d)\n", | 389 | "cannot register miscdev on minor=%d (err=%d)\n", |
423 | WATCHDOG_MINOR, ret); | 390 | WATCHDOG_MINOR, ret); |
424 | unregister_reboot_notifier(&bfin_wdt_notifier); | ||
425 | return ret; | 391 | return ret; |
426 | } | 392 | } |
427 | 393 | ||
@@ -434,21 +400,33 @@ static int __devinit bfin_wdt_probe(struct platform_device *pdev) | |||
434 | /** | 400 | /** |
435 | * bfin_wdt_remove - Initialize module | 401 | * bfin_wdt_remove - Initialize module |
436 | * | 402 | * |
437 | * Unregisters the misc device and notifier handler. Actual device | 403 | * Unregisters the misc device. Actual device |
438 | * deinitialization is handled by bfin_wdt_close(). | 404 | * deinitialization is handled by bfin_wdt_close(). |
439 | */ | 405 | */ |
440 | static int __devexit bfin_wdt_remove(struct platform_device *pdev) | 406 | static int __devexit bfin_wdt_remove(struct platform_device *pdev) |
441 | { | 407 | { |
442 | misc_deregister(&bfin_wdt_miscdev); | 408 | misc_deregister(&bfin_wdt_miscdev); |
443 | unregister_reboot_notifier(&bfin_wdt_notifier); | ||
444 | return 0; | 409 | return 0; |
445 | } | 410 | } |
446 | 411 | ||
412 | /** | ||
413 | * bfin_wdt_shutdown - Soft Shutdown Handler | ||
414 | * | ||
415 | * Handles the soft shutdown event. | ||
416 | */ | ||
417 | static void bfin_wdt_shutdown(struct platform_device *pdev) | ||
418 | { | ||
419 | stampit(); | ||
420 | |||
421 | bfin_wdt_stop(); | ||
422 | } | ||
423 | |||
447 | static struct platform_device *bfin_wdt_device; | 424 | static struct platform_device *bfin_wdt_device; |
448 | 425 | ||
449 | static struct platform_driver bfin_wdt_driver = { | 426 | static struct platform_driver bfin_wdt_driver = { |
450 | .probe = bfin_wdt_probe, | 427 | .probe = bfin_wdt_probe, |
451 | .remove = __devexit_p(bfin_wdt_remove), | 428 | .remove = __devexit_p(bfin_wdt_remove), |
429 | .shutdown = bfin_wdt_shutdown, | ||
452 | .suspend = bfin_wdt_suspend, | 430 | .suspend = bfin_wdt_suspend, |
453 | .resume = bfin_wdt_resume, | 431 | .resume = bfin_wdt_resume, |
454 | .driver = { | 432 | .driver = { |
diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c index e8380ef65c1c..8b724aad6825 100644 --- a/drivers/watchdog/booke_wdt.c +++ b/drivers/watchdog/booke_wdt.c | |||
@@ -121,7 +121,7 @@ static ssize_t booke_wdt_write(struct file *file, const char __user *buf, | |||
121 | return count; | 121 | return count; |
122 | } | 122 | } |
123 | 123 | ||
124 | static struct watchdog_info ident = { | 124 | static const struct watchdog_info ident = { |
125 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, | 125 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, |
126 | .identity = "PowerPC Book-E Watchdog", | 126 | .identity = "PowerPC Book-E Watchdog", |
127 | }; | 127 | }; |
diff --git a/drivers/watchdog/coh901327_wdt.c b/drivers/watchdog/coh901327_wdt.c index 923cc68dba26..9291506b8b23 100644 --- a/drivers/watchdog/coh901327_wdt.c +++ b/drivers/watchdog/coh901327_wdt.c | |||
@@ -257,7 +257,7 @@ static long coh901327_ioctl(struct file *file, unsigned int cmd, | |||
257 | struct watchdog_info __user *ident; | 257 | struct watchdog_info __user *ident; |
258 | int __user *i; | 258 | int __user *i; |
259 | } uarg; | 259 | } uarg; |
260 | static struct watchdog_info ident = { | 260 | static const struct watchdog_info ident = { |
261 | .options = WDIOF_CARDRESET | | 261 | .options = WDIOF_CARDRESET | |
262 | WDIOF_SETTIMEOUT | | 262 | WDIOF_SETTIMEOUT | |
263 | WDIOF_KEEPALIVEPING, | 263 | WDIOF_KEEPALIVEPING, |
diff --git a/drivers/watchdog/cpu5wdt.c b/drivers/watchdog/cpu5wdt.c index 71f6d7eec9a8..edd3475f41db 100644 --- a/drivers/watchdog/cpu5wdt.c +++ b/drivers/watchdog/cpu5wdt.c | |||
@@ -154,7 +154,7 @@ static long cpu5wdt_ioctl(struct file *file, unsigned int cmd, | |||
154 | void __user *argp = (void __user *)arg; | 154 | void __user *argp = (void __user *)arg; |
155 | int __user *p = argp; | 155 | int __user *p = argp; |
156 | unsigned int value; | 156 | unsigned int value; |
157 | static struct watchdog_info ident = { | 157 | static const struct watchdog_info ident = { |
158 | .options = WDIOF_CARDRESET, | 158 | .options = WDIOF_CARDRESET, |
159 | .identity = "CPU5 WDT", | 159 | .identity = "CPU5 WDT", |
160 | }; | 160 | }; |
diff --git a/drivers/watchdog/cpwd.c b/drivers/watchdog/cpwd.c index 081f2955419e..37ea052d4dee 100644 --- a/drivers/watchdog/cpwd.c +++ b/drivers/watchdog/cpwd.c | |||
@@ -403,7 +403,7 @@ static int cpwd_release(struct inode *inode, struct file *file) | |||
403 | 403 | ||
404 | static long cpwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 404 | static long cpwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
405 | { | 405 | { |
406 | static struct watchdog_info info = { | 406 | static const struct watchdog_info info = { |
407 | .options = WDIOF_SETTIMEOUT, | 407 | .options = WDIOF_SETTIMEOUT, |
408 | .firmware_version = 1, | 408 | .firmware_version = 1, |
409 | .identity = DRIVER_NAME, | 409 | .identity = DRIVER_NAME, |
diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c index 887136de1857..56162c87f5d8 100644 --- a/drivers/watchdog/davinci_wdt.c +++ b/drivers/watchdog/davinci_wdt.c | |||
@@ -142,7 +142,7 @@ davinci_wdt_write(struct file *file, const char *data, size_t len, | |||
142 | return len; | 142 | return len; |
143 | } | 143 | } |
144 | 144 | ||
145 | static struct watchdog_info ident = { | 145 | static const struct watchdog_info ident = { |
146 | .options = WDIOF_KEEPALIVEPING, | 146 | .options = WDIOF_KEEPALIVEPING, |
147 | .identity = "DaVinci Watchdog", | 147 | .identity = "DaVinci Watchdog", |
148 | }; | 148 | }; |
diff --git a/drivers/watchdog/ep93xx_wdt.c b/drivers/watchdog/ep93xx_wdt.c index cdd55e0d09f8..88ed54e50f74 100644 --- a/drivers/watchdog/ep93xx_wdt.c +++ b/drivers/watchdog/ep93xx_wdt.c | |||
@@ -131,7 +131,7 @@ ep93xx_wdt_write(struct file *file, const char __user *data, size_t len, | |||
131 | return len; | 131 | return len; |
132 | } | 132 | } |
133 | 133 | ||
134 | static struct watchdog_info ident = { | 134 | static const struct watchdog_info ident = { |
135 | .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE, | 135 | .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE, |
136 | .identity = "EP93xx Watchdog", | 136 | .identity = "EP93xx Watchdog", |
137 | }; | 137 | }; |
diff --git a/drivers/watchdog/eurotechwdt.c b/drivers/watchdog/eurotechwdt.c index 9add3541fb42..d1c4e55b1db0 100644 --- a/drivers/watchdog/eurotechwdt.c +++ b/drivers/watchdog/eurotechwdt.c | |||
@@ -238,7 +238,7 @@ static long eurwdt_ioctl(struct file *file, | |||
238 | { | 238 | { |
239 | void __user *argp = (void __user *)arg; | 239 | void __user *argp = (void __user *)arg; |
240 | int __user *p = argp; | 240 | int __user *p = argp; |
241 | static struct watchdog_info ident = { | 241 | static const struct watchdog_info ident = { |
242 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | 242 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
243 | | WDIOF_MAGICCLOSE, | 243 | | WDIOF_MAGICCLOSE, |
244 | .firmware_version = 1, | 244 | .firmware_version = 1, |
diff --git a/drivers/watchdog/gef_wdt.c b/drivers/watchdog/gef_wdt.c index 734d9806a872..abdbad034a6c 100644 --- a/drivers/watchdog/gef_wdt.c +++ b/drivers/watchdog/gef_wdt.c | |||
@@ -1,9 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * GE Fanuc watchdog userspace interface | 2 | * GE watchdog userspace interface |
3 | * | 3 | * |
4 | * Author: Martyn Welch <martyn.welch@gefanuc.com> | 4 | * Author: Martyn Welch <martyn.welch@ge.com> |
5 | * | 5 | * |
6 | * Copyright 2008 GE Fanuc Intelligent Platforms Embedded Systems, Inc. | 6 | * Copyright 2008 GE Intelligent Platforms Embedded Systems, Inc. |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify it | 8 | * This program is free software; you can redistribute it and/or modify it |
9 | * under the terms of the GNU General Public License as published by the | 9 | * under the terms of the GNU General Public License as published by the |
@@ -161,11 +161,11 @@ static long gef_wdt_ioctl(struct file *file, unsigned int cmd, | |||
161 | int timeout; | 161 | int timeout; |
162 | int options; | 162 | int options; |
163 | void __user *argp = (void __user *)arg; | 163 | void __user *argp = (void __user *)arg; |
164 | static struct watchdog_info info = { | 164 | static const struct watchdog_info info = { |
165 | .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | | 165 | .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | |
166 | WDIOF_KEEPALIVEPING, | 166 | WDIOF_KEEPALIVEPING, |
167 | .firmware_version = 0, | 167 | .firmware_version = 0, |
168 | .identity = "GE Fanuc watchdog", | 168 | .identity = "GE watchdog", |
169 | }; | 169 | }; |
170 | 170 | ||
171 | switch (cmd) { | 171 | switch (cmd) { |
@@ -311,7 +311,7 @@ static struct of_platform_driver gef_wdt_driver = { | |||
311 | 311 | ||
312 | static int __init gef_wdt_init(void) | 312 | static int __init gef_wdt_init(void) |
313 | { | 313 | { |
314 | printk(KERN_INFO "GE Fanuc watchdog driver\n"); | 314 | printk(KERN_INFO "GE watchdog driver\n"); |
315 | return of_register_platform_driver(&gef_wdt_driver); | 315 | return of_register_platform_driver(&gef_wdt_driver); |
316 | } | 316 | } |
317 | 317 | ||
@@ -323,8 +323,8 @@ static void __exit gef_wdt_exit(void) | |||
323 | module_init(gef_wdt_init); | 323 | module_init(gef_wdt_init); |
324 | module_exit(gef_wdt_exit); | 324 | module_exit(gef_wdt_exit); |
325 | 325 | ||
326 | MODULE_AUTHOR("Martyn Welch <martyn.welch@gefanuc.com>"); | 326 | MODULE_AUTHOR("Martyn Welch <martyn.welch@ge.com>"); |
327 | MODULE_DESCRIPTION("GE Fanuc watchdog driver"); | 327 | MODULE_DESCRIPTION("GE watchdog driver"); |
328 | MODULE_LICENSE("GPL"); | 328 | MODULE_LICENSE("GPL"); |
329 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | 329 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); |
330 | MODULE_ALIAS("platform: gef_wdt"); | 330 | MODULE_ALIAS("platform: gef_wdt"); |
diff --git a/drivers/watchdog/geodewdt.c b/drivers/watchdog/geodewdt.c index 38252ff828ca..9b49b125ad5a 100644 --- a/drivers/watchdog/geodewdt.c +++ b/drivers/watchdog/geodewdt.c | |||
@@ -142,7 +142,7 @@ static long geodewdt_ioctl(struct file *file, unsigned int cmd, | |||
142 | int __user *p = argp; | 142 | int __user *p = argp; |
143 | int interval; | 143 | int interval; |
144 | 144 | ||
145 | static struct watchdog_info ident = { | 145 | static const struct watchdog_info ident = { |
146 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | 146 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING |
147 | | WDIOF_MAGICCLOSE, | 147 | | WDIOF_MAGICCLOSE, |
148 | .firmware_version = 1, | 148 | .firmware_version = 1, |
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c index a6c5674c78e6..70c2c24660d0 100644 --- a/drivers/watchdog/hpwdt.c +++ b/drivers/watchdog/hpwdt.c | |||
@@ -554,7 +554,7 @@ static ssize_t hpwdt_write(struct file *file, const char __user *data, | |||
554 | return len; | 554 | return len; |
555 | } | 555 | } |
556 | 556 | ||
557 | static struct watchdog_info ident = { | 557 | static const struct watchdog_info ident = { |
558 | .options = WDIOF_SETTIMEOUT | | 558 | .options = WDIOF_SETTIMEOUT | |
559 | WDIOF_KEEPALIVEPING | | 559 | WDIOF_KEEPALIVEPING | |
560 | WDIOF_MAGICCLOSE, | 560 | WDIOF_MAGICCLOSE, |
diff --git a/drivers/watchdog/i6300esb.c b/drivers/watchdog/i6300esb.c index 7ba0b11ec525..bb9750a03942 100644 --- a/drivers/watchdog/i6300esb.c +++ b/drivers/watchdog/i6300esb.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/mm.h> | 34 | #include <linux/mm.h> |
35 | #include <linux/miscdevice.h> | 35 | #include <linux/miscdevice.h> |
36 | #include <linux/watchdog.h> | 36 | #include <linux/watchdog.h> |
37 | #include <linux/platform_device.h> | ||
38 | #include <linux/init.h> | 37 | #include <linux/init.h> |
39 | #include <linux/pci.h> | 38 | #include <linux/pci.h> |
40 | #include <linux/ioport.h> | 39 | #include <linux/ioport.h> |
@@ -42,7 +41,7 @@ | |||
42 | #include <linux/io.h> | 41 | #include <linux/io.h> |
43 | 42 | ||
44 | /* Module and version information */ | 43 | /* Module and version information */ |
45 | #define ESB_VERSION "0.04" | 44 | #define ESB_VERSION "0.05" |
46 | #define ESB_MODULE_NAME "i6300ESB timer" | 45 | #define ESB_MODULE_NAME "i6300ESB timer" |
47 | #define ESB_DRIVER_NAME ESB_MODULE_NAME ", v" ESB_VERSION | 46 | #define ESB_DRIVER_NAME ESB_MODULE_NAME ", v" ESB_VERSION |
48 | #define PFX ESB_MODULE_NAME ": " | 47 | #define PFX ESB_MODULE_NAME ": " |
@@ -65,7 +64,7 @@ | |||
65 | /* Config register bits */ | 64 | /* Config register bits */ |
66 | #define ESB_WDT_REBOOT (0x01 << 5) /* Enable reboot on timeout */ | 65 | #define ESB_WDT_REBOOT (0x01 << 5) /* Enable reboot on timeout */ |
67 | #define ESB_WDT_FREQ (0x01 << 2) /* Decrement frequency */ | 66 | #define ESB_WDT_FREQ (0x01 << 2) /* Decrement frequency */ |
68 | #define ESB_WDT_INTTYPE (0x11 << 0) /* Interrupt type on timer1 timeout */ | 67 | #define ESB_WDT_INTTYPE (0x03 << 0) /* Interrupt type on timer1 timeout */ |
69 | 68 | ||
70 | /* Reload register bits */ | 69 | /* Reload register bits */ |
71 | #define ESB_WDT_TIMEOUT (0x01 << 9) /* Watchdog timed out */ | 70 | #define ESB_WDT_TIMEOUT (0x01 << 9) /* Watchdog timed out */ |
@@ -82,7 +81,9 @@ static unsigned long timer_alive; | |||
82 | static struct pci_dev *esb_pci; | 81 | static struct pci_dev *esb_pci; |
83 | static unsigned short triggered; /* The status of the watchdog upon boot */ | 82 | static unsigned short triggered; /* The status of the watchdog upon boot */ |
84 | static char esb_expect_close; | 83 | static char esb_expect_close; |
85 | static struct platform_device *esb_platform_device; | 84 | |
85 | /* We can only use 1 card due to the /dev/watchdog restriction */ | ||
86 | static int cards_found; | ||
86 | 87 | ||
87 | /* module parameters */ | 88 | /* module parameters */ |
88 | /* 30 sec default heartbeat (1 < heartbeat < 2*1023) */ | 89 | /* 30 sec default heartbeat (1 < heartbeat < 2*1023) */ |
@@ -111,8 +112,8 @@ MODULE_PARM_DESC(nowayout, | |||
111 | */ | 112 | */ |
112 | static inline void esb_unlock_registers(void) | 113 | static inline void esb_unlock_registers(void) |
113 | { | 114 | { |
114 | writeb(ESB_UNLOCK1, ESB_RELOAD_REG); | 115 | writew(ESB_UNLOCK1, ESB_RELOAD_REG); |
115 | writeb(ESB_UNLOCK2, ESB_RELOAD_REG); | 116 | writew(ESB_UNLOCK2, ESB_RELOAD_REG); |
116 | } | 117 | } |
117 | 118 | ||
118 | static int esb_timer_start(void) | 119 | static int esb_timer_start(void) |
@@ -256,7 +257,7 @@ static long esb_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
256 | int new_heartbeat; | 257 | int new_heartbeat; |
257 | void __user *argp = (void __user *)arg; | 258 | void __user *argp = (void __user *)arg; |
258 | int __user *p = argp; | 259 | int __user *p = argp; |
259 | static struct watchdog_info ident = { | 260 | static const struct watchdog_info ident = { |
260 | .options = WDIOF_SETTIMEOUT | | 261 | .options = WDIOF_SETTIMEOUT | |
261 | WDIOF_KEEPALIVEPING | | 262 | WDIOF_KEEPALIVEPING | |
262 | WDIOF_MAGICCLOSE, | 263 | WDIOF_MAGICCLOSE, |
@@ -332,11 +333,6 @@ static struct miscdevice esb_miscdev = { | |||
332 | 333 | ||
333 | /* | 334 | /* |
334 | * Data for PCI driver interface | 335 | * Data for PCI driver interface |
335 | * | ||
336 | * This data only exists for exporting the supported | ||
337 | * PCI ids via MODULE_DEVICE_TABLE. We do not actually | ||
338 | * register a pci_driver, because someone else might one day | ||
339 | * want to register another driver on the same PCI id. | ||
340 | */ | 336 | */ |
341 | static struct pci_device_id esb_pci_tbl[] = { | 337 | static struct pci_device_id esb_pci_tbl[] = { |
342 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_9), }, | 338 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_9), }, |
@@ -348,29 +344,19 @@ MODULE_DEVICE_TABLE(pci, esb_pci_tbl); | |||
348 | * Init & exit routines | 344 | * Init & exit routines |
349 | */ | 345 | */ |
350 | 346 | ||
351 | static unsigned char __devinit esb_getdevice(void) | 347 | static unsigned char __devinit esb_getdevice(struct pci_dev *pdev) |
352 | { | 348 | { |
353 | /* | 349 | if (pci_enable_device(pdev)) { |
354 | * Find the PCI device | ||
355 | */ | ||
356 | |||
357 | esb_pci = pci_get_device(PCI_VENDOR_ID_INTEL, | ||
358 | PCI_DEVICE_ID_INTEL_ESB_9, NULL); | ||
359 | |||
360 | if (!esb_pci) | ||
361 | return 0; | ||
362 | |||
363 | if (pci_enable_device(esb_pci)) { | ||
364 | printk(KERN_ERR PFX "failed to enable device\n"); | 350 | printk(KERN_ERR PFX "failed to enable device\n"); |
365 | goto err_devput; | 351 | goto err_devput; |
366 | } | 352 | } |
367 | 353 | ||
368 | if (pci_request_region(esb_pci, 0, ESB_MODULE_NAME)) { | 354 | if (pci_request_region(pdev, 0, ESB_MODULE_NAME)) { |
369 | printk(KERN_ERR PFX "failed to request region\n"); | 355 | printk(KERN_ERR PFX "failed to request region\n"); |
370 | goto err_disable; | 356 | goto err_disable; |
371 | } | 357 | } |
372 | 358 | ||
373 | BASEADDR = pci_ioremap_bar(esb_pci, 0); | 359 | BASEADDR = pci_ioremap_bar(pdev, 0); |
374 | if (BASEADDR == NULL) { | 360 | if (BASEADDR == NULL) { |
375 | /* Something's wrong here, BASEADDR has to be set */ | 361 | /* Something's wrong here, BASEADDR has to be set */ |
376 | printk(KERN_ERR PFX "failed to get BASEADDR\n"); | 362 | printk(KERN_ERR PFX "failed to get BASEADDR\n"); |
@@ -378,14 +364,14 @@ static unsigned char __devinit esb_getdevice(void) | |||
378 | } | 364 | } |
379 | 365 | ||
380 | /* Done */ | 366 | /* Done */ |
367 | esb_pci = pdev; | ||
381 | return 1; | 368 | return 1; |
382 | 369 | ||
383 | err_release: | 370 | err_release: |
384 | pci_release_region(esb_pci, 0); | 371 | pci_release_region(pdev, 0); |
385 | err_disable: | 372 | err_disable: |
386 | pci_disable_device(esb_pci); | 373 | pci_disable_device(pdev); |
387 | err_devput: | 374 | err_devput: |
388 | pci_dev_put(esb_pci); | ||
389 | return 0; | 375 | return 0; |
390 | } | 376 | } |
391 | 377 | ||
@@ -430,12 +416,23 @@ static void __devinit esb_initdevice(void) | |||
430 | esb_timer_set_heartbeat(heartbeat); | 416 | esb_timer_set_heartbeat(heartbeat); |
431 | } | 417 | } |
432 | 418 | ||
433 | static int __devinit esb_probe(struct platform_device *dev) | 419 | static int __devinit esb_probe(struct pci_dev *pdev, |
420 | const struct pci_device_id *ent) | ||
434 | { | 421 | { |
435 | int ret; | 422 | int ret; |
436 | 423 | ||
424 | cards_found++; | ||
425 | if (cards_found == 1) | ||
426 | printk(KERN_INFO PFX "Intel 6300ESB WatchDog Timer Driver v%s\n", | ||
427 | ESB_VERSION); | ||
428 | |||
429 | if (cards_found > 1) { | ||
430 | printk(KERN_ERR PFX "This driver only supports 1 device\n"); | ||
431 | return -ENODEV; | ||
432 | } | ||
433 | |||
437 | /* Check whether or not the hardware watchdog is there */ | 434 | /* Check whether or not the hardware watchdog is there */ |
438 | if (!esb_getdevice() || esb_pci == NULL) | 435 | if (!esb_getdevice(pdev) || esb_pci == NULL) |
439 | return -ENODEV; | 436 | return -ENODEV; |
440 | 437 | ||
441 | /* Check that the heartbeat value is within it's range; | 438 | /* Check that the heartbeat value is within it's range; |
@@ -467,11 +464,11 @@ err_unmap: | |||
467 | iounmap(BASEADDR); | 464 | iounmap(BASEADDR); |
468 | pci_release_region(esb_pci, 0); | 465 | pci_release_region(esb_pci, 0); |
469 | pci_disable_device(esb_pci); | 466 | pci_disable_device(esb_pci); |
470 | pci_dev_put(esb_pci); | 467 | esb_pci = NULL; |
471 | return ret; | 468 | return ret; |
472 | } | 469 | } |
473 | 470 | ||
474 | static int __devexit esb_remove(struct platform_device *dev) | 471 | static void __devexit esb_remove(struct pci_dev *pdev) |
475 | { | 472 | { |
476 | /* Stop the timer before we leave */ | 473 | /* Stop the timer before we leave */ |
477 | if (!nowayout) | 474 | if (!nowayout) |
@@ -482,54 +479,30 @@ static int __devexit esb_remove(struct platform_device *dev) | |||
482 | iounmap(BASEADDR); | 479 | iounmap(BASEADDR); |
483 | pci_release_region(esb_pci, 0); | 480 | pci_release_region(esb_pci, 0); |
484 | pci_disable_device(esb_pci); | 481 | pci_disable_device(esb_pci); |
485 | pci_dev_put(esb_pci); | 482 | esb_pci = NULL; |
486 | return 0; | ||
487 | } | 483 | } |
488 | 484 | ||
489 | static void esb_shutdown(struct platform_device *dev) | 485 | static void esb_shutdown(struct pci_dev *pdev) |
490 | { | 486 | { |
491 | esb_timer_stop(); | 487 | esb_timer_stop(); |
492 | } | 488 | } |
493 | 489 | ||
494 | static struct platform_driver esb_platform_driver = { | 490 | static struct pci_driver esb_driver = { |
491 | .name = ESB_MODULE_NAME, | ||
492 | .id_table = esb_pci_tbl, | ||
495 | .probe = esb_probe, | 493 | .probe = esb_probe, |
496 | .remove = __devexit_p(esb_remove), | 494 | .remove = __devexit_p(esb_remove), |
497 | .shutdown = esb_shutdown, | 495 | .shutdown = esb_shutdown, |
498 | .driver = { | ||
499 | .owner = THIS_MODULE, | ||
500 | .name = ESB_MODULE_NAME, | ||
501 | }, | ||
502 | }; | 496 | }; |
503 | 497 | ||
504 | static int __init watchdog_init(void) | 498 | static int __init watchdog_init(void) |
505 | { | 499 | { |
506 | int err; | 500 | return pci_register_driver(&esb_driver); |
507 | |||
508 | printk(KERN_INFO PFX "Intel 6300ESB WatchDog Timer Driver v%s\n", | ||
509 | ESB_VERSION); | ||
510 | |||
511 | err = platform_driver_register(&esb_platform_driver); | ||
512 | if (err) | ||
513 | return err; | ||
514 | |||
515 | esb_platform_device = platform_device_register_simple(ESB_MODULE_NAME, | ||
516 | -1, NULL, 0); | ||
517 | if (IS_ERR(esb_platform_device)) { | ||
518 | err = PTR_ERR(esb_platform_device); | ||
519 | goto unreg_platform_driver; | ||
520 | } | ||
521 | |||
522 | return 0; | ||
523 | |||
524 | unreg_platform_driver: | ||
525 | platform_driver_unregister(&esb_platform_driver); | ||
526 | return err; | ||
527 | } | 501 | } |
528 | 502 | ||
529 | static void __exit watchdog_cleanup(void) | 503 | static void __exit watchdog_cleanup(void) |
530 | { | 504 | { |
531 | platform_device_unregister(esb_platform_device); | 505 | pci_unregister_driver(&esb_driver); |
532 | platform_driver_unregister(&esb_platform_driver); | ||
533 | printk(KERN_INFO PFX "Watchdog Module Unloaded.\n"); | 506 | printk(KERN_INFO PFX "Watchdog Module Unloaded.\n"); |
534 | } | 507 | } |
535 | 508 | ||
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c index 4bdb7f1a9077..44bc6aa46edf 100644 --- a/drivers/watchdog/iTCO_wdt.c +++ b/drivers/watchdog/iTCO_wdt.c | |||
@@ -584,7 +584,7 @@ static long iTCO_wdt_ioctl(struct file *file, unsigned int cmd, | |||
584 | int new_heartbeat; | 584 | int new_heartbeat; |
585 | void __user *argp = (void __user *)arg; | 585 | void __user *argp = (void __user *)arg; |
586 | int __user *p = argp; | 586 | int __user *p = argp; |
587 | static struct watchdog_info ident = { | 587 | static const struct watchdog_info ident = { |
588 | .options = WDIOF_SETTIMEOUT | | 588 | .options = WDIOF_SETTIMEOUT | |
589 | WDIOF_KEEPALIVEPING | | 589 | WDIOF_KEEPALIVEPING | |
590 | WDIOF_MAGICCLOSE, | 590 | WDIOF_MAGICCLOSE, |
@@ -698,7 +698,7 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev, | |||
698 | if (iTCO_wdt_private.iTCO_version == 2) { | 698 | if (iTCO_wdt_private.iTCO_version == 2) { |
699 | pci_read_config_dword(pdev, 0xf0, &base_address); | 699 | pci_read_config_dword(pdev, 0xf0, &base_address); |
700 | if ((base_address & 1) == 0) { | 700 | if ((base_address & 1) == 0) { |
701 | printk(KERN_ERR PFX "RCBA is disabled by harddware\n"); | 701 | printk(KERN_ERR PFX "RCBA is disabled by hardware\n"); |
702 | ret = -ENODEV; | 702 | ret = -ENODEV; |
703 | goto out; | 703 | goto out; |
704 | } | 704 | } |
@@ -708,8 +708,8 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev, | |||
708 | 708 | ||
709 | /* Check chipset's NO_REBOOT bit */ | 709 | /* Check chipset's NO_REBOOT bit */ |
710 | if (iTCO_wdt_unset_NO_REBOOT_bit() && iTCO_vendor_check_noreboot_on()) { | 710 | if (iTCO_wdt_unset_NO_REBOOT_bit() && iTCO_vendor_check_noreboot_on()) { |
711 | printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, " | 711 | printk(KERN_INFO PFX "unable to reset NO_REBOOT flag, " |
712 | "reboot disabled by hardware\n"); | 712 | "platform may have disabled it\n"); |
713 | ret = -ENODEV; /* Cannot reset NO_REBOOT bit */ | 713 | ret = -ENODEV; /* Cannot reset NO_REBOOT bit */ |
714 | goto out_unmap; | 714 | goto out_unmap; |
715 | } | 715 | } |
@@ -805,6 +805,7 @@ static void __devexit iTCO_wdt_cleanup(void) | |||
805 | 805 | ||
806 | static int __devinit iTCO_wdt_probe(struct platform_device *dev) | 806 | static int __devinit iTCO_wdt_probe(struct platform_device *dev) |
807 | { | 807 | { |
808 | int ret = -ENODEV; | ||
808 | int found = 0; | 809 | int found = 0; |
809 | struct pci_dev *pdev = NULL; | 810 | struct pci_dev *pdev = NULL; |
810 | const struct pci_device_id *ent; | 811 | const struct pci_device_id *ent; |
@@ -814,19 +815,17 @@ static int __devinit iTCO_wdt_probe(struct platform_device *dev) | |||
814 | for_each_pci_dev(pdev) { | 815 | for_each_pci_dev(pdev) { |
815 | ent = pci_match_id(iTCO_wdt_pci_tbl, pdev); | 816 | ent = pci_match_id(iTCO_wdt_pci_tbl, pdev); |
816 | if (ent) { | 817 | if (ent) { |
817 | if (!(iTCO_wdt_init(pdev, ent, dev))) { | 818 | found++; |
818 | found++; | 819 | ret = iTCO_wdt_init(pdev, ent, dev); |
820 | if (!ret) | ||
819 | break; | 821 | break; |
820 | } | ||
821 | } | 822 | } |
822 | } | 823 | } |
823 | 824 | ||
824 | if (!found) { | 825 | if (!found) |
825 | printk(KERN_INFO PFX "No card detected\n"); | 826 | printk(KERN_INFO PFX "No card detected\n"); |
826 | return -ENODEV; | ||
827 | } | ||
828 | 827 | ||
829 | return 0; | 828 | return ret; |
830 | } | 829 | } |
831 | 830 | ||
832 | static int __devexit iTCO_wdt_remove(struct platform_device *dev) | 831 | static int __devexit iTCO_wdt_remove(struct platform_device *dev) |
diff --git a/drivers/watchdog/ib700wdt.c b/drivers/watchdog/ib700wdt.c index 4bef3ddff4a5..0149d8dfc81d 100644 --- a/drivers/watchdog/ib700wdt.c +++ b/drivers/watchdog/ib700wdt.c | |||
@@ -174,7 +174,7 @@ static long ibwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
174 | void __user *argp = (void __user *)arg; | 174 | void __user *argp = (void __user *)arg; |
175 | int __user *p = argp; | 175 | int __user *p = argp; |
176 | 176 | ||
177 | static struct watchdog_info ident = { | 177 | static const struct watchdog_info ident = { |
178 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | 178 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
179 | | WDIOF_MAGICCLOSE, | 179 | | WDIOF_MAGICCLOSE, |
180 | .firmware_version = 1, | 180 | .firmware_version = 1, |
diff --git a/drivers/watchdog/indydog.c b/drivers/watchdog/indydog.c index bea8a124a559..1cc5609666d1 100644 --- a/drivers/watchdog/indydog.c +++ b/drivers/watchdog/indydog.c | |||
@@ -111,7 +111,7 @@ static long indydog_ioctl(struct file *file, unsigned int cmd, | |||
111 | unsigned long arg) | 111 | unsigned long arg) |
112 | { | 112 | { |
113 | int options, retval = -EINVAL; | 113 | int options, retval = -EINVAL; |
114 | static struct watchdog_info ident = { | 114 | static const struct watchdog_info ident = { |
115 | .options = WDIOF_KEEPALIVEPING, | 115 | .options = WDIOF_KEEPALIVEPING, |
116 | .firmware_version = 0, | 116 | .firmware_version = 0, |
117 | .identity = "Hardware Watchdog for SGI IP22", | 117 | .identity = "Hardware Watchdog for SGI IP22", |
diff --git a/drivers/watchdog/it8712f_wdt.c b/drivers/watchdog/it8712f_wdt.c index daed48ded7fe..f52c162b1bea 100644 --- a/drivers/watchdog/it8712f_wdt.c +++ b/drivers/watchdog/it8712f_wdt.c | |||
@@ -236,7 +236,7 @@ static long it8712f_wdt_ioctl(struct file *file, unsigned int cmd, | |||
236 | { | 236 | { |
237 | void __user *argp = (void __user *)arg; | 237 | void __user *argp = (void __user *)arg; |
238 | int __user *p = argp; | 238 | int __user *p = argp; |
239 | static struct watchdog_info ident = { | 239 | static const struct watchdog_info ident = { |
240 | .identity = "IT8712F Watchdog", | 240 | .identity = "IT8712F Watchdog", |
241 | .firmware_version = 1, | 241 | .firmware_version = 1, |
242 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | | 242 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | |
diff --git a/drivers/watchdog/it87_wdt.c b/drivers/watchdog/it87_wdt.c index cc133c531d08..b709b3b2d1ef 100644 --- a/drivers/watchdog/it87_wdt.c +++ b/drivers/watchdog/it87_wdt.c | |||
@@ -421,7 +421,7 @@ static ssize_t wdt_write(struct file *file, const char __user *buf, | |||
421 | return count; | 421 | return count; |
422 | } | 422 | } |
423 | 423 | ||
424 | static struct watchdog_info ident = { | 424 | static const struct watchdog_info ident = { |
425 | .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, | 425 | .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, |
426 | .firmware_version = 1, | 426 | .firmware_version = 1, |
427 | .identity = WATCHDOG_NAME, | 427 | .identity = WATCHDOG_NAME, |
diff --git a/drivers/watchdog/ixp2000_wdt.c b/drivers/watchdog/ixp2000_wdt.c index 3c79dc587958..e86952a7168c 100644 --- a/drivers/watchdog/ixp2000_wdt.c +++ b/drivers/watchdog/ixp2000_wdt.c | |||
@@ -100,7 +100,7 @@ static ssize_t ixp2000_wdt_write(struct file *file, const char *data, | |||
100 | } | 100 | } |
101 | 101 | ||
102 | 102 | ||
103 | static struct watchdog_info ident = { | 103 | static const struct watchdog_info ident = { |
104 | .options = WDIOF_MAGICCLOSE | WDIOF_SETTIMEOUT | | 104 | .options = WDIOF_MAGICCLOSE | WDIOF_SETTIMEOUT | |
105 | WDIOF_KEEPALIVEPING, | 105 | WDIOF_KEEPALIVEPING, |
106 | .identity = "IXP2000 Watchdog", | 106 | .identity = "IXP2000 Watchdog", |
diff --git a/drivers/watchdog/ixp4xx_wdt.c b/drivers/watchdog/ixp4xx_wdt.c index 147b4d5c63b3..e02c0ecda26b 100644 --- a/drivers/watchdog/ixp4xx_wdt.c +++ b/drivers/watchdog/ixp4xx_wdt.c | |||
@@ -89,7 +89,7 @@ ixp4xx_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos) | |||
89 | return len; | 89 | return len; |
90 | } | 90 | } |
91 | 91 | ||
92 | static struct watchdog_info ident = { | 92 | static const struct watchdog_info ident = { |
93 | .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE | | 93 | .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE | |
94 | WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, | 94 | WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, |
95 | .identity = "IXP4xx Watchdog", | 95 | .identity = "IXP4xx Watchdog", |
diff --git a/drivers/watchdog/ks8695_wdt.c b/drivers/watchdog/ks8695_wdt.c index e1c82769b08e..2852bb2e3fd9 100644 --- a/drivers/watchdog/ks8695_wdt.c +++ b/drivers/watchdog/ks8695_wdt.c | |||
@@ -145,7 +145,7 @@ static int ks8695_wdt_close(struct inode *inode, struct file *file) | |||
145 | return 0; | 145 | return 0; |
146 | } | 146 | } |
147 | 147 | ||
148 | static struct watchdog_info ks8695_wdt_info = { | 148 | static const struct watchdog_info ks8695_wdt_info = { |
149 | .identity = "ks8695 watchdog", | 149 | .identity = "ks8695 watchdog", |
150 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, | 150 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, |
151 | }; | 151 | }; |
diff --git a/drivers/watchdog/machzwd.c b/drivers/watchdog/machzwd.c index 47d719717a3b..2d118cf022fc 100644 --- a/drivers/watchdog/machzwd.c +++ b/drivers/watchdog/machzwd.c | |||
@@ -101,7 +101,7 @@ MODULE_PARM_DESC(nowayout, | |||
101 | 101 | ||
102 | #define PFX "machzwd" | 102 | #define PFX "machzwd" |
103 | 103 | ||
104 | static struct watchdog_info zf_info = { | 104 | static const struct watchdog_info zf_info = { |
105 | .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, | 105 | .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, |
106 | .firmware_version = 1, | 106 | .firmware_version = 1, |
107 | .identity = "ZF-Logic watchdog", | 107 | .identity = "ZF-Logic watchdog", |
diff --git a/drivers/watchdog/max63xx_wdt.c b/drivers/watchdog/max63xx_wdt.c new file mode 100644 index 000000000000..6eb91d757604 --- /dev/null +++ b/drivers/watchdog/max63xx_wdt.c | |||
@@ -0,0 +1,397 @@ | |||
1 | /* | ||
2 | * drivers/char/watchdog/max63xx_wdt.c | ||
3 | * | ||
4 | * Driver for max63{69,70,71,72,73,74} watchdog timers | ||
5 | * | ||
6 | * Copyright (C) 2009 Marc Zyngier <maz@misterjones.org> | ||
7 | * | ||
8 | * This file is licensed under the terms of the GNU General Public | ||
9 | * License version 2. This program is licensed "as is" without any | ||
10 | * warranty of any kind, whether express or implied. | ||
11 | * | ||
12 | * This driver assumes the watchdog pins are memory mapped (as it is | ||
13 | * the case for the Arcom Zeus). Should it be connected over GPIOs or | ||
14 | * another interface, some abstraction will have to be introduced. | ||
15 | */ | ||
16 | |||
17 | #include <linux/module.h> | ||
18 | #include <linux/moduleparam.h> | ||
19 | #include <linux/types.h> | ||
20 | #include <linux/kernel.h> | ||
21 | #include <linux/fs.h> | ||
22 | #include <linux/miscdevice.h> | ||
23 | #include <linux/watchdog.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/bitops.h> | ||
26 | #include <linux/platform_device.h> | ||
27 | #include <linux/spinlock.h> | ||
28 | #include <linux/uaccess.h> | ||
29 | #include <linux/io.h> | ||
30 | #include <linux/device.h> | ||
31 | |||
32 | #define DEFAULT_HEARTBEAT 60 | ||
33 | #define MAX_HEARTBEAT 60 | ||
34 | |||
35 | static int heartbeat = DEFAULT_HEARTBEAT; | ||
36 | static int nowayout = WATCHDOG_NOWAYOUT; | ||
37 | |||
38 | /* | ||
39 | * Memory mapping: a single byte, 3 first lower bits to select bit 3 | ||
40 | * to ping the watchdog. | ||
41 | */ | ||
42 | #define MAX6369_WDSET (7 << 0) | ||
43 | #define MAX6369_WDI (1 << 3) | ||
44 | |||
45 | static DEFINE_SPINLOCK(io_lock); | ||
46 | |||
47 | static unsigned long wdt_status; | ||
48 | #define WDT_IN_USE 0 | ||
49 | #define WDT_RUNNING 1 | ||
50 | #define WDT_OK_TO_CLOSE 2 | ||
51 | |||
52 | static int nodelay; | ||
53 | static struct resource *wdt_mem; | ||
54 | static void __iomem *wdt_base; | ||
55 | static struct platform_device *max63xx_pdev; | ||
56 | |||
57 | /* | ||
58 | * The timeout values used are actually the absolute minimum the chip | ||
59 | * offers. Typical values on my board are slightly over twice as long | ||
60 | * (10s setting ends up with a 25s timeout), and can be up to 3 times | ||
61 | * the nominal setting (according to the datasheet). So please take | ||
62 | * these values with a grain of salt. Same goes for the initial delay | ||
63 | * "feature". Only max6373/74 have a few settings without this initial | ||
64 | * delay (selected with the "nodelay" parameter). | ||
65 | * | ||
66 | * I also decided to remove from the tables any timeout smaller than a | ||
67 | * second, as it looked completly overkill... | ||
68 | */ | ||
69 | |||
70 | /* Timeouts in second */ | ||
71 | struct max63xx_timeout { | ||
72 | u8 wdset; | ||
73 | u8 tdelay; | ||
74 | u8 twd; | ||
75 | }; | ||
76 | |||
77 | static struct max63xx_timeout max6369_table[] = { | ||
78 | { 5, 1, 1 }, | ||
79 | { 6, 10, 10 }, | ||
80 | { 7, 60, 60 }, | ||
81 | { }, | ||
82 | }; | ||
83 | |||
84 | static struct max63xx_timeout max6371_table[] = { | ||
85 | { 6, 60, 3 }, | ||
86 | { 7, 60, 60 }, | ||
87 | { }, | ||
88 | }; | ||
89 | |||
90 | static struct max63xx_timeout max6373_table[] = { | ||
91 | { 2, 60, 1 }, | ||
92 | { 5, 0, 1 }, | ||
93 | { 1, 3, 3 }, | ||
94 | { 7, 60, 10 }, | ||
95 | { 6, 0, 10 }, | ||
96 | { }, | ||
97 | }; | ||
98 | |||
99 | static struct max63xx_timeout *current_timeout; | ||
100 | |||
101 | static struct max63xx_timeout * | ||
102 | max63xx_select_timeout(struct max63xx_timeout *table, int value) | ||
103 | { | ||
104 | while (table->twd) { | ||
105 | if (value <= table->twd) { | ||
106 | if (nodelay && table->tdelay == 0) | ||
107 | return table; | ||
108 | |||
109 | if (!nodelay) | ||
110 | return table; | ||
111 | } | ||
112 | |||
113 | table++; | ||
114 | } | ||
115 | |||
116 | return NULL; | ||
117 | } | ||
118 | |||
119 | static void max63xx_wdt_ping(void) | ||
120 | { | ||
121 | u8 val; | ||
122 | |||
123 | spin_lock(&io_lock); | ||
124 | |||
125 | val = __raw_readb(wdt_base); | ||
126 | |||
127 | __raw_writeb(val | MAX6369_WDI, wdt_base); | ||
128 | __raw_writeb(val & ~MAX6369_WDI, wdt_base); | ||
129 | |||
130 | spin_unlock(&io_lock); | ||
131 | } | ||
132 | |||
133 | static void max63xx_wdt_enable(struct max63xx_timeout *entry) | ||
134 | { | ||
135 | u8 val; | ||
136 | |||
137 | if (test_and_set_bit(WDT_RUNNING, &wdt_status)) | ||
138 | return; | ||
139 | |||
140 | spin_lock(&io_lock); | ||
141 | |||
142 | val = __raw_readb(wdt_base); | ||
143 | val &= ~MAX6369_WDSET; | ||
144 | val |= entry->wdset; | ||
145 | __raw_writeb(val, wdt_base); | ||
146 | |||
147 | spin_unlock(&io_lock); | ||
148 | |||
149 | /* check for a edge triggered startup */ | ||
150 | if (entry->tdelay == 0) | ||
151 | max63xx_wdt_ping(); | ||
152 | } | ||
153 | |||
154 | static void max63xx_wdt_disable(void) | ||
155 | { | ||
156 | spin_lock(&io_lock); | ||
157 | |||
158 | __raw_writeb(3, wdt_base); | ||
159 | |||
160 | spin_unlock(&io_lock); | ||
161 | |||
162 | clear_bit(WDT_RUNNING, &wdt_status); | ||
163 | } | ||
164 | |||
165 | static int max63xx_wdt_open(struct inode *inode, struct file *file) | ||
166 | { | ||
167 | if (test_and_set_bit(WDT_IN_USE, &wdt_status)) | ||
168 | return -EBUSY; | ||
169 | |||
170 | max63xx_wdt_enable(current_timeout); | ||
171 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
172 | |||
173 | return nonseekable_open(inode, file); | ||
174 | } | ||
175 | |||
176 | static ssize_t max63xx_wdt_write(struct file *file, const char *data, | ||
177 | size_t len, loff_t *ppos) | ||
178 | { | ||
179 | if (len) { | ||
180 | if (!nowayout) { | ||
181 | size_t i; | ||
182 | |||
183 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
184 | for (i = 0; i != len; i++) { | ||
185 | char c; | ||
186 | |||
187 | if (get_user(c, data + i)) | ||
188 | return -EFAULT; | ||
189 | |||
190 | if (c == 'V') | ||
191 | set_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
192 | } | ||
193 | } | ||
194 | |||
195 | max63xx_wdt_ping(); | ||
196 | } | ||
197 | |||
198 | return len; | ||
199 | } | ||
200 | |||
201 | static const struct watchdog_info ident = { | ||
202 | .options = WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, | ||
203 | .identity = "max63xx Watchdog", | ||
204 | }; | ||
205 | |||
206 | static long max63xx_wdt_ioctl(struct file *file, unsigned int cmd, | ||
207 | unsigned long arg) | ||
208 | { | ||
209 | int ret = -ENOTTY; | ||
210 | |||
211 | switch (cmd) { | ||
212 | case WDIOC_GETSUPPORT: | ||
213 | ret = copy_to_user((struct watchdog_info *)arg, &ident, | ||
214 | sizeof(ident)) ? -EFAULT : 0; | ||
215 | break; | ||
216 | |||
217 | case WDIOC_GETSTATUS: | ||
218 | case WDIOC_GETBOOTSTATUS: | ||
219 | ret = put_user(0, (int *)arg); | ||
220 | break; | ||
221 | |||
222 | case WDIOC_KEEPALIVE: | ||
223 | max63xx_wdt_ping(); | ||
224 | ret = 0; | ||
225 | break; | ||
226 | |||
227 | case WDIOC_GETTIMEOUT: | ||
228 | ret = put_user(heartbeat, (int *)arg); | ||
229 | break; | ||
230 | } | ||
231 | return ret; | ||
232 | } | ||
233 | |||
234 | static int max63xx_wdt_release(struct inode *inode, struct file *file) | ||
235 | { | ||
236 | if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) | ||
237 | max63xx_wdt_disable(); | ||
238 | else | ||
239 | dev_crit(&max63xx_pdev->dev, | ||
240 | "device closed unexpectedly - timer will not stop\n"); | ||
241 | |||
242 | clear_bit(WDT_IN_USE, &wdt_status); | ||
243 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
244 | |||
245 | return 0; | ||
246 | } | ||
247 | |||
248 | static const struct file_operations max63xx_wdt_fops = { | ||
249 | .owner = THIS_MODULE, | ||
250 | .llseek = no_llseek, | ||
251 | .write = max63xx_wdt_write, | ||
252 | .unlocked_ioctl = max63xx_wdt_ioctl, | ||
253 | .open = max63xx_wdt_open, | ||
254 | .release = max63xx_wdt_release, | ||
255 | }; | ||
256 | |||
257 | static struct miscdevice max63xx_wdt_miscdev = { | ||
258 | .minor = WATCHDOG_MINOR, | ||
259 | .name = "watchdog", | ||
260 | .fops = &max63xx_wdt_fops, | ||
261 | }; | ||
262 | |||
263 | static int __devinit max63xx_wdt_probe(struct platform_device *pdev) | ||
264 | { | ||
265 | int ret = 0; | ||
266 | int size; | ||
267 | struct resource *res; | ||
268 | struct device *dev = &pdev->dev; | ||
269 | struct max63xx_timeout *table; | ||
270 | |||
271 | table = (struct max63xx_timeout *)pdev->id_entry->driver_data; | ||
272 | |||
273 | if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT) | ||
274 | heartbeat = DEFAULT_HEARTBEAT; | ||
275 | |||
276 | dev_info(dev, "requesting %ds heartbeat\n", heartbeat); | ||
277 | current_timeout = max63xx_select_timeout(table, heartbeat); | ||
278 | |||
279 | if (!current_timeout) { | ||
280 | dev_err(dev, "unable to satisfy heartbeat request\n"); | ||
281 | return -EINVAL; | ||
282 | } | ||
283 | |||
284 | dev_info(dev, "using %ds heartbeat with %ds initial delay\n", | ||
285 | current_timeout->twd, current_timeout->tdelay); | ||
286 | |||
287 | heartbeat = current_timeout->twd; | ||
288 | |||
289 | max63xx_pdev = pdev; | ||
290 | |||
291 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
292 | if (res == NULL) { | ||
293 | dev_err(dev, "failed to get memory region resource\n"); | ||
294 | return -ENOENT; | ||
295 | } | ||
296 | |||
297 | size = resource_size(res); | ||
298 | wdt_mem = request_mem_region(res->start, size, pdev->name); | ||
299 | |||
300 | if (wdt_mem == NULL) { | ||
301 | dev_err(dev, "failed to get memory region\n"); | ||
302 | return -ENOENT; | ||
303 | } | ||
304 | |||
305 | wdt_base = ioremap(res->start, size); | ||
306 | if (!wdt_base) { | ||
307 | dev_err(dev, "failed to map memory region\n"); | ||
308 | ret = -ENOMEM; | ||
309 | goto out_request; | ||
310 | } | ||
311 | |||
312 | ret = misc_register(&max63xx_wdt_miscdev); | ||
313 | if (ret < 0) { | ||
314 | dev_err(dev, "cannot register misc device\n"); | ||
315 | goto out_unmap; | ||
316 | } | ||
317 | |||
318 | return 0; | ||
319 | |||
320 | out_unmap: | ||
321 | iounmap(wdt_base); | ||
322 | out_request: | ||
323 | release_resource(wdt_mem); | ||
324 | kfree(wdt_mem); | ||
325 | |||
326 | return ret; | ||
327 | } | ||
328 | |||
329 | static int __devexit max63xx_wdt_remove(struct platform_device *pdev) | ||
330 | { | ||
331 | misc_deregister(&max63xx_wdt_miscdev); | ||
332 | if (wdt_mem) { | ||
333 | release_resource(wdt_mem); | ||
334 | kfree(wdt_mem); | ||
335 | wdt_mem = NULL; | ||
336 | } | ||
337 | |||
338 | if (wdt_base) | ||
339 | iounmap(wdt_base); | ||
340 | |||
341 | return 0; | ||
342 | } | ||
343 | |||
344 | static struct platform_device_id max63xx_id_table[] = { | ||
345 | { "max6369_wdt", (kernel_ulong_t)max6369_table, }, | ||
346 | { "max6370_wdt", (kernel_ulong_t)max6369_table, }, | ||
347 | { "max6371_wdt", (kernel_ulong_t)max6371_table, }, | ||
348 | { "max6372_wdt", (kernel_ulong_t)max6371_table, }, | ||
349 | { "max6373_wdt", (kernel_ulong_t)max6373_table, }, | ||
350 | { "max6374_wdt", (kernel_ulong_t)max6373_table, }, | ||
351 | { }, | ||
352 | }; | ||
353 | MODULE_DEVICE_TABLE(platform, max63xx_id_table); | ||
354 | |||
355 | static struct platform_driver max63xx_wdt_driver = { | ||
356 | .probe = max63xx_wdt_probe, | ||
357 | .remove = __devexit_p(max63xx_wdt_remove), | ||
358 | .id_table = max63xx_id_table, | ||
359 | .driver = { | ||
360 | .name = "max63xx_wdt", | ||
361 | .owner = THIS_MODULE, | ||
362 | }, | ||
363 | }; | ||
364 | |||
365 | static int __init max63xx_wdt_init(void) | ||
366 | { | ||
367 | return platform_driver_register(&max63xx_wdt_driver); | ||
368 | } | ||
369 | |||
370 | static void __exit max63xx_wdt_exit(void) | ||
371 | { | ||
372 | platform_driver_unregister(&max63xx_wdt_driver); | ||
373 | } | ||
374 | |||
375 | module_init(max63xx_wdt_init); | ||
376 | module_exit(max63xx_wdt_exit); | ||
377 | |||
378 | MODULE_AUTHOR("Marc Zyngier <maz@misterjones.org>"); | ||
379 | MODULE_DESCRIPTION("max63xx Watchdog Driver"); | ||
380 | |||
381 | module_param(heartbeat, int, 0); | ||
382 | MODULE_PARM_DESC(heartbeat, | ||
383 | "Watchdog heartbeat period in seconds from 1 to " | ||
384 | __MODULE_STRING(MAX_HEARTBEAT) ", default " | ||
385 | __MODULE_STRING(DEFAULT_HEARTBEAT)); | ||
386 | |||
387 | module_param(nowayout, int, 0); | ||
388 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" | ||
389 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | ||
390 | |||
391 | module_param(nodelay, int, 0); | ||
392 | MODULE_PARM_DESC(nodelay, | ||
393 | "Force selection of a timeout setting without initial delay " | ||
394 | "(max6373/74 only, default=0)"); | ||
395 | |||
396 | MODULE_LICENSE("GPL"); | ||
397 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
diff --git a/drivers/watchdog/mixcomwd.c b/drivers/watchdog/mixcomwd.c index 407b025cb104..bc820d16699a 100644 --- a/drivers/watchdog/mixcomwd.c +++ b/drivers/watchdog/mixcomwd.c | |||
@@ -201,7 +201,7 @@ static long mixcomwd_ioctl(struct file *file, | |||
201 | void __user *argp = (void __user *)arg; | 201 | void __user *argp = (void __user *)arg; |
202 | int __user *p = argp; | 202 | int __user *p = argp; |
203 | int status; | 203 | int status; |
204 | static struct watchdog_info ident = { | 204 | static const struct watchdog_info ident = { |
205 | .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, | 205 | .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, |
206 | .firmware_version = 1, | 206 | .firmware_version = 1, |
207 | .identity = "MixCOM watchdog", | 207 | .identity = "MixCOM watchdog", |
diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c index 38c588ee694f..4e3941c5e293 100644 --- a/drivers/watchdog/mpc8xxx_wdt.c +++ b/drivers/watchdog/mpc8xxx_wdt.c | |||
@@ -148,7 +148,7 @@ static long mpc8xxx_wdt_ioctl(struct file *file, unsigned int cmd, | |||
148 | { | 148 | { |
149 | void __user *argp = (void __user *)arg; | 149 | void __user *argp = (void __user *)arg; |
150 | int __user *p = argp; | 150 | int __user *p = argp; |
151 | static struct watchdog_info ident = { | 151 | static const struct watchdog_info ident = { |
152 | .options = WDIOF_KEEPALIVEPING, | 152 | .options = WDIOF_KEEPALIVEPING, |
153 | .firmware_version = 1, | 153 | .firmware_version = 1, |
154 | .identity = "MPC8xxx", | 154 | .identity = "MPC8xxx", |
diff --git a/drivers/watchdog/mpcore_wdt.c b/drivers/watchdog/mpcore_wdt.c index a2dc07c2ed49..b0646dac924e 100644 --- a/drivers/watchdog/mpcore_wdt.c +++ b/drivers/watchdog/mpcore_wdt.c | |||
@@ -213,7 +213,7 @@ static ssize_t mpcore_wdt_write(struct file *file, const char *data, | |||
213 | return len; | 213 | return len; |
214 | } | 214 | } |
215 | 215 | ||
216 | static struct watchdog_info ident = { | 216 | static const struct watchdog_info ident = { |
217 | .options = WDIOF_SETTIMEOUT | | 217 | .options = WDIOF_SETTIMEOUT | |
218 | WDIOF_KEEPALIVEPING | | 218 | WDIOF_KEEPALIVEPING | |
219 | WDIOF_MAGICCLOSE, | 219 | WDIOF_MAGICCLOSE, |
diff --git a/drivers/watchdog/mv64x60_wdt.c b/drivers/watchdog/mv64x60_wdt.c index a51dbe4c43da..97f8a48d8b78 100644 --- a/drivers/watchdog/mv64x60_wdt.c +++ b/drivers/watchdog/mv64x60_wdt.c | |||
@@ -179,7 +179,7 @@ static long mv64x60_wdt_ioctl(struct file *file, | |||
179 | int timeout; | 179 | int timeout; |
180 | int options; | 180 | int options; |
181 | void __user *argp = (void __user *)arg; | 181 | void __user *argp = (void __user *)arg; |
182 | static struct watchdog_info info = { | 182 | static const struct watchdog_info info = { |
183 | .options = WDIOF_SETTIMEOUT | | 183 | .options = WDIOF_SETTIMEOUT | |
184 | WDIOF_MAGICCLOSE | | 184 | WDIOF_MAGICCLOSE | |
185 | WDIOF_KEEPALIVEPING, | 185 | WDIOF_KEEPALIVEPING, |
diff --git a/drivers/watchdog/pc87413_wdt.c b/drivers/watchdog/pc87413_wdt.c index 1a2b916e3f8d..d3aa2f1fe61d 100644 --- a/drivers/watchdog/pc87413_wdt.c +++ b/drivers/watchdog/pc87413_wdt.c | |||
@@ -407,7 +407,7 @@ static long pc87413_ioctl(struct file *file, unsigned int cmd, | |||
407 | int __user *i; | 407 | int __user *i; |
408 | } uarg; | 408 | } uarg; |
409 | 409 | ||
410 | static struct watchdog_info ident = { | 410 | static const struct watchdog_info ident = { |
411 | .options = WDIOF_KEEPALIVEPING | | 411 | .options = WDIOF_KEEPALIVEPING | |
412 | WDIOF_SETTIMEOUT | | 412 | WDIOF_SETTIMEOUT | |
413 | WDIOF_MAGICCLOSE, | 413 | WDIOF_MAGICCLOSE, |
diff --git a/drivers/watchdog/pcwd.c b/drivers/watchdog/pcwd.c index aa9512321f3a..06f7922606c0 100644 --- a/drivers/watchdog/pcwd.c +++ b/drivers/watchdog/pcwd.c | |||
@@ -606,7 +606,7 @@ static long pcwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
606 | int temperature; | 606 | int temperature; |
607 | int new_heartbeat; | 607 | int new_heartbeat; |
608 | int __user *argp = (int __user *)arg; | 608 | int __user *argp = (int __user *)arg; |
609 | static struct watchdog_info ident = { | 609 | static const struct watchdog_info ident = { |
610 | .options = WDIOF_OVERHEAT | | 610 | .options = WDIOF_OVERHEAT | |
611 | WDIOF_CARDRESET | | 611 | WDIOF_CARDRESET | |
612 | WDIOF_KEEPALIVEPING | | 612 | WDIOF_KEEPALIVEPING | |
diff --git a/drivers/watchdog/pcwd_pci.c b/drivers/watchdog/pcwd_pci.c index 698f51bff1bc..64374d636f09 100644 --- a/drivers/watchdog/pcwd_pci.c +++ b/drivers/watchdog/pcwd_pci.c | |||
@@ -481,7 +481,7 @@ static long pcipcwd_ioctl(struct file *file, unsigned int cmd, | |||
481 | { | 481 | { |
482 | void __user *argp = (void __user *)arg; | 482 | void __user *argp = (void __user *)arg; |
483 | int __user *p = argp; | 483 | int __user *p = argp; |
484 | static struct watchdog_info ident = { | 484 | static const struct watchdog_info ident = { |
485 | .options = WDIOF_OVERHEAT | | 485 | .options = WDIOF_OVERHEAT | |
486 | WDIOF_CARDRESET | | 486 | WDIOF_CARDRESET | |
487 | WDIOF_KEEPALIVEPING | | 487 | WDIOF_KEEPALIVEPING | |
diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c index 052fe451851f..8e4eacc5bb52 100644 --- a/drivers/watchdog/pcwd_usb.c +++ b/drivers/watchdog/pcwd_usb.c | |||
@@ -404,7 +404,7 @@ static long usb_pcwd_ioctl(struct file *file, unsigned int cmd, | |||
404 | { | 404 | { |
405 | void __user *argp = (void __user *)arg; | 405 | void __user *argp = (void __user *)arg; |
406 | int __user *p = argp; | 406 | int __user *p = argp; |
407 | static struct watchdog_info ident = { | 407 | static const struct watchdog_info ident = { |
408 | .options = WDIOF_KEEPALIVEPING | | 408 | .options = WDIOF_KEEPALIVEPING | |
409 | WDIOF_SETTIMEOUT | | 409 | WDIOF_SETTIMEOUT | |
410 | WDIOF_MAGICCLOSE, | 410 | WDIOF_MAGICCLOSE, |
diff --git a/drivers/watchdog/pika_wdt.c b/drivers/watchdog/pika_wdt.c index 2d22e996e996..435ec2aed4fe 100644 --- a/drivers/watchdog/pika_wdt.c +++ b/drivers/watchdog/pika_wdt.c | |||
@@ -52,7 +52,7 @@ static struct { | |||
52 | struct timer_list timer; /* The timer that pings the watchdog */ | 52 | struct timer_list timer; /* The timer that pings the watchdog */ |
53 | } pikawdt_private; | 53 | } pikawdt_private; |
54 | 54 | ||
55 | static struct watchdog_info ident = { | 55 | static const struct watchdog_info ident = { |
56 | .identity = DRV_NAME, | 56 | .identity = DRV_NAME, |
57 | .options = WDIOF_CARDRESET | | 57 | .options = WDIOF_CARDRESET | |
58 | WDIOF_SETTIMEOUT | | 58 | WDIOF_SETTIMEOUT | |
diff --git a/drivers/watchdog/pnx833x_wdt.c b/drivers/watchdog/pnx833x_wdt.c index 538ec2c05197..09102f09e681 100644 --- a/drivers/watchdog/pnx833x_wdt.c +++ b/drivers/watchdog/pnx833x_wdt.c | |||
@@ -141,7 +141,7 @@ static long pnx833x_wdt_ioctl(struct file *file, unsigned int cmd, | |||
141 | int options, new_timeout = 0; | 141 | int options, new_timeout = 0; |
142 | uint32_t timeout, timeout_left = 0; | 142 | uint32_t timeout, timeout_left = 0; |
143 | 143 | ||
144 | static struct watchdog_info ident = { | 144 | static const struct watchdog_info ident = { |
145 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT, | 145 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT, |
146 | .firmware_version = 0, | 146 | .firmware_version = 0, |
147 | .identity = "Hardware Watchdog for PNX833x", | 147 | .identity = "Hardware Watchdog for PNX833x", |
diff --git a/drivers/watchdog/rc32434_wdt.c b/drivers/watchdog/rc32434_wdt.c index bf12d06b5877..d4c29b5311a4 100644 --- a/drivers/watchdog/rc32434_wdt.c +++ b/drivers/watchdog/rc32434_wdt.c | |||
@@ -198,7 +198,7 @@ static long rc32434_wdt_ioctl(struct file *file, unsigned int cmd, | |||
198 | void __user *argp = (void __user *)arg; | 198 | void __user *argp = (void __user *)arg; |
199 | int new_timeout; | 199 | int new_timeout; |
200 | unsigned int value; | 200 | unsigned int value; |
201 | static struct watchdog_info ident = { | 201 | static const struct watchdog_info ident = { |
202 | .options = WDIOF_SETTIMEOUT | | 202 | .options = WDIOF_SETTIMEOUT | |
203 | WDIOF_KEEPALIVEPING | | 203 | WDIOF_KEEPALIVEPING | |
204 | WDIOF_MAGICCLOSE, | 204 | WDIOF_MAGICCLOSE, |
diff --git a/drivers/watchdog/rdc321x_wdt.c b/drivers/watchdog/rdc321x_wdt.c index 4976bfd1fce6..69c6adbd8205 100644 --- a/drivers/watchdog/rdc321x_wdt.c +++ b/drivers/watchdog/rdc321x_wdt.c | |||
@@ -149,7 +149,7 @@ static long rdc321x_wdt_ioctl(struct file *file, unsigned int cmd, | |||
149 | { | 149 | { |
150 | void __user *argp = (void __user *)arg; | 150 | void __user *argp = (void __user *)arg; |
151 | unsigned int value; | 151 | unsigned int value; |
152 | static struct watchdog_info ident = { | 152 | static const struct watchdog_info ident = { |
153 | .options = WDIOF_CARDRESET, | 153 | .options = WDIOF_CARDRESET, |
154 | .identity = "RDC321x WDT", | 154 | .identity = "RDC321x WDT", |
155 | }; | 155 | }; |
diff --git a/drivers/watchdog/riowd.c b/drivers/watchdog/riowd.c index c14ae8676903..ae57bf9e1b03 100644 --- a/drivers/watchdog/riowd.c +++ b/drivers/watchdog/riowd.c | |||
@@ -85,7 +85,7 @@ static int riowd_release(struct inode *inode, struct file *filp) | |||
85 | 85 | ||
86 | static long riowd_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 86 | static long riowd_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
87 | { | 87 | { |
88 | static struct watchdog_info info = { | 88 | static const struct watchdog_info info = { |
89 | .options = WDIOF_SETTIMEOUT, | 89 | .options = WDIOF_SETTIMEOUT, |
90 | .firmware_version = 1, | 90 | .firmware_version = 1, |
91 | .identity = DRIVER_NAME, | 91 | .identity = DRIVER_NAME, |
diff --git a/drivers/watchdog/sbc_fitpc2_wdt.c b/drivers/watchdog/sbc_fitpc2_wdt.c index e6763d2a567b..8d44c9b6fb5b 100644 --- a/drivers/watchdog/sbc_fitpc2_wdt.c +++ b/drivers/watchdog/sbc_fitpc2_wdt.c | |||
@@ -111,7 +111,7 @@ out: | |||
111 | } | 111 | } |
112 | 112 | ||
113 | 113 | ||
114 | static struct watchdog_info ident = { | 114 | static const struct watchdog_info ident = { |
115 | .options = WDIOF_MAGICCLOSE | WDIOF_SETTIMEOUT | | 115 | .options = WDIOF_MAGICCLOSE | WDIOF_SETTIMEOUT | |
116 | WDIOF_KEEPALIVEPING, | 116 | WDIOF_KEEPALIVEPING, |
117 | .identity = WATCHDOG_NAME, | 117 | .identity = WATCHDOG_NAME, |
diff --git a/drivers/watchdog/sch311x_wdt.c b/drivers/watchdog/sch311x_wdt.c index 569eb295a7a8..9c40f48804f5 100644 --- a/drivers/watchdog/sch311x_wdt.c +++ b/drivers/watchdog/sch311x_wdt.c | |||
@@ -250,7 +250,7 @@ static long sch311x_wdt_ioctl(struct file *file, unsigned int cmd, | |||
250 | int new_timeout; | 250 | int new_timeout; |
251 | void __user *argp = (void __user *)arg; | 251 | void __user *argp = (void __user *)arg; |
252 | int __user *p = argp; | 252 | int __user *p = argp; |
253 | static struct watchdog_info ident = { | 253 | static const struct watchdog_info ident = { |
254 | .options = WDIOF_KEEPALIVEPING | | 254 | .options = WDIOF_KEEPALIVEPING | |
255 | WDIOF_SETTIMEOUT | | 255 | WDIOF_SETTIMEOUT | |
256 | WDIOF_MAGICCLOSE, | 256 | WDIOF_MAGICCLOSE, |
diff --git a/drivers/watchdog/stmp3xxx_wdt.c b/drivers/watchdog/stmp3xxx_wdt.c index 5dd952681f32..b3421fd2cda8 100644 --- a/drivers/watchdog/stmp3xxx_wdt.c +++ b/drivers/watchdog/stmp3xxx_wdt.c | |||
@@ -94,7 +94,7 @@ static ssize_t stmp3xxx_wdt_write(struct file *file, const char __user *data, | |||
94 | return len; | 94 | return len; |
95 | } | 95 | } |
96 | 96 | ||
97 | static struct watchdog_info ident = { | 97 | static const struct watchdog_info ident = { |
98 | .options = WDIOF_CARDRESET | | 98 | .options = WDIOF_CARDRESET | |
99 | WDIOF_MAGICCLOSE | | 99 | WDIOF_MAGICCLOSE | |
100 | WDIOF_SETTIMEOUT | | 100 | WDIOF_SETTIMEOUT | |
diff --git a/drivers/watchdog/ts72xx_wdt.c b/drivers/watchdog/ts72xx_wdt.c new file mode 100644 index 000000000000..565a2c3321e5 --- /dev/null +++ b/drivers/watchdog/ts72xx_wdt.c | |||
@@ -0,0 +1,520 @@ | |||
1 | /* | ||
2 | * Watchdog driver for Technologic Systems TS-72xx based SBCs | ||
3 | * (TS-7200, TS-7250 and TS-7260). These boards have external | ||
4 | * glue logic CPLD chip, which includes programmable watchdog | ||
5 | * timer. | ||
6 | * | ||
7 | * Copyright (c) 2009 Mika Westerberg <mika.westerberg@iki.fi> | ||
8 | * | ||
9 | * This driver is based on ep93xx_wdt and wm831x_wdt drivers. | ||
10 | * | ||
11 | * This file is licensed under the terms of the GNU General Public | ||
12 | * License version 2. This program is licensed "as is" without any | ||
13 | * warranty of any kind, whether express or implied. | ||
14 | */ | ||
15 | |||
16 | #include <linux/fs.h> | ||
17 | #include <linux/io.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/moduleparam.h> | ||
20 | #include <linux/miscdevice.h> | ||
21 | #include <linux/mutex.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | #include <linux/watchdog.h> | ||
24 | #include <linux/uaccess.h> | ||
25 | |||
26 | #define TS72XX_WDT_FEED_VAL 0x05 | ||
27 | #define TS72XX_WDT_DEFAULT_TIMEOUT 8 | ||
28 | |||
29 | static int timeout = TS72XX_WDT_DEFAULT_TIMEOUT; | ||
30 | module_param(timeout, int, 0); | ||
31 | MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. " | ||
32 | "(1 <= timeout <= 8, default=" | ||
33 | __MODULE_STRING(TS72XX_WDT_DEFAULT_TIMEOUT) | ||
34 | ")"); | ||
35 | |||
36 | static int nowayout = WATCHDOG_NOWAYOUT; | ||
37 | module_param(nowayout, int, 0); | ||
38 | MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close"); | ||
39 | |||
40 | /** | ||
41 | * struct ts72xx_wdt - watchdog control structure | ||
42 | * @lock: lock that protects this structure | ||
43 | * @regval: watchdog timeout value suitable for control register | ||
44 | * @flags: flags controlling watchdog device state | ||
45 | * @control_reg: watchdog control register | ||
46 | * @feed_reg: watchdog feed register | ||
47 | * @pdev: back pointer to platform dev | ||
48 | */ | ||
49 | struct ts72xx_wdt { | ||
50 | struct mutex lock; | ||
51 | int regval; | ||
52 | |||
53 | #define TS72XX_WDT_BUSY_FLAG 1 | ||
54 | #define TS72XX_WDT_EXPECT_CLOSE_FLAG 2 | ||
55 | int flags; | ||
56 | |||
57 | void __iomem *control_reg; | ||
58 | void __iomem *feed_reg; | ||
59 | |||
60 | struct platform_device *pdev; | ||
61 | }; | ||
62 | |||
63 | struct platform_device *ts72xx_wdt_pdev; | ||
64 | |||
65 | /* | ||
66 | * TS-72xx Watchdog supports following timeouts (value written | ||
67 | * to control register): | ||
68 | * value description | ||
69 | * ------------------------- | ||
70 | * 0x00 watchdog disabled | ||
71 | * 0x01 250ms | ||
72 | * 0x02 500ms | ||
73 | * 0x03 1s | ||
74 | * 0x04 reserved | ||
75 | * 0x05 2s | ||
76 | * 0x06 4s | ||
77 | * 0x07 8s | ||
78 | * | ||
79 | * Timeouts below 1s are not very usable so we don't | ||
80 | * allow them at all. | ||
81 | * | ||
82 | * We provide two functions that convert between these: | ||
83 | * timeout_to_regval() and regval_to_timeout(). | ||
84 | */ | ||
85 | static const struct { | ||
86 | int timeout; | ||
87 | int regval; | ||
88 | } ts72xx_wdt_map[] = { | ||
89 | { 1, 3 }, | ||
90 | { 2, 5 }, | ||
91 | { 4, 6 }, | ||
92 | { 8, 7 }, | ||
93 | }; | ||
94 | |||
95 | /** | ||
96 | * timeout_to_regval() - converts given timeout to control register value | ||
97 | * @new_timeout: timeout in seconds to be converted | ||
98 | * | ||
99 | * Function converts given @new_timeout into valid value that can | ||
100 | * be programmed into watchdog control register. When conversion is | ||
101 | * not possible, function returns %-EINVAL. | ||
102 | */ | ||
103 | static int timeout_to_regval(int new_timeout) | ||
104 | { | ||
105 | int i; | ||
106 | |||
107 | /* first limit it to 1 - 8 seconds */ | ||
108 | new_timeout = clamp_val(new_timeout, 1, 8); | ||
109 | |||
110 | for (i = 0; i < ARRAY_SIZE(ts72xx_wdt_map); i++) { | ||
111 | if (ts72xx_wdt_map[i].timeout >= new_timeout) | ||
112 | return ts72xx_wdt_map[i].regval; | ||
113 | } | ||
114 | |||
115 | return -EINVAL; | ||
116 | } | ||
117 | |||
118 | /** | ||
119 | * regval_to_timeout() - converts control register value to timeout | ||
120 | * @regval: control register value to be converted | ||
121 | * | ||
122 | * Function converts given @regval to timeout in seconds (1, 2, 4 or 8). | ||
123 | * If @regval cannot be converted, function returns %-EINVAL. | ||
124 | */ | ||
125 | static int regval_to_timeout(int regval) | ||
126 | { | ||
127 | int i; | ||
128 | |||
129 | for (i = 0; i < ARRAY_SIZE(ts72xx_wdt_map); i++) { | ||
130 | if (ts72xx_wdt_map[i].regval == regval) | ||
131 | return ts72xx_wdt_map[i].timeout; | ||
132 | } | ||
133 | |||
134 | return -EINVAL; | ||
135 | } | ||
136 | |||
137 | /** | ||
138 | * ts72xx_wdt_kick() - kick the watchdog | ||
139 | * @wdt: watchdog to be kicked | ||
140 | * | ||
141 | * Called with @wdt->lock held. | ||
142 | */ | ||
143 | static inline void ts72xx_wdt_kick(struct ts72xx_wdt *wdt) | ||
144 | { | ||
145 | __raw_writeb(TS72XX_WDT_FEED_VAL, wdt->feed_reg); | ||
146 | } | ||
147 | |||
148 | /** | ||
149 | * ts72xx_wdt_start() - starts the watchdog timer | ||
150 | * @wdt: watchdog to be started | ||
151 | * | ||
152 | * This function programs timeout to watchdog timer | ||
153 | * and starts it. | ||
154 | * | ||
155 | * Called with @wdt->lock held. | ||
156 | */ | ||
157 | static void ts72xx_wdt_start(struct ts72xx_wdt *wdt) | ||
158 | { | ||
159 | /* | ||
160 | * To program the wdt, it first must be "fed" and | ||
161 | * only after that (within 30 usecs) the configuration | ||
162 | * can be changed. | ||
163 | */ | ||
164 | ts72xx_wdt_kick(wdt); | ||
165 | __raw_writeb((u8)wdt->regval, wdt->control_reg); | ||
166 | } | ||
167 | |||
168 | /** | ||
169 | * ts72xx_wdt_stop() - stops the watchdog timer | ||
170 | * @wdt: watchdog to be stopped | ||
171 | * | ||
172 | * Called with @wdt->lock held. | ||
173 | */ | ||
174 | static void ts72xx_wdt_stop(struct ts72xx_wdt *wdt) | ||
175 | { | ||
176 | ts72xx_wdt_kick(wdt); | ||
177 | __raw_writeb(0, wdt->control_reg); | ||
178 | } | ||
179 | |||
180 | static int ts72xx_wdt_open(struct inode *inode, struct file *file) | ||
181 | { | ||
182 | struct ts72xx_wdt *wdt = platform_get_drvdata(ts72xx_wdt_pdev); | ||
183 | int regval; | ||
184 | |||
185 | /* | ||
186 | * Try to convert default timeout to valid register | ||
187 | * value first. | ||
188 | */ | ||
189 | regval = timeout_to_regval(timeout); | ||
190 | if (regval < 0) { | ||
191 | dev_err(&wdt->pdev->dev, | ||
192 | "failed to convert timeout (%d) to register value\n", | ||
193 | timeout); | ||
194 | return -EINVAL; | ||
195 | } | ||
196 | |||
197 | if (mutex_lock_interruptible(&wdt->lock)) | ||
198 | return -ERESTARTSYS; | ||
199 | |||
200 | if ((wdt->flags & TS72XX_WDT_BUSY_FLAG) != 0) { | ||
201 | mutex_unlock(&wdt->lock); | ||
202 | return -EBUSY; | ||
203 | } | ||
204 | |||
205 | wdt->flags = TS72XX_WDT_BUSY_FLAG; | ||
206 | wdt->regval = regval; | ||
207 | file->private_data = wdt; | ||
208 | |||
209 | ts72xx_wdt_start(wdt); | ||
210 | |||
211 | mutex_unlock(&wdt->lock); | ||
212 | return nonseekable_open(inode, file); | ||
213 | } | ||
214 | |||
215 | static int ts72xx_wdt_release(struct inode *inode, struct file *file) | ||
216 | { | ||
217 | struct ts72xx_wdt *wdt = file->private_data; | ||
218 | |||
219 | if (mutex_lock_interruptible(&wdt->lock)) | ||
220 | return -ERESTARTSYS; | ||
221 | |||
222 | if ((wdt->flags & TS72XX_WDT_EXPECT_CLOSE_FLAG) != 0) { | ||
223 | ts72xx_wdt_stop(wdt); | ||
224 | } else { | ||
225 | dev_warn(&wdt->pdev->dev, | ||
226 | "TS-72XX WDT device closed unexpectly. " | ||
227 | "Watchdog timer will not stop!\n"); | ||
228 | /* | ||
229 | * Kick it one more time, to give userland some time | ||
230 | * to recover (for example, respawning the kicker | ||
231 | * daemon). | ||
232 | */ | ||
233 | ts72xx_wdt_kick(wdt); | ||
234 | } | ||
235 | |||
236 | wdt->flags = 0; | ||
237 | |||
238 | mutex_unlock(&wdt->lock); | ||
239 | return 0; | ||
240 | } | ||
241 | |||
242 | static ssize_t ts72xx_wdt_write(struct file *file, | ||
243 | const char __user *data, | ||
244 | size_t len, | ||
245 | loff_t *ppos) | ||
246 | { | ||
247 | struct ts72xx_wdt *wdt = file->private_data; | ||
248 | |||
249 | if (!len) | ||
250 | return 0; | ||
251 | |||
252 | if (mutex_lock_interruptible(&wdt->lock)) | ||
253 | return -ERESTARTSYS; | ||
254 | |||
255 | ts72xx_wdt_kick(wdt); | ||
256 | |||
257 | /* | ||
258 | * Support for magic character closing. User process | ||
259 | * writes 'V' into the device, just before it is closed. | ||
260 | * This means that we know that the wdt timer can be | ||
261 | * stopped after user closes the device. | ||
262 | */ | ||
263 | if (!nowayout) { | ||
264 | int i; | ||
265 | |||
266 | for (i = 0; i < len; i++) { | ||
267 | char c; | ||
268 | |||
269 | /* In case it was set long ago */ | ||
270 | wdt->flags &= ~TS72XX_WDT_EXPECT_CLOSE_FLAG; | ||
271 | |||
272 | if (get_user(c, data + i)) { | ||
273 | mutex_unlock(&wdt->lock); | ||
274 | return -EFAULT; | ||
275 | } | ||
276 | if (c == 'V') { | ||
277 | wdt->flags |= TS72XX_WDT_EXPECT_CLOSE_FLAG; | ||
278 | break; | ||
279 | } | ||
280 | } | ||
281 | } | ||
282 | |||
283 | mutex_unlock(&wdt->lock); | ||
284 | return len; | ||
285 | } | ||
286 | |||
287 | static const struct watchdog_info winfo = { | ||
288 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | | ||
289 | WDIOF_MAGICCLOSE, | ||
290 | .firmware_version = 1, | ||
291 | .identity = "TS-72XX WDT", | ||
292 | }; | ||
293 | |||
294 | static long ts72xx_wdt_ioctl(struct file *file, unsigned int cmd, | ||
295 | unsigned long arg) | ||
296 | { | ||
297 | struct ts72xx_wdt *wdt = file->private_data; | ||
298 | void __user *argp = (void __user *)arg; | ||
299 | int __user *p = (int __user *)argp; | ||
300 | int error = 0; | ||
301 | |||
302 | if (mutex_lock_interruptible(&wdt->lock)) | ||
303 | return -ERESTARTSYS; | ||
304 | |||
305 | switch (cmd) { | ||
306 | case WDIOC_GETSUPPORT: | ||
307 | error = copy_to_user(argp, &winfo, sizeof(winfo)); | ||
308 | break; | ||
309 | |||
310 | case WDIOC_GETSTATUS: | ||
311 | case WDIOC_GETBOOTSTATUS: | ||
312 | return put_user(0, p); | ||
313 | |||
314 | case WDIOC_KEEPALIVE: | ||
315 | ts72xx_wdt_kick(wdt); | ||
316 | break; | ||
317 | |||
318 | case WDIOC_SETOPTIONS: { | ||
319 | int options; | ||
320 | |||
321 | if (get_user(options, p)) { | ||
322 | error = -EFAULT; | ||
323 | break; | ||
324 | } | ||
325 | |||
326 | error = -EINVAL; | ||
327 | |||
328 | if ((options & WDIOS_DISABLECARD) != 0) { | ||
329 | ts72xx_wdt_stop(wdt); | ||
330 | error = 0; | ||
331 | } | ||
332 | if ((options & WDIOS_ENABLECARD) != 0) { | ||
333 | ts72xx_wdt_start(wdt); | ||
334 | error = 0; | ||
335 | } | ||
336 | |||
337 | break; | ||
338 | } | ||
339 | |||
340 | case WDIOC_SETTIMEOUT: { | ||
341 | int new_timeout; | ||
342 | |||
343 | if (get_user(new_timeout, p)) { | ||
344 | error = -EFAULT; | ||
345 | } else { | ||
346 | int regval; | ||
347 | |||
348 | regval = timeout_to_regval(new_timeout); | ||
349 | if (regval < 0) { | ||
350 | error = -EINVAL; | ||
351 | } else { | ||
352 | ts72xx_wdt_stop(wdt); | ||
353 | wdt->regval = regval; | ||
354 | ts72xx_wdt_start(wdt); | ||
355 | } | ||
356 | } | ||
357 | if (error) | ||
358 | break; | ||
359 | |||
360 | /*FALLTHROUGH*/ | ||
361 | } | ||
362 | |||
363 | case WDIOC_GETTIMEOUT: | ||
364 | if (put_user(regval_to_timeout(wdt->regval), p)) | ||
365 | error = -EFAULT; | ||
366 | break; | ||
367 | |||
368 | default: | ||
369 | error = -ENOTTY; | ||
370 | break; | ||
371 | } | ||
372 | |||
373 | mutex_unlock(&wdt->lock); | ||
374 | return error; | ||
375 | } | ||
376 | |||
377 | static const struct file_operations ts72xx_wdt_fops = { | ||
378 | .owner = THIS_MODULE, | ||
379 | .llseek = no_llseek, | ||
380 | .open = ts72xx_wdt_open, | ||
381 | .release = ts72xx_wdt_release, | ||
382 | .write = ts72xx_wdt_write, | ||
383 | .unlocked_ioctl = ts72xx_wdt_ioctl, | ||
384 | }; | ||
385 | |||
386 | static struct miscdevice ts72xx_wdt_miscdev = { | ||
387 | .minor = WATCHDOG_MINOR, | ||
388 | .name = "watchdog", | ||
389 | .fops = &ts72xx_wdt_fops, | ||
390 | }; | ||
391 | |||
392 | static __devinit int ts72xx_wdt_probe(struct platform_device *pdev) | ||
393 | { | ||
394 | struct ts72xx_wdt *wdt; | ||
395 | struct resource *r1, *r2; | ||
396 | int error = 0; | ||
397 | |||
398 | wdt = kzalloc(sizeof(struct ts72xx_wdt), GFP_KERNEL); | ||
399 | if (!wdt) { | ||
400 | dev_err(&pdev->dev, "failed to allocate memory\n"); | ||
401 | return -ENOMEM; | ||
402 | } | ||
403 | |||
404 | r1 = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
405 | if (!r1) { | ||
406 | dev_err(&pdev->dev, "failed to get memory resource\n"); | ||
407 | error = -ENODEV; | ||
408 | goto fail; | ||
409 | } | ||
410 | |||
411 | r1 = request_mem_region(r1->start, resource_size(r1), pdev->name); | ||
412 | if (!r1) { | ||
413 | dev_err(&pdev->dev, "cannot request memory region\n"); | ||
414 | error = -EBUSY; | ||
415 | goto fail; | ||
416 | } | ||
417 | |||
418 | wdt->control_reg = ioremap(r1->start, resource_size(r1)); | ||
419 | if (!wdt->control_reg) { | ||
420 | dev_err(&pdev->dev, "failed to map memory\n"); | ||
421 | error = -ENODEV; | ||
422 | goto fail_free_control; | ||
423 | } | ||
424 | |||
425 | r2 = platform_get_resource(pdev, IORESOURCE_MEM, 1); | ||
426 | if (!r2) { | ||
427 | dev_err(&pdev->dev, "failed to get memory resource\n"); | ||
428 | error = -ENODEV; | ||
429 | goto fail_unmap_control; | ||
430 | } | ||
431 | |||
432 | r2 = request_mem_region(r2->start, resource_size(r2), pdev->name); | ||
433 | if (!r2) { | ||
434 | dev_err(&pdev->dev, "cannot request memory region\n"); | ||
435 | error = -EBUSY; | ||
436 | goto fail_unmap_control; | ||
437 | } | ||
438 | |||
439 | wdt->feed_reg = ioremap(r2->start, resource_size(r2)); | ||
440 | if (!wdt->feed_reg) { | ||
441 | dev_err(&pdev->dev, "failed to map memory\n"); | ||
442 | error = -ENODEV; | ||
443 | goto fail_free_feed; | ||
444 | } | ||
445 | |||
446 | platform_set_drvdata(pdev, wdt); | ||
447 | ts72xx_wdt_pdev = pdev; | ||
448 | wdt->pdev = pdev; | ||
449 | mutex_init(&wdt->lock); | ||
450 | |||
451 | error = misc_register(&ts72xx_wdt_miscdev); | ||
452 | if (error) { | ||
453 | dev_err(&pdev->dev, "failed to register miscdev\n"); | ||
454 | goto fail_unmap_feed; | ||
455 | } | ||
456 | |||
457 | dev_info(&pdev->dev, "TS-72xx Watchdog driver\n"); | ||
458 | |||
459 | return 0; | ||
460 | |||
461 | fail_unmap_feed: | ||
462 | platform_set_drvdata(pdev, NULL); | ||
463 | iounmap(wdt->feed_reg); | ||
464 | fail_free_feed: | ||
465 | release_mem_region(r2->start, resource_size(r2)); | ||
466 | fail_unmap_control: | ||
467 | iounmap(wdt->control_reg); | ||
468 | fail_free_control: | ||
469 | release_mem_region(r1->start, resource_size(r1)); | ||
470 | fail: | ||
471 | kfree(wdt); | ||
472 | return error; | ||
473 | } | ||
474 | |||
475 | static __devexit int ts72xx_wdt_remove(struct platform_device *pdev) | ||
476 | { | ||
477 | struct ts72xx_wdt *wdt = platform_get_drvdata(pdev); | ||
478 | struct resource *res; | ||
479 | int error; | ||
480 | |||
481 | error = misc_deregister(&ts72xx_wdt_miscdev); | ||
482 | platform_set_drvdata(pdev, NULL); | ||
483 | |||
484 | iounmap(wdt->feed_reg); | ||
485 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | ||
486 | release_mem_region(res->start, resource_size(res)); | ||
487 | |||
488 | iounmap(wdt->control_reg); | ||
489 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
490 | release_mem_region(res->start, resource_size(res)); | ||
491 | |||
492 | kfree(wdt); | ||
493 | return error; | ||
494 | } | ||
495 | |||
496 | static struct platform_driver ts72xx_wdt_driver = { | ||
497 | .probe = ts72xx_wdt_probe, | ||
498 | .remove = __devexit_p(ts72xx_wdt_remove), | ||
499 | .driver = { | ||
500 | .name = "ts72xx-wdt", | ||
501 | .owner = THIS_MODULE, | ||
502 | }, | ||
503 | }; | ||
504 | |||
505 | static __init int ts72xx_wdt_init(void) | ||
506 | { | ||
507 | return platform_driver_register(&ts72xx_wdt_driver); | ||
508 | } | ||
509 | module_init(ts72xx_wdt_init); | ||
510 | |||
511 | static __exit void ts72xx_wdt_exit(void) | ||
512 | { | ||
513 | platform_driver_unregister(&ts72xx_wdt_driver); | ||
514 | } | ||
515 | module_exit(ts72xx_wdt_exit); | ||
516 | |||
517 | MODULE_AUTHOR("Mika Westerberg <mika.westerberg@iki.fi>"); | ||
518 | MODULE_DESCRIPTION("TS-72xx SBC Watchdog"); | ||
519 | MODULE_LICENSE("GPL"); | ||
520 | MODULE_ALIAS("platform:ts72xx-wdt"); | ||
diff --git a/drivers/watchdog/txx9wdt.c b/drivers/watchdog/txx9wdt.c index d635566e9307..9e9ed7bfabcb 100644 --- a/drivers/watchdog/txx9wdt.c +++ b/drivers/watchdog/txx9wdt.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/miscdevice.h> | 13 | #include <linux/miscdevice.h> |
14 | #include <linux/watchdog.h> | 14 | #include <linux/watchdog.h> |
15 | #include <linux/fs.h> | 15 | #include <linux/fs.h> |
16 | #include <linux/reboot.h> | ||
17 | #include <linux/init.h> | 16 | #include <linux/init.h> |
18 | #include <linux/uaccess.h> | 17 | #include <linux/uaccess.h> |
19 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
@@ -166,14 +165,6 @@ static long txx9wdt_ioctl(struct file *file, unsigned int cmd, | |||
166 | } | 165 | } |
167 | } | 166 | } |
168 | 167 | ||
169 | static int txx9wdt_notify_sys(struct notifier_block *this, unsigned long code, | ||
170 | void *unused) | ||
171 | { | ||
172 | if (code == SYS_DOWN || code == SYS_HALT) | ||
173 | txx9wdt_stop(); | ||
174 | return NOTIFY_DONE; | ||
175 | } | ||
176 | |||
177 | static const struct file_operations txx9wdt_fops = { | 168 | static const struct file_operations txx9wdt_fops = { |
178 | .owner = THIS_MODULE, | 169 | .owner = THIS_MODULE, |
179 | .llseek = no_llseek, | 170 | .llseek = no_llseek, |
@@ -189,10 +180,6 @@ static struct miscdevice txx9wdt_miscdev = { | |||
189 | .fops = &txx9wdt_fops, | 180 | .fops = &txx9wdt_fops, |
190 | }; | 181 | }; |
191 | 182 | ||
192 | static struct notifier_block txx9wdt_notifier = { | ||
193 | .notifier_call = txx9wdt_notify_sys, | ||
194 | }; | ||
195 | |||
196 | static int __init txx9wdt_probe(struct platform_device *dev) | 183 | static int __init txx9wdt_probe(struct platform_device *dev) |
197 | { | 184 | { |
198 | struct resource *res; | 185 | struct resource *res; |
@@ -221,13 +208,8 @@ static int __init txx9wdt_probe(struct platform_device *dev) | |||
221 | if (!txx9wdt_reg) | 208 | if (!txx9wdt_reg) |
222 | goto exit_busy; | 209 | goto exit_busy; |
223 | 210 | ||
224 | ret = register_reboot_notifier(&txx9wdt_notifier); | ||
225 | if (ret) | ||
226 | goto exit; | ||
227 | |||
228 | ret = misc_register(&txx9wdt_miscdev); | 211 | ret = misc_register(&txx9wdt_miscdev); |
229 | if (ret) { | 212 | if (ret) { |
230 | unregister_reboot_notifier(&txx9wdt_notifier); | ||
231 | goto exit; | 213 | goto exit; |
232 | } | 214 | } |
233 | 215 | ||
@@ -249,14 +231,19 @@ exit: | |||
249 | static int __exit txx9wdt_remove(struct platform_device *dev) | 231 | static int __exit txx9wdt_remove(struct platform_device *dev) |
250 | { | 232 | { |
251 | misc_deregister(&txx9wdt_miscdev); | 233 | misc_deregister(&txx9wdt_miscdev); |
252 | unregister_reboot_notifier(&txx9wdt_notifier); | ||
253 | clk_disable(txx9_imclk); | 234 | clk_disable(txx9_imclk); |
254 | clk_put(txx9_imclk); | 235 | clk_put(txx9_imclk); |
255 | return 0; | 236 | return 0; |
256 | } | 237 | } |
257 | 238 | ||
239 | static void txx9wdt_shutdown(struct platform_device *dev) | ||
240 | { | ||
241 | txx9wdt_stop(); | ||
242 | } | ||
243 | |||
258 | static struct platform_driver txx9wdt_driver = { | 244 | static struct platform_driver txx9wdt_driver = { |
259 | .remove = __exit_p(txx9wdt_remove), | 245 | .remove = __exit_p(txx9wdt_remove), |
246 | .shutdown = txx9wdt_shutdown, | ||
260 | .driver = { | 247 | .driver = { |
261 | .name = "txx9wdt", | 248 | .name = "txx9wdt", |
262 | .owner = THIS_MODULE, | 249 | .owner = THIS_MODULE, |
diff --git a/drivers/watchdog/w83627hf_wdt.c b/drivers/watchdog/w83627hf_wdt.c index f201accc4e3d..0f5288df0091 100644 --- a/drivers/watchdog/w83627hf_wdt.c +++ b/drivers/watchdog/w83627hf_wdt.c | |||
@@ -201,7 +201,7 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
201 | void __user *argp = (void __user *)arg; | 201 | void __user *argp = (void __user *)arg; |
202 | int __user *p = argp; | 202 | int __user *p = argp; |
203 | int new_timeout; | 203 | int new_timeout; |
204 | static struct watchdog_info ident = { | 204 | static const struct watchdog_info ident = { |
205 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | | 205 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | |
206 | WDIOF_MAGICCLOSE, | 206 | WDIOF_MAGICCLOSE, |
207 | .firmware_version = 1, | 207 | .firmware_version = 1, |
diff --git a/drivers/watchdog/w83977f_wdt.c b/drivers/watchdog/w83977f_wdt.c index 0560182a1d09..6e6743d1066f 100644 --- a/drivers/watchdog/w83977f_wdt.c +++ b/drivers/watchdog/w83977f_wdt.c | |||
@@ -371,7 +371,7 @@ static ssize_t wdt_write(struct file *file, const char __user *buf, | |||
371 | * according to their available features. | 371 | * according to their available features. |
372 | */ | 372 | */ |
373 | 373 | ||
374 | static struct watchdog_info ident = { | 374 | static const struct watchdog_info ident = { |
375 | .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, | 375 | .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, |
376 | .firmware_version = 1, | 376 | .firmware_version = 1, |
377 | .identity = WATCHDOG_NAME, | 377 | .identity = WATCHDOG_NAME, |
diff --git a/drivers/watchdog/wdrtas.c b/drivers/watchdog/wdrtas.c index 5bfb1f2c5319..94ec22b9e66b 100644 --- a/drivers/watchdog/wdrtas.c +++ b/drivers/watchdog/wdrtas.c | |||
@@ -312,7 +312,7 @@ static long wdrtas_ioctl(struct file *file, unsigned int cmd, | |||
312 | { | 312 | { |
313 | int __user *argp = (void __user *)arg; | 313 | int __user *argp = (void __user *)arg; |
314 | int i; | 314 | int i; |
315 | static struct watchdog_info wdinfo = { | 315 | static const struct watchdog_info wdinfo = { |
316 | .options = WDRTAS_SUPPORTED_MASK, | 316 | .options = WDRTAS_SUPPORTED_MASK, |
317 | .firmware_version = 0, | 317 | .firmware_version = 0, |
318 | .identity = "wdrtas", | 318 | .identity = "wdrtas", |
diff --git a/drivers/watchdog/wdt.c b/drivers/watchdog/wdt.c index 3bbefe9a2634..bfda2e99dd89 100644 --- a/drivers/watchdog/wdt.c +++ b/drivers/watchdog/wdt.c | |||
@@ -358,7 +358,7 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
358 | int new_heartbeat; | 358 | int new_heartbeat; |
359 | int status; | 359 | int status; |
360 | 360 | ||
361 | static struct watchdog_info ident = { | 361 | struct watchdog_info ident = { |
362 | .options = WDIOF_SETTIMEOUT| | 362 | .options = WDIOF_SETTIMEOUT| |
363 | WDIOF_MAGICCLOSE| | 363 | WDIOF_MAGICCLOSE| |
364 | WDIOF_KEEPALIVEPING, | 364 | WDIOF_KEEPALIVEPING, |
diff --git a/drivers/watchdog/wdt_pci.c b/drivers/watchdog/wdt_pci.c index f368dd87083a..7b22e3cdbc81 100644 --- a/drivers/watchdog/wdt_pci.c +++ b/drivers/watchdog/wdt_pci.c | |||
@@ -412,7 +412,7 @@ static long wdtpci_ioctl(struct file *file, unsigned int cmd, | |||
412 | int new_heartbeat; | 412 | int new_heartbeat; |
413 | int status; | 413 | int status; |
414 | 414 | ||
415 | static struct watchdog_info ident = { | 415 | struct watchdog_info ident = { |
416 | .options = WDIOF_SETTIMEOUT| | 416 | .options = WDIOF_SETTIMEOUT| |
417 | WDIOF_MAGICCLOSE| | 417 | WDIOF_MAGICCLOSE| |
418 | WDIOF_KEEPALIVEPING, | 418 | WDIOF_KEEPALIVEPING, |
diff --git a/drivers/watchdog/wm831x_wdt.c b/drivers/watchdog/wm831x_wdt.c index 775bcd807f31..8c4b2d5bb7da 100644 --- a/drivers/watchdog/wm831x_wdt.c +++ b/drivers/watchdog/wm831x_wdt.c | |||
@@ -213,7 +213,7 @@ static ssize_t wm831x_wdt_write(struct file *file, | |||
213 | return count; | 213 | return count; |
214 | } | 214 | } |
215 | 215 | ||
216 | static struct watchdog_info ident = { | 216 | static const struct watchdog_info ident = { |
217 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, | 217 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, |
218 | .identity = "WM831x Watchdog", | 218 | .identity = "WM831x Watchdog", |
219 | }; | 219 | }; |
diff --git a/drivers/watchdog/wm8350_wdt.c b/drivers/watchdog/wm8350_wdt.c index a2d2e8eb2282..89dd7b035295 100644 --- a/drivers/watchdog/wm8350_wdt.c +++ b/drivers/watchdog/wm8350_wdt.c | |||
@@ -177,7 +177,7 @@ static ssize_t wm8350_wdt_write(struct file *file, | |||
177 | return count; | 177 | return count; |
178 | } | 178 | } |
179 | 179 | ||
180 | static struct watchdog_info ident = { | 180 | static const struct watchdog_info ident = { |
181 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, | 181 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, |
182 | .identity = "WM8350 Watchdog", | 182 | .identity = "WM8350 Watchdog", |
183 | }; | 183 | }; |
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/fscache/Kconfig b/fs/fscache/Kconfig index 864dac20a242..cc94bb9563f2 100644 --- a/fs/fscache/Kconfig +++ b/fs/fscache/Kconfig | |||
@@ -1,7 +1,6 @@ | |||
1 | 1 | ||
2 | config FSCACHE | 2 | config FSCACHE |
3 | tristate "General filesystem local caching manager" | 3 | tristate "General filesystem local caching manager" |
4 | depends on EXPERIMENTAL | ||
5 | select SLOW_WORK | 4 | select SLOW_WORK |
6 | help | 5 | help |
7 | This option enables a generic filesystem caching manager that can be | 6 | This option enables a generic filesystem caching manager that can be |
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..241b96bcd7ad 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; |
@@ -432,6 +451,10 @@ struct device { | |||
432 | 451 | ||
433 | static inline const char *dev_name(const struct device *dev) | 452 | static inline const char *dev_name(const struct device *dev) |
434 | { | 453 | { |
454 | /* Use the init name until the kobject becomes available */ | ||
455 | if (dev->init_name) | ||
456 | return dev->init_name; | ||
457 | |||
435 | return kobject_name(&dev->kobj); | 458 | return kobject_name(&dev->kobj); |
436 | } | 459 | } |
437 | 460 | ||
@@ -489,6 +512,21 @@ static inline bool device_async_suspend_enabled(struct device *dev) | |||
489 | return !!dev->power.async_suspend; | 512 | return !!dev->power.async_suspend; |
490 | } | 513 | } |
491 | 514 | ||
515 | static inline void device_lock(struct device *dev) | ||
516 | { | ||
517 | down(&dev->sem); | ||
518 | } | ||
519 | |||
520 | static inline int device_trylock(struct device *dev) | ||
521 | { | ||
522 | return down_trylock(&dev->sem); | ||
523 | } | ||
524 | |||
525 | static inline void device_unlock(struct device *dev) | ||
526 | { | ||
527 | up(&dev->sem); | ||
528 | } | ||
529 | |||
492 | void driver_init(void); | 530 | void driver_init(void); |
493 | 531 | ||
494 | /* | 532 | /* |
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/include/linux/usb/audio.h b/include/linux/usb/audio.h index 6bb293684eb8..4d3e450e2b03 100644 --- a/include/linux/usb/audio.h +++ b/include/linux/usb/audio.h | |||
@@ -269,8 +269,8 @@ struct uac_format_type_i_ext_descriptor { | |||
269 | __u8 bLength; | 269 | __u8 bLength; |
270 | __u8 bDescriptorType; | 270 | __u8 bDescriptorType; |
271 | __u8 bDescriptorSubtype; | 271 | __u8 bDescriptorSubtype; |
272 | __u8 bSubslotSize; | ||
273 | __u8 bFormatType; | 272 | __u8 bFormatType; |
273 | __u8 bSubslotSize; | ||
274 | __u8 bBitResolution; | 274 | __u8 bBitResolution; |
275 | __u8 bHeaderLength; | 275 | __u8 bHeaderLength; |
276 | __u8 bControlSize; | 276 | __u8 bControlSize; |
diff --git a/include/sound/asound.h b/include/sound/asound.h index 1f57bb92eb5a..098595500632 100644 --- a/include/sound/asound.h +++ b/include/sound/asound.h | |||
@@ -544,7 +544,7 @@ struct snd_rawmidi_status { | |||
544 | * Timer section - /dev/snd/timer | 544 | * Timer section - /dev/snd/timer |
545 | */ | 545 | */ |
546 | 546 | ||
547 | #define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 5) | 547 | #define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6) |
548 | 548 | ||
549 | enum { | 549 | enum { |
550 | SNDRV_TIMER_CLASS_NONE = -1, | 550 | SNDRV_TIMER_CLASS_NONE = -1, |
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[] = { |
diff --git a/sound/core/timer.c b/sound/core/timer.c index 8f8b17ac074d..73943651caed 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c | |||
@@ -393,7 +393,7 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event) | |||
393 | event == SNDRV_TIMER_EVENT_CONTINUE) | 393 | event == SNDRV_TIMER_EVENT_CONTINUE) |
394 | resolution = snd_timer_resolution(ti); | 394 | resolution = snd_timer_resolution(ti); |
395 | if (ti->ccallback) | 395 | if (ti->ccallback) |
396 | ti->ccallback(ti, SNDRV_TIMER_EVENT_START, &tstamp, resolution); | 396 | ti->ccallback(ti, event, &tstamp, resolution); |
397 | if (ti->flags & SNDRV_TIMER_IFLG_SLAVE) | 397 | if (ti->flags & SNDRV_TIMER_IFLG_SLAVE) |
398 | return; | 398 | return; |
399 | timer = ti->timer; | 399 | timer = ti->timer; |
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c index b865e45a8f9b..5913717c1be6 100644 --- a/sound/isa/opti9xx/miro.c +++ b/sound/isa/opti9xx/miro.c | |||
@@ -1558,7 +1558,7 @@ static int __devinit snd_card_miro_pnp(struct snd_miro *chip, | |||
1558 | 1558 | ||
1559 | err = pnp_activate_dev(devmc); | 1559 | err = pnp_activate_dev(devmc); |
1560 | if (err < 0) { | 1560 | if (err < 0) { |
1561 | snd_printk(KERN_ERR "OPL syntg pnp configure failure: %d\n", | 1561 | snd_printk(KERN_ERR "MC pnp configure failure: %d\n", |
1562 | err); | 1562 | err); |
1563 | return err; | 1563 | return err; |
1564 | } | 1564 | } |
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index a4af53b5c1cf..becd90d7536d 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c | |||
@@ -144,12 +144,8 @@ struct snd_opti9xx { | |||
144 | 144 | ||
145 | spinlock_t lock; | 145 | spinlock_t lock; |
146 | 146 | ||
147 | long wss_base; | ||
147 | int irq; | 148 | int irq; |
148 | |||
149 | #ifdef CONFIG_PNP | ||
150 | struct pnp_dev *dev; | ||
151 | struct pnp_dev *devmpu; | ||
152 | #endif /* CONFIG_PNP */ | ||
153 | }; | 149 | }; |
154 | 150 | ||
155 | static int snd_opti9xx_pnp_is_probed; | 151 | static int snd_opti9xx_pnp_is_probed; |
@@ -159,12 +155,17 @@ static int snd_opti9xx_pnp_is_probed; | |||
159 | static struct pnp_card_device_id snd_opti9xx_pnpids[] = { | 155 | static struct pnp_card_device_id snd_opti9xx_pnpids[] = { |
160 | #ifndef OPTi93X | 156 | #ifndef OPTi93X |
161 | /* OPTi 82C924 */ | 157 | /* OPTi 82C924 */ |
162 | { .id = "OPT0924", .devs = { { "OPT0000" }, { "OPT0002" } }, .driver_data = 0x0924 }, | 158 | { .id = "OPT0924", |
159 | .devs = { { "OPT0000" }, { "OPT0002" }, { "OPT0005" } }, | ||
160 | .driver_data = 0x0924 }, | ||
163 | /* OPTi 82C925 */ | 161 | /* OPTi 82C925 */ |
164 | { .id = "OPT0925", .devs = { { "OPT9250" }, { "OPT0002" } }, .driver_data = 0x0925 }, | 162 | { .id = "OPT0925", |
163 | .devs = { { "OPT9250" }, { "OPT0002" }, { "OPT0005" } }, | ||
164 | .driver_data = 0x0925 }, | ||
165 | #else | 165 | #else |
166 | /* OPTi 82C931/3 */ | 166 | /* OPTi 82C931/3 */ |
167 | { .id = "OPT0931", .devs = { { "OPT9310" }, { "OPT0002" } }, .driver_data = 0x0931 }, | 167 | { .id = "OPT0931", .devs = { { "OPT9310" }, { "OPT0002" } }, |
168 | .driver_data = 0x0931 }, | ||
168 | #endif /* OPTi93X */ | 169 | #endif /* OPTi93X */ |
169 | { .id = "" } | 170 | { .id = "" } |
170 | }; | 171 | }; |
@@ -207,24 +208,34 @@ static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip, | |||
207 | chip->hardware = hardware; | 208 | chip->hardware = hardware; |
208 | strcpy(chip->name, snd_opti9xx_names[hardware]); | 209 | strcpy(chip->name, snd_opti9xx_names[hardware]); |
209 | 210 | ||
210 | chip->mc_base_size = opti9xx_mc_size[hardware]; | ||
211 | |||
212 | spin_lock_init(&chip->lock); | 211 | spin_lock_init(&chip->lock); |
213 | 212 | ||
214 | chip->irq = -1; | 213 | chip->irq = -1; |
215 | 214 | ||
215 | #ifndef OPTi93X | ||
216 | #ifdef CONFIG_PNP | ||
217 | if (isapnp && chip->mc_base) | ||
218 | /* PnP resource gives the least 10 bits */ | ||
219 | chip->mc_base |= 0xc00; | ||
220 | #endif /* CONFIG_PNP */ | ||
221 | else { | ||
222 | chip->mc_base = 0xf8c; | ||
223 | chip->mc_base_size = opti9xx_mc_size[hardware]; | ||
224 | } | ||
225 | #else | ||
226 | chip->mc_base_size = opti9xx_mc_size[hardware]; | ||
227 | #endif | ||
228 | |||
216 | switch (hardware) { | 229 | switch (hardware) { |
217 | #ifndef OPTi93X | 230 | #ifndef OPTi93X |
218 | case OPTi9XX_HW_82C928: | 231 | case OPTi9XX_HW_82C928: |
219 | case OPTi9XX_HW_82C929: | 232 | case OPTi9XX_HW_82C929: |
220 | chip->mc_base = 0xf8c; | ||
221 | chip->password = (hardware == OPTi9XX_HW_82C928) ? 0xe2 : 0xe3; | 233 | chip->password = (hardware == OPTi9XX_HW_82C928) ? 0xe2 : 0xe3; |
222 | chip->pwd_reg = 3; | 234 | chip->pwd_reg = 3; |
223 | break; | 235 | break; |
224 | 236 | ||
225 | case OPTi9XX_HW_82C924: | 237 | case OPTi9XX_HW_82C924: |
226 | case OPTi9XX_HW_82C925: | 238 | case OPTi9XX_HW_82C925: |
227 | chip->mc_base = 0xf8c; | ||
228 | chip->password = 0xe5; | 239 | chip->password = 0xe5; |
229 | chip->pwd_reg = 3; | 240 | chip->pwd_reg = 3; |
230 | break; | 241 | break; |
@@ -292,7 +303,7 @@ static unsigned char snd_opti9xx_read(struct snd_opti9xx *chip, | |||
292 | spin_unlock_irqrestore(&chip->lock, flags); | 303 | spin_unlock_irqrestore(&chip->lock, flags); |
293 | return retval; | 304 | return retval; |
294 | } | 305 | } |
295 | 306 | ||
296 | static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg, | 307 | static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg, |
297 | unsigned char value) | 308 | unsigned char value) |
298 | { | 309 | { |
@@ -341,7 +352,7 @@ static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg, | |||
341 | 352 | ||
342 | 353 | ||
343 | static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, | 354 | static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, |
344 | long wss_base, | 355 | long port, |
345 | int irq, int dma1, int dma2, | 356 | int irq, int dma1, int dma2, |
346 | long mpu_port, int mpu_irq) | 357 | long mpu_port, int mpu_irq) |
347 | { | 358 | { |
@@ -354,16 +365,23 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, | |||
354 | switch (chip->hardware) { | 365 | switch (chip->hardware) { |
355 | #ifndef OPTi93X | 366 | #ifndef OPTi93X |
356 | case OPTi9XX_HW_82C924: | 367 | case OPTi9XX_HW_82C924: |
368 | /* opti 929 mode (?), OPL3 clock output, audio enable */ | ||
357 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(4), 0xf0, 0xfc); | 369 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(4), 0xf0, 0xfc); |
370 | /* enable wave audio */ | ||
358 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x02); | 371 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x02); |
359 | 372 | ||
360 | case OPTi9XX_HW_82C925: | 373 | case OPTi9XX_HW_82C925: |
374 | /* enable WSS mode */ | ||
361 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), 0x80, 0x80); | 375 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), 0x80, 0x80); |
376 | /* OPL3 FM synthesis */ | ||
362 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2), 0x00, 0x20); | 377 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2), 0x00, 0x20); |
378 | /* disable Sound Blaster IRQ and DMA */ | ||
363 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(3), 0xf0, 0xff); | 379 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(3), 0xf0, 0xff); |
364 | #ifdef CS4231 | 380 | #ifdef CS4231 |
381 | /* cs4231/4248 fix enabled */ | ||
365 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x02, 0x02); | 382 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x02, 0x02); |
366 | #else | 383 | #else |
384 | /* cs4231/4248 fix disabled */ | ||
367 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x00, 0x02); | 385 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x00, 0x02); |
368 | #endif /* CS4231 */ | 386 | #endif /* CS4231 */ |
369 | break; | 387 | break; |
@@ -411,21 +429,26 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, | |||
411 | return -EINVAL; | 429 | return -EINVAL; |
412 | } | 430 | } |
413 | 431 | ||
414 | switch (wss_base) { | 432 | /* PnP resource says it decodes only 10 bits of address */ |
415 | case 0x530: | 433 | switch (port & 0x3ff) { |
434 | case 0x130: | ||
435 | chip->wss_base = 0x530; | ||
416 | wss_base_bits = 0x00; | 436 | wss_base_bits = 0x00; |
417 | break; | 437 | break; |
418 | case 0x604: | 438 | case 0x204: |
439 | chip->wss_base = 0x604; | ||
419 | wss_base_bits = 0x03; | 440 | wss_base_bits = 0x03; |
420 | break; | 441 | break; |
421 | case 0xe80: | 442 | case 0x280: |
443 | chip->wss_base = 0xe80; | ||
422 | wss_base_bits = 0x01; | 444 | wss_base_bits = 0x01; |
423 | break; | 445 | break; |
424 | case 0xf40: | 446 | case 0x340: |
447 | chip->wss_base = 0xf40; | ||
425 | wss_base_bits = 0x02; | 448 | wss_base_bits = 0x02; |
426 | break; | 449 | break; |
427 | default: | 450 | default: |
428 | snd_printk(KERN_WARNING "WSS port 0x%lx not valid\n", wss_base); | 451 | snd_printk(KERN_WARNING "WSS port 0x%lx not valid\n", port); |
429 | goto __skip_base; | 452 | goto __skip_base; |
430 | } | 453 | } |
431 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), wss_base_bits << 4, 0x30); | 454 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), wss_base_bits << 4, 0x30); |
@@ -487,7 +510,7 @@ __skip_base: | |||
487 | #endif /* CS4231 || OPTi93X */ | 510 | #endif /* CS4231 || OPTi93X */ |
488 | 511 | ||
489 | #ifndef OPTi93X | 512 | #ifndef OPTi93X |
490 | outb(irq_bits << 3 | dma_bits, wss_base); | 513 | outb(irq_bits << 3 | dma_bits, chip->wss_base); |
491 | #else /* OPTi93X */ | 514 | #else /* OPTi93X */ |
492 | snd_opti9xx_write(chip, OPTi9XX_MC_REG(3), (irq_bits << 3 | dma_bits)); | 515 | snd_opti9xx_write(chip, OPTi9XX_MC_REG(3), (irq_bits << 3 | dma_bits)); |
493 | #endif /* OPTi93X */ | 516 | #endif /* OPTi93X */ |
@@ -729,15 +752,15 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip, | |||
729 | { | 752 | { |
730 | struct pnp_dev *pdev; | 753 | struct pnp_dev *pdev; |
731 | int err; | 754 | int err; |
755 | struct pnp_dev *devmpu; | ||
756 | #ifndef OPTi93X | ||
757 | struct pnp_dev *devmc; | ||
758 | #endif | ||
732 | 759 | ||
733 | chip->dev = pnp_request_card_device(card, pid->devs[0].id, NULL); | 760 | pdev = pnp_request_card_device(card, pid->devs[0].id, NULL); |
734 | if (chip->dev == NULL) | 761 | if (pdev == NULL) |
735 | return -EBUSY; | 762 | return -EBUSY; |
736 | 763 | ||
737 | chip->devmpu = pnp_request_card_device(card, pid->devs[1].id, NULL); | ||
738 | |||
739 | pdev = chip->dev; | ||
740 | |||
741 | err = pnp_activate_dev(pdev); | 764 | err = pnp_activate_dev(pdev); |
742 | if (err < 0) { | 765 | if (err < 0) { |
743 | snd_printk(KERN_ERR "AUDIO pnp configure failure: %d\n", err); | 766 | snd_printk(KERN_ERR "AUDIO pnp configure failure: %d\n", err); |
@@ -750,9 +773,24 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip, | |||
750 | chip->mc_indir_index = pnp_port_start(pdev, 3) + 2; | 773 | chip->mc_indir_index = pnp_port_start(pdev, 3) + 2; |
751 | chip->mc_indir_size = pnp_port_len(pdev, 3) - 2; | 774 | chip->mc_indir_size = pnp_port_len(pdev, 3) - 2; |
752 | #else | 775 | #else |
753 | if (pid->driver_data != 0x0924) | 776 | devmc = pnp_request_card_device(card, pid->devs[2].id, NULL); |
754 | port = pnp_port_start(pdev, 1); | 777 | if (devmc == NULL) |
778 | return -EBUSY; | ||
779 | |||
780 | err = pnp_activate_dev(devmc); | ||
781 | if (err < 0) { | ||
782 | snd_printk(KERN_ERR "MC pnp configure failure: %d\n", err); | ||
783 | return err; | ||
784 | } | ||
785 | |||
786 | port = pnp_port_start(pdev, 1); | ||
755 | fm_port = pnp_port_start(pdev, 2) + 8; | 787 | fm_port = pnp_port_start(pdev, 2) + 8; |
788 | /* | ||
789 | * The MC(0) is never accessed and card does not | ||
790 | * include it in the PnP resource range. OPTI93x include it. | ||
791 | */ | ||
792 | chip->mc_base = pnp_port_start(devmc, 0) - 1; | ||
793 | chip->mc_base_size = pnp_port_len(devmc, 0) + 1; | ||
756 | #endif /* OPTi93X */ | 794 | #endif /* OPTi93X */ |
757 | irq = pnp_irq(pdev, 0); | 795 | irq = pnp_irq(pdev, 0); |
758 | dma1 = pnp_dma(pdev, 0); | 796 | dma1 = pnp_dma(pdev, 0); |
@@ -760,16 +798,16 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip, | |||
760 | dma2 = pnp_dma(pdev, 1); | 798 | dma2 = pnp_dma(pdev, 1); |
761 | #endif /* CS4231 || OPTi93X */ | 799 | #endif /* CS4231 || OPTi93X */ |
762 | 800 | ||
763 | pdev = chip->devmpu; | 801 | devmpu = pnp_request_card_device(card, pid->devs[1].id, NULL); |
764 | if (pdev && mpu_port > 0) { | 802 | |
765 | err = pnp_activate_dev(pdev); | 803 | if (devmpu && mpu_port > 0) { |
804 | err = pnp_activate_dev(devmpu); | ||
766 | if (err < 0) { | 805 | if (err < 0) { |
767 | snd_printk(KERN_ERR "AUDIO pnp configure failure\n"); | 806 | snd_printk(KERN_ERR "MPU401 pnp configure failure\n"); |
768 | mpu_port = -1; | 807 | mpu_port = -1; |
769 | chip->devmpu = NULL; | ||
770 | } else { | 808 | } else { |
771 | mpu_port = pnp_port_start(pdev, 0); | 809 | mpu_port = pnp_port_start(devmpu, 0); |
772 | mpu_irq = pnp_irq(pdev, 0); | 810 | mpu_irq = pnp_irq(devmpu, 0); |
773 | } | 811 | } |
774 | } | 812 | } |
775 | return pid->driver_data; | 813 | return pid->driver_data; |
@@ -824,7 +862,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) | |||
824 | if (error) | 862 | if (error) |
825 | return error; | 863 | return error; |
826 | 864 | ||
827 | error = snd_wss_create(card, port + 4, -1, irq, dma1, xdma2, | 865 | error = snd_wss_create(card, chip->wss_base + 4, -1, irq, dma1, xdma2, |
828 | #ifdef OPTi93X | 866 | #ifdef OPTi93X |
829 | WSS_HW_OPTI93X, WSS_HWSHARE_IRQ, | 867 | WSS_HW_OPTI93X, WSS_HWSHARE_IRQ, |
830 | #else | 868 | #else |
@@ -865,10 +903,11 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) | |||
865 | sprintf(card->shortname, "OPTi %s", card->driver); | 903 | sprintf(card->shortname, "OPTi %s", card->driver); |
866 | #if defined(CS4231) || defined(OPTi93X) | 904 | #if defined(CS4231) || defined(OPTi93X) |
867 | sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d", | 905 | sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d", |
868 | card->shortname, pcm->name, port + 4, irq, dma1, xdma2); | 906 | card->shortname, pcm->name, |
907 | chip->wss_base + 4, irq, dma1, xdma2); | ||
869 | #else | 908 | #else |
870 | sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d", | 909 | sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d", |
871 | card->shortname, pcm->name, port + 4, irq, dma1); | 910 | card->shortname, pcm->name, chip->wss_base + 4, irq, dma1); |
872 | #endif /* CS4231 || OPTi93X */ | 911 | #endif /* CS4231 || OPTi93X */ |
873 | 912 | ||
874 | if (mpu_port <= 0 || mpu_port == SNDRV_AUTO_PORT) | 913 | if (mpu_port <= 0 || mpu_port == SNDRV_AUTO_PORT) |
@@ -1062,9 +1101,6 @@ static int __devinit snd_opti9xx_pnp_probe(struct pnp_card_link *pcard, | |||
1062 | snd_card_free(card); | 1101 | snd_card_free(card); |
1063 | return error; | 1102 | return error; |
1064 | } | 1103 | } |
1065 | if (hw <= OPTi9XX_HW_82C930) | ||
1066 | chip->mc_base -= 0x80; | ||
1067 | |||
1068 | error = snd_opti9xx_read_check(chip); | 1104 | error = snd_opti9xx_read_check(chip); |
1069 | if (error) { | 1105 | if (error) { |
1070 | snd_printk(KERN_ERR "OPTI chip not found\n"); | 1106 | snd_printk(KERN_ERR "OPTI chip not found\n"); |
diff --git a/sound/isa/sb/jazz16.c b/sound/isa/sb/jazz16.c index 8d21a3feda3a..8ccbcddf08e1 100644 --- a/sound/isa/sb/jazz16.c +++ b/sound/isa/sb/jazz16.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/delay.h> | ||
17 | #include <asm/dma.h> | 18 | #include <asm/dma.h> |
18 | #include <linux/isa.h> | 19 | #include <linux/isa.h> |
19 | #include <sound/core.h> | 20 | #include <sound/core.h> |
diff --git a/sound/oss/coproc.h b/sound/oss/coproc.h index 7306346e9ac4..7bec21bbdd88 100644 --- a/sound/oss/coproc.h +++ b/sound/oss/coproc.h | |||
@@ -4,7 +4,7 @@ | |||
4 | */ | 4 | */ |
5 | 5 | ||
6 | /* | 6 | /* |
7 | * Coprocessor access types | 7 | * Coprocessor access types |
8 | */ | 8 | */ |
9 | #define COPR_CUSTOM 0x0001 /* Custom applications */ | 9 | #define COPR_CUSTOM 0x0001 /* Custom applications */ |
10 | #define COPR_MIDI 0x0002 /* MIDI (MPU-401) emulation */ | 10 | #define COPR_MIDI 0x0002 /* MIDI (MPU-401) emulation */ |
diff --git a/sound/oss/v_midi.h b/sound/oss/v_midi.h index 1b86cb45c607..08e2185ee816 100644 --- a/sound/oss/v_midi.h +++ b/sound/oss/v_midi.h | |||
@@ -2,9 +2,9 @@ typedef struct vmidi_devc { | |||
2 | int dev; | 2 | int dev; |
3 | 3 | ||
4 | /* State variables */ | 4 | /* State variables */ |
5 | int opened; | 5 | int opened; |
6 | spinlock_t lock; | 6 | spinlock_t lock; |
7 | 7 | ||
8 | /* MIDI fields */ | 8 | /* MIDI fields */ |
9 | int my_mididev; | 9 | int my_mididev; |
10 | int pair_mididev; | 10 | int pair_mididev; |
@@ -12,4 +12,3 @@ typedef struct vmidi_devc { | |||
12 | int intr_active; | 12 | int intr_active; |
13 | void (*midi_input_intr) (int dev, unsigned char data); | 13 | void (*midi_input_intr) (int dev, unsigned char data); |
14 | } vmidi_devc; | 14 | } vmidi_devc; |
15 | |||
diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig index 556cff937be7..567348b05b5a 100644 --- a/sound/pci/hda/Kconfig +++ b/sound/pci/hda/Kconfig | |||
@@ -157,7 +157,7 @@ config SND_HDA_CODEC_INTELHDMI | |||
157 | 157 | ||
158 | config SND_HDA_ELD | 158 | config SND_HDA_ELD |
159 | def_bool y | 159 | def_bool y |
160 | depends on SND_HDA_CODEC_INTELHDMI | 160 | depends on SND_HDA_CODEC_INTELHDMI || SND_HDA_CODEC_NVHDMI |
161 | 161 | ||
162 | config SND_HDA_CODEC_CIRRUS | 162 | config SND_HDA_CODEC_CIRRUS |
163 | bool "Build Cirrus Logic codec support" | 163 | bool "Build Cirrus Logic codec support" |
diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile index 315a1c4f8998..24bc195b02da 100644 --- a/sound/pci/hda/Makefile +++ b/sound/pci/hda/Makefile | |||
@@ -3,7 +3,7 @@ snd-hda-intel-objs := hda_intel.o | |||
3 | snd-hda-codec-y := hda_codec.o | 3 | snd-hda-codec-y := hda_codec.o |
4 | snd-hda-codec-$(CONFIG_SND_HDA_GENERIC) += hda_generic.o | 4 | snd-hda-codec-$(CONFIG_SND_HDA_GENERIC) += hda_generic.o |
5 | snd-hda-codec-$(CONFIG_PROC_FS) += hda_proc.o | 5 | snd-hda-codec-$(CONFIG_PROC_FS) += hda_proc.o |
6 | # snd-hda-codec-$(CONFIG_SND_HDA_ELD) += hda_eld.o | 6 | snd-hda-codec-$(CONFIG_SND_HDA_ELD) += hda_eld.o |
7 | snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o | 7 | snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o |
8 | snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o | 8 | snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o |
9 | 9 | ||
@@ -18,7 +18,7 @@ snd-hda-codec-ca0110-objs := patch_ca0110.o | |||
18 | snd-hda-codec-conexant-objs := patch_conexant.o | 18 | snd-hda-codec-conexant-objs := patch_conexant.o |
19 | snd-hda-codec-via-objs := patch_via.o | 19 | snd-hda-codec-via-objs := patch_via.o |
20 | snd-hda-codec-nvhdmi-objs := patch_nvhdmi.o | 20 | snd-hda-codec-nvhdmi-objs := patch_nvhdmi.o |
21 | snd-hda-codec-intelhdmi-objs := patch_intelhdmi.o hda_eld.o | 21 | snd-hda-codec-intelhdmi-objs := patch_intelhdmi.o |
22 | 22 | ||
23 | # common driver | 23 | # common driver |
24 | obj-$(CONFIG_SND_HDA_INTEL) := snd-hda-codec.o | 24 | obj-$(CONFIG_SND_HDA_INTEL) := snd-hda-codec.o |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 76d3c4c049db..5bd7cf45f3a5 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -978,8 +978,9 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, | |||
978 | * | 978 | * |
979 | * Returns 0 if successful, or a negative error code. | 979 | * Returns 0 if successful, or a negative error code. |
980 | */ | 980 | */ |
981 | int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, | 981 | int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, |
982 | struct hda_codec **codecp) | 982 | unsigned int codec_addr, |
983 | struct hda_codec **codecp) | ||
983 | { | 984 | { |
984 | struct hda_codec *codec; | 985 | struct hda_codec *codec; |
985 | char component[31]; | 986 | char component[31]; |
@@ -1186,7 +1187,7 @@ EXPORT_SYMBOL_HDA(snd_hda_codec_cleanup_stream); | |||
1186 | */ | 1187 | */ |
1187 | 1188 | ||
1188 | /* FIXME: more better hash key? */ | 1189 | /* FIXME: more better hash key? */ |
1189 | #define HDA_HASH_KEY(nid,dir,idx) (u32)((nid) + ((idx) << 16) + ((dir) << 24)) | 1190 | #define HDA_HASH_KEY(nid, dir, idx) (u32)((nid) + ((idx) << 16) + ((dir) << 24)) |
1190 | #define HDA_HASH_PINCAP_KEY(nid) (u32)((nid) + (0x02 << 24)) | 1191 | #define HDA_HASH_PINCAP_KEY(nid) (u32)((nid) + (0x02 << 24)) |
1191 | #define HDA_HASH_PARPCM_KEY(nid) (u32)((nid) + (0x03 << 24)) | 1192 | #define HDA_HASH_PARPCM_KEY(nid) (u32)((nid) + (0x03 << 24)) |
1192 | #define HDA_HASH_PARSTR_KEY(nid) (u32)((nid) + (0x04 << 24)) | 1193 | #define HDA_HASH_PARSTR_KEY(nid) (u32)((nid) + (0x04 << 24)) |
@@ -1356,7 +1357,8 @@ u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid) | |||
1356 | if (!codec->no_trigger_sense) { | 1357 | if (!codec->no_trigger_sense) { |
1357 | pincap = snd_hda_query_pin_caps(codec, nid); | 1358 | pincap = snd_hda_query_pin_caps(codec, nid); |
1358 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ | 1359 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
1359 | snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0); | 1360 | snd_hda_codec_read(codec, nid, 0, |
1361 | AC_VERB_SET_PIN_SENSE, 0); | ||
1360 | } | 1362 | } |
1361 | return snd_hda_codec_read(codec, nid, 0, | 1363 | return snd_hda_codec_read(codec, nid, 0, |
1362 | AC_VERB_GET_PIN_SENSE, 0); | 1364 | AC_VERB_GET_PIN_SENSE, 0); |
@@ -1372,8 +1374,8 @@ EXPORT_SYMBOL_HDA(snd_hda_pin_sense); | |||
1372 | */ | 1374 | */ |
1373 | int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid) | 1375 | int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid) |
1374 | { | 1376 | { |
1375 | u32 sense = snd_hda_pin_sense(codec, nid); | 1377 | u32 sense = snd_hda_pin_sense(codec, nid); |
1376 | return !!(sense & AC_PINSENSE_PRESENCE); | 1378 | return !!(sense & AC_PINSENSE_PRESENCE); |
1377 | } | 1379 | } |
1378 | EXPORT_SYMBOL_HDA(snd_hda_jack_detect); | 1380 | EXPORT_SYMBOL_HDA(snd_hda_jack_detect); |
1379 | 1381 | ||
@@ -1952,7 +1954,7 @@ int snd_hda_add_vmaster(struct hda_codec *codec, char *name, | |||
1952 | err = snd_hda_ctl_add(codec, 0, kctl); | 1954 | err = snd_hda_ctl_add(codec, 0, kctl); |
1953 | if (err < 0) | 1955 | if (err < 0) |
1954 | return err; | 1956 | return err; |
1955 | 1957 | ||
1956 | for (s = slaves; *s; s++) { | 1958 | for (s = slaves; *s; s++) { |
1957 | struct snd_kcontrol *sctl; | 1959 | struct snd_kcontrol *sctl; |
1958 | int i = 0; | 1960 | int i = 0; |
@@ -2439,27 +2441,27 @@ static struct snd_kcontrol_new dig_mixes[] = { | |||
2439 | { | 2441 | { |
2440 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 2442 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
2441 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2443 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2442 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), | 2444 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, CON_MASK), |
2443 | .info = snd_hda_spdif_mask_info, | 2445 | .info = snd_hda_spdif_mask_info, |
2444 | .get = snd_hda_spdif_cmask_get, | 2446 | .get = snd_hda_spdif_cmask_get, |
2445 | }, | 2447 | }, |
2446 | { | 2448 | { |
2447 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 2449 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
2448 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2450 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2449 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), | 2451 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, PRO_MASK), |
2450 | .info = snd_hda_spdif_mask_info, | 2452 | .info = snd_hda_spdif_mask_info, |
2451 | .get = snd_hda_spdif_pmask_get, | 2453 | .get = snd_hda_spdif_pmask_get, |
2452 | }, | 2454 | }, |
2453 | { | 2455 | { |
2454 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2456 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2455 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), | 2457 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT), |
2456 | .info = snd_hda_spdif_mask_info, | 2458 | .info = snd_hda_spdif_mask_info, |
2457 | .get = snd_hda_spdif_default_get, | 2459 | .get = snd_hda_spdif_default_get, |
2458 | .put = snd_hda_spdif_default_put, | 2460 | .put = snd_hda_spdif_default_put, |
2459 | }, | 2461 | }, |
2460 | { | 2462 | { |
2461 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2463 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2462 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), | 2464 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, SWITCH), |
2463 | .info = snd_hda_spdif_out_switch_info, | 2465 | .info = snd_hda_spdif_out_switch_info, |
2464 | .get = snd_hda_spdif_out_switch_get, | 2466 | .get = snd_hda_spdif_out_switch_get, |
2465 | .put = snd_hda_spdif_out_switch_put, | 2467 | .put = snd_hda_spdif_out_switch_put, |
@@ -2610,7 +2612,7 @@ static int snd_hda_spdif_in_status_get(struct snd_kcontrol *kcontrol, | |||
2610 | static struct snd_kcontrol_new dig_in_ctls[] = { | 2612 | static struct snd_kcontrol_new dig_in_ctls[] = { |
2611 | { | 2613 | { |
2612 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2614 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2613 | .name = SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), | 2615 | .name = SNDRV_CTL_NAME_IEC958("", CAPTURE, SWITCH), |
2614 | .info = snd_hda_spdif_in_switch_info, | 2616 | .info = snd_hda_spdif_in_switch_info, |
2615 | .get = snd_hda_spdif_in_switch_get, | 2617 | .get = snd_hda_spdif_in_switch_get, |
2616 | .put = snd_hda_spdif_in_switch_put, | 2618 | .put = snd_hda_spdif_in_switch_put, |
@@ -2618,7 +2620,7 @@ static struct snd_kcontrol_new dig_in_ctls[] = { | |||
2618 | { | 2620 | { |
2619 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 2621 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
2620 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2622 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2621 | .name = SNDRV_CTL_NAME_IEC958("",CAPTURE,DEFAULT), | 2623 | .name = SNDRV_CTL_NAME_IEC958("", CAPTURE, DEFAULT), |
2622 | .info = snd_hda_spdif_mask_info, | 2624 | .info = snd_hda_spdif_mask_info, |
2623 | .get = snd_hda_spdif_in_status_get, | 2625 | .get = snd_hda_spdif_in_status_get, |
2624 | }, | 2626 | }, |
@@ -2883,7 +2885,7 @@ int /*__devinit*/ snd_hda_build_controls(struct hda_bus *bus) | |||
2883 | int err = snd_hda_codec_build_controls(codec); | 2885 | int err = snd_hda_codec_build_controls(codec); |
2884 | if (err < 0) { | 2886 | if (err < 0) { |
2885 | printk(KERN_ERR "hda_codec: cannot build controls" | 2887 | printk(KERN_ERR "hda_codec: cannot build controls" |
2886 | "for #%d (error %d)\n", codec->addr, err); | 2888 | "for #%d (error %d)\n", codec->addr, err); |
2887 | err = snd_hda_codec_reset(codec); | 2889 | err = snd_hda_codec_reset(codec); |
2888 | if (err < 0) { | 2890 | if (err < 0) { |
2889 | printk(KERN_ERR | 2891 | printk(KERN_ERR |
@@ -2979,8 +2981,12 @@ unsigned int snd_hda_calc_stream_format(unsigned int rate, | |||
2979 | val |= channels - 1; | 2981 | val |= channels - 1; |
2980 | 2982 | ||
2981 | switch (snd_pcm_format_width(format)) { | 2983 | switch (snd_pcm_format_width(format)) { |
2982 | case 8: val |= 0x00; break; | 2984 | case 8: |
2983 | case 16: val |= 0x10; break; | 2985 | val |= 0x00; |
2986 | break; | ||
2987 | case 16: | ||
2988 | val |= 0x10; | ||
2989 | break; | ||
2984 | case 20: | 2990 | case 20: |
2985 | case 24: | 2991 | case 24: |
2986 | case 32: | 2992 | case 32: |
@@ -3298,7 +3304,8 @@ static int get_empty_pcm_device(struct hda_bus *bus, int type) | |||
3298 | if (!test_and_set_bit(audio_idx[type][i], bus->pcm_dev_bits)) | 3304 | if (!test_and_set_bit(audio_idx[type][i], bus->pcm_dev_bits)) |
3299 | return audio_idx[type][i]; | 3305 | return audio_idx[type][i]; |
3300 | 3306 | ||
3301 | snd_printk(KERN_WARNING "Too many %s devices\n", snd_hda_pcm_type_name[type]); | 3307 | snd_printk(KERN_WARNING "Too many %s devices\n", |
3308 | snd_hda_pcm_type_name[type]); | ||
3302 | return -EAGAIN; | 3309 | return -EAGAIN; |
3303 | } | 3310 | } |
3304 | 3311 | ||
@@ -3336,7 +3343,7 @@ int snd_hda_codec_build_pcms(struct hda_codec *codec) | |||
3336 | err = codec->patch_ops.build_pcms(codec); | 3343 | err = codec->patch_ops.build_pcms(codec); |
3337 | if (err < 0) { | 3344 | if (err < 0) { |
3338 | printk(KERN_ERR "hda_codec: cannot build PCMs" | 3345 | printk(KERN_ERR "hda_codec: cannot build PCMs" |
3339 | "for #%d (error %d)\n", codec->addr, err); | 3346 | "for #%d (error %d)\n", codec->addr, err); |
3340 | err = snd_hda_codec_reset(codec); | 3347 | err = snd_hda_codec_reset(codec); |
3341 | if (err < 0) { | 3348 | if (err < 0) { |
3342 | printk(KERN_ERR | 3349 | printk(KERN_ERR |
@@ -3466,8 +3473,8 @@ EXPORT_SYMBOL_HDA(snd_hda_check_board_config); | |||
3466 | 3473 | ||
3467 | /** | 3474 | /** |
3468 | * snd_hda_check_board_codec_sid_config - compare the current codec | 3475 | * snd_hda_check_board_codec_sid_config - compare the current codec |
3469 | subsystem ID with the | 3476 | subsystem ID with the |
3470 | config table | 3477 | config table |
3471 | 3478 | ||
3472 | This is important for Gateway notebooks with SB450 HDA Audio | 3479 | This is important for Gateway notebooks with SB450 HDA Audio |
3473 | where the vendor ID of the PCI device is: | 3480 | where the vendor ID of the PCI device is: |
@@ -3607,7 +3614,7 @@ void snd_hda_update_power_acct(struct hda_codec *codec) | |||
3607 | * | 3614 | * |
3608 | * Increment the power-up counter and power up the hardware really when | 3615 | * Increment the power-up counter and power up the hardware really when |
3609 | * not turned on yet. | 3616 | * not turned on yet. |
3610 | */ | 3617 | */ |
3611 | void snd_hda_power_up(struct hda_codec *codec) | 3618 | void snd_hda_power_up(struct hda_codec *codec) |
3612 | { | 3619 | { |
3613 | struct hda_bus *bus = codec->bus; | 3620 | struct hda_bus *bus = codec->bus; |
@@ -3636,7 +3643,7 @@ EXPORT_SYMBOL_HDA(snd_hda_power_up); | |||
3636 | * | 3643 | * |
3637 | * Decrement the power-up counter and schedules the power-off work if | 3644 | * Decrement the power-up counter and schedules the power-off work if |
3638 | * the counter rearches to zero. | 3645 | * the counter rearches to zero. |
3639 | */ | 3646 | */ |
3640 | void snd_hda_power_down(struct hda_codec *codec) | 3647 | void snd_hda_power_down(struct hda_codec *codec) |
3641 | { | 3648 | { |
3642 | --codec->power_count; | 3649 | --codec->power_count; |
@@ -3662,7 +3669,7 @@ EXPORT_SYMBOL_HDA(snd_hda_power_down); | |||
3662 | * | 3669 | * |
3663 | * This function is supposed to be set or called from the check_power_status | 3670 | * This function is supposed to be set or called from the check_power_status |
3664 | * patch ops. | 3671 | * patch ops. |
3665 | */ | 3672 | */ |
3666 | int snd_hda_check_amp_list_power(struct hda_codec *codec, | 3673 | int snd_hda_check_amp_list_power(struct hda_codec *codec, |
3667 | struct hda_loopback_check *check, | 3674 | struct hda_loopback_check *check, |
3668 | hda_nid_t nid) | 3675 | hda_nid_t nid) |
@@ -3830,7 +3837,7 @@ static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid, | |||
3830 | { | 3837 | { |
3831 | /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */ | 3838 | /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */ |
3832 | if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE)) | 3839 | if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE)) |
3833 | set_dig_out_convert(codec, nid, | 3840 | set_dig_out_convert(codec, nid, |
3834 | codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff, | 3841 | codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff, |
3835 | -1); | 3842 | -1); |
3836 | snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format); | 3843 | snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format); |
@@ -4089,13 +4096,13 @@ static int is_in_nid_list(hda_nid_t nid, hda_nid_t *list) | |||
4089 | /* | 4096 | /* |
4090 | * Sort an associated group of pins according to their sequence numbers. | 4097 | * Sort an associated group of pins according to their sequence numbers. |
4091 | */ | 4098 | */ |
4092 | static void sort_pins_by_sequence(hda_nid_t * pins, short * sequences, | 4099 | static void sort_pins_by_sequence(hda_nid_t *pins, short *sequences, |
4093 | int num_pins) | 4100 | int num_pins) |
4094 | { | 4101 | { |
4095 | int i, j; | 4102 | int i, j; |
4096 | short seq; | 4103 | short seq; |
4097 | hda_nid_t nid; | 4104 | hda_nid_t nid; |
4098 | 4105 | ||
4099 | for (i = 0; i < num_pins; i++) { | 4106 | for (i = 0; i < num_pins; i++) { |
4100 | for (j = i + 1; j < num_pins; j++) { | 4107 | for (j = i + 1; j < num_pins; j++) { |
4101 | if (sequences[i] > sequences[j]) { | 4108 | if (sequences[i] > sequences[j]) { |
@@ -4123,7 +4130,7 @@ static void sort_pins_by_sequence(hda_nid_t * pins, short * sequences, | |||
4123 | * is detected, one of speaker of HP pins is assigned as the primary | 4130 | * is detected, one of speaker of HP pins is assigned as the primary |
4124 | * output, i.e. to line_out_pins[0]. So, line_outs is always positive | 4131 | * output, i.e. to line_out_pins[0]. So, line_outs is always positive |
4125 | * if any analog output exists. | 4132 | * if any analog output exists. |
4126 | * | 4133 | * |
4127 | * The analog input pins are assigned to input_pins array. | 4134 | * The analog input pins are assigned to input_pins array. |
4128 | * The digital input/output pins are assigned to dig_in_pin and dig_out_pin, | 4135 | * The digital input/output pins are assigned to dig_in_pin and dig_out_pin, |
4129 | * respectively. | 4136 | * respectively. |
@@ -4186,9 +4193,9 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, | |||
4186 | case AC_JACK_SPEAKER: | 4193 | case AC_JACK_SPEAKER: |
4187 | seq = get_defcfg_sequence(def_conf); | 4194 | seq = get_defcfg_sequence(def_conf); |
4188 | assoc = get_defcfg_association(def_conf); | 4195 | assoc = get_defcfg_association(def_conf); |
4189 | if (! assoc) | 4196 | if (!assoc) |
4190 | continue; | 4197 | continue; |
4191 | if (! assoc_speaker) | 4198 | if (!assoc_speaker) |
4192 | assoc_speaker = assoc; | 4199 | assoc_speaker = assoc; |
4193 | else if (assoc_speaker != assoc) | 4200 | else if (assoc_speaker != assoc) |
4194 | continue; | 4201 | continue; |
@@ -4286,7 +4293,7 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, | |||
4286 | cfg->speaker_outs); | 4293 | cfg->speaker_outs); |
4287 | sort_pins_by_sequence(cfg->hp_pins, sequences_hp, | 4294 | sort_pins_by_sequence(cfg->hp_pins, sequences_hp, |
4288 | cfg->hp_outs); | 4295 | cfg->hp_outs); |
4289 | 4296 | ||
4290 | /* if we have only one mic, make it AUTO_PIN_MIC */ | 4297 | /* if we have only one mic, make it AUTO_PIN_MIC */ |
4291 | if (!cfg->input_pins[AUTO_PIN_MIC] && | 4298 | if (!cfg->input_pins[AUTO_PIN_MIC] && |
4292 | cfg->input_pins[AUTO_PIN_FRONT_MIC]) { | 4299 | cfg->input_pins[AUTO_PIN_FRONT_MIC]) { |
@@ -4436,7 +4443,7 @@ EXPORT_SYMBOL_HDA(snd_hda_resume); | |||
4436 | /** | 4443 | /** |
4437 | * snd_array_new - get a new element from the given array | 4444 | * snd_array_new - get a new element from the given array |
4438 | * @array: the array object | 4445 | * @array: the array object |
4439 | * | 4446 | * |
4440 | * Get a new element from the given array. If it exceeds the | 4447 | * Get a new element from the given array. If it exceeds the |
4441 | * pre-allocated array size, re-allocate the array. | 4448 | * pre-allocated array size, re-allocate the array. |
4442 | * | 4449 | * |
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c index 4228f2fe5956..dcd22446cfc7 100644 --- a/sound/pci/hda/hda_eld.c +++ b/sound/pci/hda/hda_eld.c | |||
@@ -331,6 +331,7 @@ int snd_hdmi_get_eld_size(struct hda_codec *codec, hda_nid_t nid) | |||
331 | return snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_HDMI_DIP_SIZE, | 331 | return snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_HDMI_DIP_SIZE, |
332 | AC_DIPSIZE_ELD_BUF); | 332 | AC_DIPSIZE_ELD_BUF); |
333 | } | 333 | } |
334 | EXPORT_SYMBOL_HDA(snd_hdmi_get_eld_size); | ||
334 | 335 | ||
335 | int snd_hdmi_get_eld(struct hdmi_eld *eld, | 336 | int snd_hdmi_get_eld(struct hdmi_eld *eld, |
336 | struct hda_codec *codec, hda_nid_t nid) | 337 | struct hda_codec *codec, hda_nid_t nid) |
@@ -366,6 +367,7 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld, | |||
366 | kfree(buf); | 367 | kfree(buf); |
367 | return ret; | 368 | return ret; |
368 | } | 369 | } |
370 | EXPORT_SYMBOL_HDA(snd_hdmi_get_eld); | ||
369 | 371 | ||
370 | static void hdmi_show_short_audio_desc(struct cea_sad *a) | 372 | static void hdmi_show_short_audio_desc(struct cea_sad *a) |
371 | { | 373 | { |
@@ -404,6 +406,7 @@ void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen) | |||
404 | } | 406 | } |
405 | buf[j] = '\0'; /* necessary when j == 0 */ | 407 | buf[j] = '\0'; /* necessary when j == 0 */ |
406 | } | 408 | } |
409 | EXPORT_SYMBOL_HDA(snd_print_channel_allocation); | ||
407 | 410 | ||
408 | void snd_hdmi_show_eld(struct hdmi_eld *e) | 411 | void snd_hdmi_show_eld(struct hdmi_eld *e) |
409 | { | 412 | { |
@@ -422,6 +425,7 @@ void snd_hdmi_show_eld(struct hdmi_eld *e) | |||
422 | for (i = 0; i < e->sad_count; i++) | 425 | for (i = 0; i < e->sad_count; i++) |
423 | hdmi_show_short_audio_desc(e->sad + i); | 426 | hdmi_show_short_audio_desc(e->sad + i); |
424 | } | 427 | } |
428 | EXPORT_SYMBOL_HDA(snd_hdmi_show_eld); | ||
425 | 429 | ||
426 | #ifdef CONFIG_PROC_FS | 430 | #ifdef CONFIG_PROC_FS |
427 | 431 | ||
@@ -580,6 +584,7 @@ int snd_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld, | |||
580 | 584 | ||
581 | return 0; | 585 | return 0; |
582 | } | 586 | } |
587 | EXPORT_SYMBOL_HDA(snd_hda_eld_proc_new); | ||
583 | 588 | ||
584 | void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld) | 589 | void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld) |
585 | { | 590 | { |
@@ -588,5 +593,6 @@ void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld) | |||
588 | eld->proc_entry = NULL; | 593 | eld->proc_entry = NULL; |
589 | } | 594 | } |
590 | } | 595 | } |
596 | EXPORT_SYMBOL_HDA(snd_hda_eld_proc_free); | ||
591 | 597 | ||
592 | #endif /* CONFIG_PROC_FS */ | 598 | #endif /* CONFIG_PROC_FS */ |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index d5c93ad852ee..43b7cfb7cffd 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -267,7 +267,8 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; | |||
267 | #define RIRB_INT_MASK 0x05 | 267 | #define RIRB_INT_MASK 0x05 |
268 | 268 | ||
269 | /* STATESTS int mask: S3,SD2,SD1,SD0 */ | 269 | /* STATESTS int mask: S3,SD2,SD1,SD0 */ |
270 | #define AZX_MAX_CODECS 4 | 270 | #define AZX_MAX_CODECS 8 |
271 | #define AZX_DEFAULT_CODECS 4 | ||
271 | #define STATESTS_INT_MASK ((1 << AZX_MAX_CODECS) - 1) | 272 | #define STATESTS_INT_MASK ((1 << AZX_MAX_CODECS) - 1) |
272 | 273 | ||
273 | /* SD_CTL bits */ | 274 | /* SD_CTL bits */ |
@@ -1367,6 +1368,7 @@ static void azx_bus_reset(struct hda_bus *bus) | |||
1367 | 1368 | ||
1368 | /* number of codec slots for each chipset: 0 = default slots (i.e. 4) */ | 1369 | /* number of codec slots for each chipset: 0 = default slots (i.e. 4) */ |
1369 | static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] __devinitdata = { | 1370 | static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] __devinitdata = { |
1371 | [AZX_DRIVER_NVIDIA] = 8, | ||
1370 | [AZX_DRIVER_TERA] = 1, | 1372 | [AZX_DRIVER_TERA] = 1, |
1371 | }; | 1373 | }; |
1372 | 1374 | ||
@@ -1399,7 +1401,7 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model) | |||
1399 | codecs = 0; | 1401 | codecs = 0; |
1400 | max_slots = azx_max_codecs[chip->driver_type]; | 1402 | max_slots = azx_max_codecs[chip->driver_type]; |
1401 | if (!max_slots) | 1403 | if (!max_slots) |
1402 | max_slots = AZX_MAX_CODECS; | 1404 | max_slots = AZX_DEFAULT_CODECS; |
1403 | 1405 | ||
1404 | /* First try to probe all given codec slots */ | 1406 | /* First try to probe all given codec slots */ |
1405 | for (c = 0; c < max_slots; c++) { | 1407 | for (c = 0; c < max_slots; c++) { |
@@ -2263,10 +2265,12 @@ static int azx_dev_free(struct snd_device *device) | |||
2263 | static struct snd_pci_quirk position_fix_list[] __devinitdata = { | 2265 | static struct snd_pci_quirk position_fix_list[] __devinitdata = { |
2264 | SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB), | 2266 | SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB), |
2265 | SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), | 2267 | SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), |
2268 | SND_PCI_QUIRK(0x1028, 0x01f6, "Dell Latitude 131L", POS_FIX_LPIB), | ||
2266 | SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB), | 2269 | SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB), |
2267 | SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB), | 2270 | SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB), |
2268 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), | 2271 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), |
2269 | SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB), | 2272 | SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB), |
2273 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar Microtech", POS_FIX_LPIB), | ||
2270 | {} | 2274 | {} |
2271 | }; | 2275 | }; |
2272 | 2276 | ||
@@ -2354,6 +2358,7 @@ static void __devinit check_probe_mask(struct azx *chip, int dev) | |||
2354 | static struct snd_pci_quirk msi_black_list[] __devinitdata = { | 2358 | static struct snd_pci_quirk msi_black_list[] __devinitdata = { |
2355 | SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */ | 2359 | SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */ |
2356 | SND_PCI_QUIRK(0x1043, 0x81f6, "ASUS", 0), /* nvidia */ | 2360 | SND_PCI_QUIRK(0x1043, 0x81f6, "ASUS", 0), /* nvidia */ |
2361 | SND_PCI_QUIRK(0x1849, 0x0888, "ASRock", 0), /* Athlon64 X2 + nvidia */ | ||
2357 | {} | 2362 | {} |
2358 | }; | 2363 | }; |
2359 | 2364 | ||
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c new file mode 100644 index 000000000000..2c2bafbf0258 --- /dev/null +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -0,0 +1,849 @@ | |||
1 | /* | ||
2 | * | ||
3 | * patch_hdmi.c - routines for HDMI/DisplayPort codecs | ||
4 | * | ||
5 | * Copyright(c) 2008-2010 Intel Corporation. All rights reserved. | ||
6 | * | ||
7 | * Authors: | ||
8 | * Wu Fengguang <wfg@linux.intel.com> | ||
9 | * | ||
10 | * Maintained by: | ||
11 | * Wu Fengguang <wfg@linux.intel.com> | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify it | ||
14 | * under the terms of the GNU General Public License as published by the Free | ||
15 | * Software Foundation; either version 2 of the License, or (at your option) | ||
16 | * any later version. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, but | ||
19 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
20 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
21 | * for more details. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License | ||
24 | * along with this program; if not, write to the Free Software Foundation, | ||
25 | * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
26 | */ | ||
27 | |||
28 | |||
29 | struct hdmi_spec { | ||
30 | int num_cvts; | ||
31 | int num_pins; | ||
32 | hda_nid_t cvt[MAX_HDMI_CVTS+1]; /* audio sources */ | ||
33 | hda_nid_t pin[MAX_HDMI_PINS+1]; /* audio sinks */ | ||
34 | |||
35 | /* | ||
36 | * source connection for each pin | ||
37 | */ | ||
38 | hda_nid_t pin_cvt[MAX_HDMI_PINS+1]; | ||
39 | |||
40 | /* | ||
41 | * HDMI sink attached to each pin | ||
42 | */ | ||
43 | struct hdmi_eld sink_eld[MAX_HDMI_PINS]; | ||
44 | |||
45 | /* | ||
46 | * export one pcm per pipe | ||
47 | */ | ||
48 | struct hda_pcm pcm_rec[MAX_HDMI_CVTS]; | ||
49 | |||
50 | /* | ||
51 | * nvhdmi specific | ||
52 | */ | ||
53 | struct hda_multi_out multiout; | ||
54 | unsigned int codec_type; | ||
55 | }; | ||
56 | |||
57 | |||
58 | struct hdmi_audio_infoframe { | ||
59 | u8 type; /* 0x84 */ | ||
60 | u8 ver; /* 0x01 */ | ||
61 | u8 len; /* 0x0a */ | ||
62 | |||
63 | u8 checksum; /* PB0 */ | ||
64 | u8 CC02_CT47; /* CC in bits 0:2, CT in 4:7 */ | ||
65 | u8 SS01_SF24; | ||
66 | u8 CXT04; | ||
67 | u8 CA; | ||
68 | u8 LFEPBL01_LSV36_DM_INH7; | ||
69 | u8 reserved[5]; /* PB6 - PB10 */ | ||
70 | }; | ||
71 | |||
72 | /* | ||
73 | * CEA speaker placement: | ||
74 | * | ||
75 | * FLH FCH FRH | ||
76 | * FLW FL FLC FC FRC FR FRW | ||
77 | * | ||
78 | * LFE | ||
79 | * TC | ||
80 | * | ||
81 | * RL RLC RC RRC RR | ||
82 | * | ||
83 | * The Left/Right Surround channel _notions_ LS/RS in SMPTE 320M corresponds to | ||
84 | * CEA RL/RR; The SMPTE channel _assignment_ C/LFE is swapped to CEA LFE/FC. | ||
85 | */ | ||
86 | enum cea_speaker_placement { | ||
87 | FL = (1 << 0), /* Front Left */ | ||
88 | FC = (1 << 1), /* Front Center */ | ||
89 | FR = (1 << 2), /* Front Right */ | ||
90 | FLC = (1 << 3), /* Front Left Center */ | ||
91 | FRC = (1 << 4), /* Front Right Center */ | ||
92 | RL = (1 << 5), /* Rear Left */ | ||
93 | RC = (1 << 6), /* Rear Center */ | ||
94 | RR = (1 << 7), /* Rear Right */ | ||
95 | RLC = (1 << 8), /* Rear Left Center */ | ||
96 | RRC = (1 << 9), /* Rear Right Center */ | ||
97 | LFE = (1 << 10), /* Low Frequency Effect */ | ||
98 | FLW = (1 << 11), /* Front Left Wide */ | ||
99 | FRW = (1 << 12), /* Front Right Wide */ | ||
100 | FLH = (1 << 13), /* Front Left High */ | ||
101 | FCH = (1 << 14), /* Front Center High */ | ||
102 | FRH = (1 << 15), /* Front Right High */ | ||
103 | TC = (1 << 16), /* Top Center */ | ||
104 | }; | ||
105 | |||
106 | /* | ||
107 | * ELD SA bits in the CEA Speaker Allocation data block | ||
108 | */ | ||
109 | static int eld_speaker_allocation_bits[] = { | ||
110 | [0] = FL | FR, | ||
111 | [1] = LFE, | ||
112 | [2] = FC, | ||
113 | [3] = RL | RR, | ||
114 | [4] = RC, | ||
115 | [5] = FLC | FRC, | ||
116 | [6] = RLC | RRC, | ||
117 | /* the following are not defined in ELD yet */ | ||
118 | [7] = FLW | FRW, | ||
119 | [8] = FLH | FRH, | ||
120 | [9] = TC, | ||
121 | [10] = FCH, | ||
122 | }; | ||
123 | |||
124 | struct cea_channel_speaker_allocation { | ||
125 | int ca_index; | ||
126 | int speakers[8]; | ||
127 | |||
128 | /* derived values, just for convenience */ | ||
129 | int channels; | ||
130 | int spk_mask; | ||
131 | }; | ||
132 | |||
133 | /* | ||
134 | * ALSA sequence is: | ||
135 | * | ||
136 | * surround40 surround41 surround50 surround51 surround71 | ||
137 | * ch0 front left = = = = | ||
138 | * ch1 front right = = = = | ||
139 | * ch2 rear left = = = = | ||
140 | * ch3 rear right = = = = | ||
141 | * ch4 LFE center center center | ||
142 | * ch5 LFE LFE | ||
143 | * ch6 side left | ||
144 | * ch7 side right | ||
145 | * | ||
146 | * surround71 = {FL, FR, RLC, RRC, FC, LFE, RL, RR} | ||
147 | */ | ||
148 | static int hdmi_channel_mapping[0x32][8] = { | ||
149 | /* stereo */ | ||
150 | [0x00] = { 0x00, 0x11, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7 }, | ||
151 | /* 2.1 */ | ||
152 | [0x01] = { 0x00, 0x11, 0x22, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7 }, | ||
153 | /* Dolby Surround */ | ||
154 | [0x02] = { 0x00, 0x11, 0x23, 0xf2, 0xf4, 0xf5, 0xf6, 0xf7 }, | ||
155 | /* surround40 */ | ||
156 | [0x08] = { 0x00, 0x11, 0x24, 0x35, 0xf3, 0xf2, 0xf6, 0xf7 }, | ||
157 | /* 4ch */ | ||
158 | [0x03] = { 0x00, 0x11, 0x23, 0x32, 0x44, 0xf5, 0xf6, 0xf7 }, | ||
159 | /* surround41 */ | ||
160 | [0x09] = { 0x00, 0x11, 0x24, 0x34, 0x43, 0xf2, 0xf6, 0xf7 }, | ||
161 | /* surround50 */ | ||
162 | [0x0a] = { 0x00, 0x11, 0x24, 0x35, 0x43, 0xf2, 0xf6, 0xf7 }, | ||
163 | /* surround51 */ | ||
164 | [0x0b] = { 0x00, 0x11, 0x24, 0x35, 0x43, 0x52, 0xf6, 0xf7 }, | ||
165 | /* 7.1 */ | ||
166 | [0x13] = { 0x00, 0x11, 0x26, 0x37, 0x43, 0x52, 0x64, 0x75 }, | ||
167 | }; | ||
168 | |||
169 | /* | ||
170 | * This is an ordered list! | ||
171 | * | ||
172 | * The preceding ones have better chances to be selected by | ||
173 | * hdmi_setup_channel_allocation(). | ||
174 | */ | ||
175 | static struct cea_channel_speaker_allocation channel_allocations[] = { | ||
176 | /* channel: 7 6 5 4 3 2 1 0 */ | ||
177 | { .ca_index = 0x00, .speakers = { 0, 0, 0, 0, 0, 0, FR, FL } }, | ||
178 | /* 2.1 */ | ||
179 | { .ca_index = 0x01, .speakers = { 0, 0, 0, 0, 0, LFE, FR, FL } }, | ||
180 | /* Dolby Surround */ | ||
181 | { .ca_index = 0x02, .speakers = { 0, 0, 0, 0, FC, 0, FR, FL } }, | ||
182 | /* surround40 */ | ||
183 | { .ca_index = 0x08, .speakers = { 0, 0, RR, RL, 0, 0, FR, FL } }, | ||
184 | /* surround41 */ | ||
185 | { .ca_index = 0x09, .speakers = { 0, 0, RR, RL, 0, LFE, FR, FL } }, | ||
186 | /* surround50 */ | ||
187 | { .ca_index = 0x0a, .speakers = { 0, 0, RR, RL, FC, 0, FR, FL } }, | ||
188 | /* surround51 */ | ||
189 | { .ca_index = 0x0b, .speakers = { 0, 0, RR, RL, FC, LFE, FR, FL } }, | ||
190 | /* 6.1 */ | ||
191 | { .ca_index = 0x0f, .speakers = { 0, RC, RR, RL, FC, LFE, FR, FL } }, | ||
192 | /* surround71 */ | ||
193 | { .ca_index = 0x13, .speakers = { RRC, RLC, RR, RL, FC, LFE, FR, FL } }, | ||
194 | |||
195 | { .ca_index = 0x03, .speakers = { 0, 0, 0, 0, FC, LFE, FR, FL } }, | ||
196 | { .ca_index = 0x04, .speakers = { 0, 0, 0, RC, 0, 0, FR, FL } }, | ||
197 | { .ca_index = 0x05, .speakers = { 0, 0, 0, RC, 0, LFE, FR, FL } }, | ||
198 | { .ca_index = 0x06, .speakers = { 0, 0, 0, RC, FC, 0, FR, FL } }, | ||
199 | { .ca_index = 0x07, .speakers = { 0, 0, 0, RC, FC, LFE, FR, FL } }, | ||
200 | { .ca_index = 0x0c, .speakers = { 0, RC, RR, RL, 0, 0, FR, FL } }, | ||
201 | { .ca_index = 0x0d, .speakers = { 0, RC, RR, RL, 0, LFE, FR, FL } }, | ||
202 | { .ca_index = 0x0e, .speakers = { 0, RC, RR, RL, FC, 0, FR, FL } }, | ||
203 | { .ca_index = 0x10, .speakers = { RRC, RLC, RR, RL, 0, 0, FR, FL } }, | ||
204 | { .ca_index = 0x11, .speakers = { RRC, RLC, RR, RL, 0, LFE, FR, FL } }, | ||
205 | { .ca_index = 0x12, .speakers = { RRC, RLC, RR, RL, FC, 0, FR, FL } }, | ||
206 | { .ca_index = 0x14, .speakers = { FRC, FLC, 0, 0, 0, 0, FR, FL } }, | ||
207 | { .ca_index = 0x15, .speakers = { FRC, FLC, 0, 0, 0, LFE, FR, FL } }, | ||
208 | { .ca_index = 0x16, .speakers = { FRC, FLC, 0, 0, FC, 0, FR, FL } }, | ||
209 | { .ca_index = 0x17, .speakers = { FRC, FLC, 0, 0, FC, LFE, FR, FL } }, | ||
210 | { .ca_index = 0x18, .speakers = { FRC, FLC, 0, RC, 0, 0, FR, FL } }, | ||
211 | { .ca_index = 0x19, .speakers = { FRC, FLC, 0, RC, 0, LFE, FR, FL } }, | ||
212 | { .ca_index = 0x1a, .speakers = { FRC, FLC, 0, RC, FC, 0, FR, FL } }, | ||
213 | { .ca_index = 0x1b, .speakers = { FRC, FLC, 0, RC, FC, LFE, FR, FL } }, | ||
214 | { .ca_index = 0x1c, .speakers = { FRC, FLC, RR, RL, 0, 0, FR, FL } }, | ||
215 | { .ca_index = 0x1d, .speakers = { FRC, FLC, RR, RL, 0, LFE, FR, FL } }, | ||
216 | { .ca_index = 0x1e, .speakers = { FRC, FLC, RR, RL, FC, 0, FR, FL } }, | ||
217 | { .ca_index = 0x1f, .speakers = { FRC, FLC, RR, RL, FC, LFE, FR, FL } }, | ||
218 | { .ca_index = 0x20, .speakers = { 0, FCH, RR, RL, FC, 0, FR, FL } }, | ||
219 | { .ca_index = 0x21, .speakers = { 0, FCH, RR, RL, FC, LFE, FR, FL } }, | ||
220 | { .ca_index = 0x22, .speakers = { TC, 0, RR, RL, FC, 0, FR, FL } }, | ||
221 | { .ca_index = 0x23, .speakers = { TC, 0, RR, RL, FC, LFE, FR, FL } }, | ||
222 | { .ca_index = 0x24, .speakers = { FRH, FLH, RR, RL, 0, 0, FR, FL } }, | ||
223 | { .ca_index = 0x25, .speakers = { FRH, FLH, RR, RL, 0, LFE, FR, FL } }, | ||
224 | { .ca_index = 0x26, .speakers = { FRW, FLW, RR, RL, 0, 0, FR, FL } }, | ||
225 | { .ca_index = 0x27, .speakers = { FRW, FLW, RR, RL, 0, LFE, FR, FL } }, | ||
226 | { .ca_index = 0x28, .speakers = { TC, RC, RR, RL, FC, 0, FR, FL } }, | ||
227 | { .ca_index = 0x29, .speakers = { TC, RC, RR, RL, FC, LFE, FR, FL } }, | ||
228 | { .ca_index = 0x2a, .speakers = { FCH, RC, RR, RL, FC, 0, FR, FL } }, | ||
229 | { .ca_index = 0x2b, .speakers = { FCH, RC, RR, RL, FC, LFE, FR, FL } }, | ||
230 | { .ca_index = 0x2c, .speakers = { TC, FCH, RR, RL, FC, 0, FR, FL } }, | ||
231 | { .ca_index = 0x2d, .speakers = { TC, FCH, RR, RL, FC, LFE, FR, FL } }, | ||
232 | { .ca_index = 0x2e, .speakers = { FRH, FLH, RR, RL, FC, 0, FR, FL } }, | ||
233 | { .ca_index = 0x2f, .speakers = { FRH, FLH, RR, RL, FC, LFE, FR, FL } }, | ||
234 | { .ca_index = 0x30, .speakers = { FRW, FLW, RR, RL, FC, 0, FR, FL } }, | ||
235 | { .ca_index = 0x31, .speakers = { FRW, FLW, RR, RL, FC, LFE, FR, FL } }, | ||
236 | }; | ||
237 | |||
238 | |||
239 | /* | ||
240 | * HDMI routines | ||
241 | */ | ||
242 | |||
243 | static int hda_node_index(hda_nid_t *nids, hda_nid_t nid) | ||
244 | { | ||
245 | int i; | ||
246 | |||
247 | for (i = 0; nids[i]; i++) | ||
248 | if (nids[i] == nid) | ||
249 | return i; | ||
250 | |||
251 | snd_printk(KERN_WARNING "HDMI: nid %d not registered\n", nid); | ||
252 | return -EINVAL; | ||
253 | } | ||
254 | |||
255 | static void hdmi_get_show_eld(struct hda_codec *codec, hda_nid_t pin_nid, | ||
256 | struct hdmi_eld *eld) | ||
257 | { | ||
258 | if (!snd_hdmi_get_eld(eld, codec, pin_nid)) | ||
259 | snd_hdmi_show_eld(eld); | ||
260 | } | ||
261 | |||
262 | #ifdef BE_PARANOID | ||
263 | static void hdmi_get_dip_index(struct hda_codec *codec, hda_nid_t pin_nid, | ||
264 | int *packet_index, int *byte_index) | ||
265 | { | ||
266 | int val; | ||
267 | |||
268 | val = snd_hda_codec_read(codec, pin_nid, 0, | ||
269 | AC_VERB_GET_HDMI_DIP_INDEX, 0); | ||
270 | |||
271 | *packet_index = val >> 5; | ||
272 | *byte_index = val & 0x1f; | ||
273 | } | ||
274 | #endif | ||
275 | |||
276 | static void hdmi_set_dip_index(struct hda_codec *codec, hda_nid_t pin_nid, | ||
277 | int packet_index, int byte_index) | ||
278 | { | ||
279 | int val; | ||
280 | |||
281 | val = (packet_index << 5) | (byte_index & 0x1f); | ||
282 | |||
283 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_INDEX, val); | ||
284 | } | ||
285 | |||
286 | static void hdmi_write_dip_byte(struct hda_codec *codec, hda_nid_t pin_nid, | ||
287 | unsigned char val) | ||
288 | { | ||
289 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_DATA, val); | ||
290 | } | ||
291 | |||
292 | static void hdmi_enable_output(struct hda_codec *codec, hda_nid_t pin_nid) | ||
293 | { | ||
294 | /* Unmute */ | ||
295 | if (get_wcaps(codec, pin_nid) & AC_WCAP_OUT_AMP) | ||
296 | snd_hda_codec_write(codec, pin_nid, 0, | ||
297 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); | ||
298 | /* Enable pin out */ | ||
299 | snd_hda_codec_write(codec, pin_nid, 0, | ||
300 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
301 | } | ||
302 | |||
303 | static int hdmi_get_channel_count(struct hda_codec *codec, hda_nid_t nid) | ||
304 | { | ||
305 | return 1 + snd_hda_codec_read(codec, nid, 0, | ||
306 | AC_VERB_GET_CVT_CHAN_COUNT, 0); | ||
307 | } | ||
308 | |||
309 | static void hdmi_set_channel_count(struct hda_codec *codec, | ||
310 | hda_nid_t nid, int chs) | ||
311 | { | ||
312 | if (chs != hdmi_get_channel_count(codec, nid)) | ||
313 | snd_hda_codec_write(codec, nid, 0, | ||
314 | AC_VERB_SET_CVT_CHAN_COUNT, chs - 1); | ||
315 | } | ||
316 | |||
317 | |||
318 | /* | ||
319 | * Channel mapping routines | ||
320 | */ | ||
321 | |||
322 | /* | ||
323 | * Compute derived values in channel_allocations[]. | ||
324 | */ | ||
325 | static void init_channel_allocations(void) | ||
326 | { | ||
327 | int i, j; | ||
328 | struct cea_channel_speaker_allocation *p; | ||
329 | |||
330 | for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { | ||
331 | p = channel_allocations + i; | ||
332 | p->channels = 0; | ||
333 | p->spk_mask = 0; | ||
334 | for (j = 0; j < ARRAY_SIZE(p->speakers); j++) | ||
335 | if (p->speakers[j]) { | ||
336 | p->channels++; | ||
337 | p->spk_mask |= p->speakers[j]; | ||
338 | } | ||
339 | } | ||
340 | } | ||
341 | |||
342 | /* | ||
343 | * The transformation takes two steps: | ||
344 | * | ||
345 | * eld->spk_alloc => (eld_speaker_allocation_bits[]) => spk_mask | ||
346 | * spk_mask => (channel_allocations[]) => ai->CA | ||
347 | * | ||
348 | * TODO: it could select the wrong CA from multiple candidates. | ||
349 | */ | ||
350 | static int hdmi_setup_channel_allocation(struct hda_codec *codec, hda_nid_t nid, | ||
351 | struct hdmi_audio_infoframe *ai) | ||
352 | { | ||
353 | struct hdmi_spec *spec = codec->spec; | ||
354 | struct hdmi_eld *eld; | ||
355 | int i; | ||
356 | int spk_mask = 0; | ||
357 | int channels = 1 + (ai->CC02_CT47 & 0x7); | ||
358 | char buf[SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE]; | ||
359 | |||
360 | /* | ||
361 | * CA defaults to 0 for basic stereo audio | ||
362 | */ | ||
363 | if (channels <= 2) | ||
364 | return 0; | ||
365 | |||
366 | i = hda_node_index(spec->pin_cvt, nid); | ||
367 | if (i < 0) | ||
368 | return 0; | ||
369 | eld = &spec->sink_eld[i]; | ||
370 | |||
371 | /* | ||
372 | * HDMI sink's ELD info cannot always be retrieved for now, e.g. | ||
373 | * in console or for audio devices. Assume the highest speakers | ||
374 | * configuration, to _not_ prohibit multi-channel audio playback. | ||
375 | */ | ||
376 | if (!eld->spk_alloc) | ||
377 | eld->spk_alloc = 0xffff; | ||
378 | |||
379 | /* | ||
380 | * expand ELD's speaker allocation mask | ||
381 | * | ||
382 | * ELD tells the speaker mask in a compact(paired) form, | ||
383 | * expand ELD's notions to match the ones used by Audio InfoFrame. | ||
384 | */ | ||
385 | for (i = 0; i < ARRAY_SIZE(eld_speaker_allocation_bits); i++) { | ||
386 | if (eld->spk_alloc & (1 << i)) | ||
387 | spk_mask |= eld_speaker_allocation_bits[i]; | ||
388 | } | ||
389 | |||
390 | /* search for the first working match in the CA table */ | ||
391 | for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { | ||
392 | if (channels == channel_allocations[i].channels && | ||
393 | (spk_mask & channel_allocations[i].spk_mask) == | ||
394 | channel_allocations[i].spk_mask) { | ||
395 | ai->CA = channel_allocations[i].ca_index; | ||
396 | break; | ||
397 | } | ||
398 | } | ||
399 | |||
400 | snd_print_channel_allocation(eld->spk_alloc, buf, sizeof(buf)); | ||
401 | snd_printdd("HDMI: select CA 0x%x for %d-channel allocation: %s\n", | ||
402 | ai->CA, channels, buf); | ||
403 | |||
404 | return ai->CA; | ||
405 | } | ||
406 | |||
407 | static void hdmi_debug_channel_mapping(struct hda_codec *codec, | ||
408 | hda_nid_t pin_nid) | ||
409 | { | ||
410 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
411 | int i; | ||
412 | int slot; | ||
413 | |||
414 | for (i = 0; i < 8; i++) { | ||
415 | slot = snd_hda_codec_read(codec, pin_nid, 0, | ||
416 | AC_VERB_GET_HDMI_CHAN_SLOT, i); | ||
417 | printk(KERN_DEBUG "HDMI: ASP channel %d => slot %d\n", | ||
418 | slot >> 4, slot & 0xf); | ||
419 | } | ||
420 | #endif | ||
421 | } | ||
422 | |||
423 | |||
424 | static void hdmi_setup_channel_mapping(struct hda_codec *codec, | ||
425 | hda_nid_t pin_nid, | ||
426 | struct hdmi_audio_infoframe *ai) | ||
427 | { | ||
428 | int i; | ||
429 | int ca = ai->CA; | ||
430 | int err; | ||
431 | |||
432 | if (hdmi_channel_mapping[ca][1] == 0) { | ||
433 | for (i = 0; i < channel_allocations[ca].channels; i++) | ||
434 | hdmi_channel_mapping[ca][i] = i | (i << 4); | ||
435 | for (; i < 8; i++) | ||
436 | hdmi_channel_mapping[ca][i] = 0xf | (i << 4); | ||
437 | } | ||
438 | |||
439 | for (i = 0; i < 8; i++) { | ||
440 | err = snd_hda_codec_write(codec, pin_nid, 0, | ||
441 | AC_VERB_SET_HDMI_CHAN_SLOT, | ||
442 | hdmi_channel_mapping[ca][i]); | ||
443 | if (err) { | ||
444 | snd_printdd(KERN_NOTICE | ||
445 | "HDMI: channel mapping failed\n"); | ||
446 | break; | ||
447 | } | ||
448 | } | ||
449 | |||
450 | hdmi_debug_channel_mapping(codec, pin_nid); | ||
451 | } | ||
452 | |||
453 | |||
454 | /* | ||
455 | * Audio InfoFrame routines | ||
456 | */ | ||
457 | |||
458 | /* | ||
459 | * Enable Audio InfoFrame Transmission | ||
460 | */ | ||
461 | static void hdmi_start_infoframe_trans(struct hda_codec *codec, | ||
462 | hda_nid_t pin_nid) | ||
463 | { | ||
464 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); | ||
465 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_XMIT, | ||
466 | AC_DIPXMIT_BEST); | ||
467 | } | ||
468 | |||
469 | /* | ||
470 | * Disable Audio InfoFrame Transmission | ||
471 | */ | ||
472 | static void hdmi_stop_infoframe_trans(struct hda_codec *codec, | ||
473 | hda_nid_t pin_nid) | ||
474 | { | ||
475 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); | ||
476 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_XMIT, | ||
477 | AC_DIPXMIT_DISABLE); | ||
478 | } | ||
479 | |||
480 | static void hdmi_debug_dip_size(struct hda_codec *codec, hda_nid_t pin_nid) | ||
481 | { | ||
482 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
483 | int i; | ||
484 | int size; | ||
485 | |||
486 | size = snd_hdmi_get_eld_size(codec, pin_nid); | ||
487 | printk(KERN_DEBUG "HDMI: ELD buf size is %d\n", size); | ||
488 | |||
489 | for (i = 0; i < 8; i++) { | ||
490 | size = snd_hda_codec_read(codec, pin_nid, 0, | ||
491 | AC_VERB_GET_HDMI_DIP_SIZE, i); | ||
492 | printk(KERN_DEBUG "HDMI: DIP GP[%d] buf size is %d\n", i, size); | ||
493 | } | ||
494 | #endif | ||
495 | } | ||
496 | |||
497 | static void hdmi_clear_dip_buffers(struct hda_codec *codec, hda_nid_t pin_nid) | ||
498 | { | ||
499 | #ifdef BE_PARANOID | ||
500 | int i, j; | ||
501 | int size; | ||
502 | int pi, bi; | ||
503 | for (i = 0; i < 8; i++) { | ||
504 | size = snd_hda_codec_read(codec, pin_nid, 0, | ||
505 | AC_VERB_GET_HDMI_DIP_SIZE, i); | ||
506 | if (size == 0) | ||
507 | continue; | ||
508 | |||
509 | hdmi_set_dip_index(codec, pin_nid, i, 0x0); | ||
510 | for (j = 1; j < 1000; j++) { | ||
511 | hdmi_write_dip_byte(codec, pin_nid, 0x0); | ||
512 | hdmi_get_dip_index(codec, pin_nid, &pi, &bi); | ||
513 | if (pi != i) | ||
514 | snd_printd(KERN_INFO "dip index %d: %d != %d\n", | ||
515 | bi, pi, i); | ||
516 | if (bi == 0) /* byte index wrapped around */ | ||
517 | break; | ||
518 | } | ||
519 | snd_printd(KERN_INFO | ||
520 | "HDMI: DIP GP[%d] buf reported size=%d, written=%d\n", | ||
521 | i, size, j); | ||
522 | } | ||
523 | #endif | ||
524 | } | ||
525 | |||
526 | static void hdmi_checksum_audio_infoframe(struct hdmi_audio_infoframe *ai) | ||
527 | { | ||
528 | u8 *bytes = (u8 *)ai; | ||
529 | u8 sum = 0; | ||
530 | int i; | ||
531 | |||
532 | ai->checksum = 0; | ||
533 | |||
534 | for (i = 0; i < sizeof(*ai); i++) | ||
535 | sum += bytes[i]; | ||
536 | |||
537 | ai->checksum = -sum; | ||
538 | } | ||
539 | |||
540 | static void hdmi_fill_audio_infoframe(struct hda_codec *codec, | ||
541 | hda_nid_t pin_nid, | ||
542 | struct hdmi_audio_infoframe *ai) | ||
543 | { | ||
544 | u8 *bytes = (u8 *)ai; | ||
545 | int i; | ||
546 | |||
547 | hdmi_debug_dip_size(codec, pin_nid); | ||
548 | hdmi_clear_dip_buffers(codec, pin_nid); /* be paranoid */ | ||
549 | |||
550 | hdmi_checksum_audio_infoframe(ai); | ||
551 | |||
552 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); | ||
553 | for (i = 0; i < sizeof(*ai); i++) | ||
554 | hdmi_write_dip_byte(codec, pin_nid, bytes[i]); | ||
555 | } | ||
556 | |||
557 | static bool hdmi_infoframe_uptodate(struct hda_codec *codec, hda_nid_t pin_nid, | ||
558 | struct hdmi_audio_infoframe *ai) | ||
559 | { | ||
560 | u8 *bytes = (u8 *)ai; | ||
561 | u8 val; | ||
562 | int i; | ||
563 | |||
564 | if (snd_hda_codec_read(codec, pin_nid, 0, AC_VERB_GET_HDMI_DIP_XMIT, 0) | ||
565 | != AC_DIPXMIT_BEST) | ||
566 | return false; | ||
567 | |||
568 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); | ||
569 | for (i = 0; i < sizeof(*ai); i++) { | ||
570 | val = snd_hda_codec_read(codec, pin_nid, 0, | ||
571 | AC_VERB_GET_HDMI_DIP_DATA, 0); | ||
572 | if (val != bytes[i]) | ||
573 | return false; | ||
574 | } | ||
575 | |||
576 | return true; | ||
577 | } | ||
578 | |||
579 | static void hdmi_setup_audio_infoframe(struct hda_codec *codec, hda_nid_t nid, | ||
580 | struct snd_pcm_substream *substream) | ||
581 | { | ||
582 | struct hdmi_spec *spec = codec->spec; | ||
583 | hda_nid_t pin_nid; | ||
584 | int i; | ||
585 | struct hdmi_audio_infoframe ai = { | ||
586 | .type = 0x84, | ||
587 | .ver = 0x01, | ||
588 | .len = 0x0a, | ||
589 | .CC02_CT47 = substream->runtime->channels - 1, | ||
590 | }; | ||
591 | |||
592 | hdmi_setup_channel_allocation(codec, nid, &ai); | ||
593 | |||
594 | for (i = 0; i < spec->num_pins; i++) { | ||
595 | if (spec->pin_cvt[i] != nid) | ||
596 | continue; | ||
597 | if (!spec->sink_eld[i].monitor_present) | ||
598 | continue; | ||
599 | |||
600 | pin_nid = spec->pin[i]; | ||
601 | if (!hdmi_infoframe_uptodate(codec, pin_nid, &ai)) { | ||
602 | snd_printdd("hdmi_setup_audio_infoframe: " | ||
603 | "cvt=%d pin=%d channels=%d\n", | ||
604 | nid, pin_nid, | ||
605 | substream->runtime->channels); | ||
606 | hdmi_setup_channel_mapping(codec, pin_nid, &ai); | ||
607 | hdmi_stop_infoframe_trans(codec, pin_nid); | ||
608 | hdmi_fill_audio_infoframe(codec, pin_nid, &ai); | ||
609 | hdmi_start_infoframe_trans(codec, pin_nid); | ||
610 | } | ||
611 | } | ||
612 | } | ||
613 | |||
614 | |||
615 | /* | ||
616 | * Unsolicited events | ||
617 | */ | ||
618 | |||
619 | static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | ||
620 | { | ||
621 | struct hdmi_spec *spec = codec->spec; | ||
622 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; | ||
623 | int pind = !!(res & AC_UNSOL_RES_PD); | ||
624 | int eldv = !!(res & AC_UNSOL_RES_ELDV); | ||
625 | int index; | ||
626 | |||
627 | printk(KERN_INFO | ||
628 | "HDMI hot plug event: Pin=%d Presence_Detect=%d ELD_Valid=%d\n", | ||
629 | tag, pind, eldv); | ||
630 | |||
631 | index = hda_node_index(spec->pin, tag); | ||
632 | if (index < 0) | ||
633 | return; | ||
634 | |||
635 | spec->sink_eld[index].monitor_present = pind; | ||
636 | spec->sink_eld[index].eld_valid = eldv; | ||
637 | |||
638 | if (pind && eldv) { | ||
639 | hdmi_get_show_eld(codec, spec->pin[index], | ||
640 | &spec->sink_eld[index]); | ||
641 | /* TODO: do real things about ELD */ | ||
642 | } | ||
643 | } | ||
644 | |||
645 | static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) | ||
646 | { | ||
647 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; | ||
648 | int subtag = (res & AC_UNSOL_RES_SUBTAG) >> AC_UNSOL_RES_SUBTAG_SHIFT; | ||
649 | int cp_state = !!(res & AC_UNSOL_RES_CP_STATE); | ||
650 | int cp_ready = !!(res & AC_UNSOL_RES_CP_READY); | ||
651 | |||
652 | printk(KERN_INFO | ||
653 | "HDMI CP event: PIN=%d SUBTAG=0x%x CP_STATE=%d CP_READY=%d\n", | ||
654 | tag, | ||
655 | subtag, | ||
656 | cp_state, | ||
657 | cp_ready); | ||
658 | |||
659 | /* TODO */ | ||
660 | if (cp_state) | ||
661 | ; | ||
662 | if (cp_ready) | ||
663 | ; | ||
664 | } | ||
665 | |||
666 | |||
667 | static void hdmi_unsol_event(struct hda_codec *codec, unsigned int res) | ||
668 | { | ||
669 | struct hdmi_spec *spec = codec->spec; | ||
670 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; | ||
671 | int subtag = (res & AC_UNSOL_RES_SUBTAG) >> AC_UNSOL_RES_SUBTAG_SHIFT; | ||
672 | |||
673 | if (hda_node_index(spec->pin, tag) < 0) { | ||
674 | snd_printd(KERN_INFO "Unexpected HDMI event tag 0x%x\n", tag); | ||
675 | return; | ||
676 | } | ||
677 | |||
678 | if (subtag == 0) | ||
679 | hdmi_intrinsic_event(codec, res); | ||
680 | else | ||
681 | hdmi_non_intrinsic_event(codec, res); | ||
682 | } | ||
683 | |||
684 | /* | ||
685 | * Callbacks | ||
686 | */ | ||
687 | |||
688 | static void hdmi_setup_stream(struct hda_codec *codec, hda_nid_t nid, | ||
689 | u32 stream_tag, int format) | ||
690 | { | ||
691 | int tag; | ||
692 | int fmt; | ||
693 | |||
694 | tag = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0) >> 4; | ||
695 | fmt = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_STREAM_FORMAT, 0); | ||
696 | |||
697 | snd_printdd("hdmi_setup_stream: " | ||
698 | "NID=0x%x, %sstream=0x%x, %sformat=0x%x\n", | ||
699 | nid, | ||
700 | tag == stream_tag ? "" : "new-", | ||
701 | stream_tag, | ||
702 | fmt == format ? "" : "new-", | ||
703 | format); | ||
704 | |||
705 | if (tag != stream_tag) | ||
706 | snd_hda_codec_write(codec, nid, 0, | ||
707 | AC_VERB_SET_CHANNEL_STREAMID, | ||
708 | stream_tag << 4); | ||
709 | if (fmt != format) | ||
710 | snd_hda_codec_write(codec, nid, 0, | ||
711 | AC_VERB_SET_STREAM_FORMAT, format); | ||
712 | } | ||
713 | |||
714 | /* | ||
715 | * HDA/HDMI auto parsing | ||
716 | */ | ||
717 | |||
718 | static int hdmi_read_pin_conn(struct hda_codec *codec, hda_nid_t pin_nid) | ||
719 | { | ||
720 | struct hdmi_spec *spec = codec->spec; | ||
721 | hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; | ||
722 | int conn_len, curr; | ||
723 | int index; | ||
724 | |||
725 | if (!(get_wcaps(codec, pin_nid) & AC_WCAP_CONN_LIST)) { | ||
726 | snd_printk(KERN_WARNING | ||
727 | "HDMI: pin %d wcaps %#x " | ||
728 | "does not support connection list\n", | ||
729 | pin_nid, get_wcaps(codec, pin_nid)); | ||
730 | return -EINVAL; | ||
731 | } | ||
732 | |||
733 | conn_len = snd_hda_get_connections(codec, pin_nid, conn_list, | ||
734 | HDA_MAX_CONNECTIONS); | ||
735 | if (conn_len > 1) | ||
736 | curr = snd_hda_codec_read(codec, pin_nid, 0, | ||
737 | AC_VERB_GET_CONNECT_SEL, 0); | ||
738 | else | ||
739 | curr = 0; | ||
740 | |||
741 | index = hda_node_index(spec->pin, pin_nid); | ||
742 | if (index < 0) | ||
743 | return -EINVAL; | ||
744 | |||
745 | spec->pin_cvt[index] = conn_list[curr]; | ||
746 | |||
747 | return 0; | ||
748 | } | ||
749 | |||
750 | static void hdmi_present_sense(struct hda_codec *codec, hda_nid_t pin_nid, | ||
751 | struct hdmi_eld *eld) | ||
752 | { | ||
753 | int present = snd_hda_pin_sense(codec, pin_nid); | ||
754 | |||
755 | eld->monitor_present = !!(present & AC_PINSENSE_PRESENCE); | ||
756 | eld->eld_valid = !!(present & AC_PINSENSE_ELDV); | ||
757 | |||
758 | if (present & AC_PINSENSE_ELDV) | ||
759 | hdmi_get_show_eld(codec, pin_nid, eld); | ||
760 | } | ||
761 | |||
762 | static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) | ||
763 | { | ||
764 | struct hdmi_spec *spec = codec->spec; | ||
765 | |||
766 | if (spec->num_pins >= MAX_HDMI_PINS) { | ||
767 | snd_printk(KERN_WARNING | ||
768 | "HDMI: no space for pin %d\n", pin_nid); | ||
769 | return -EINVAL; | ||
770 | } | ||
771 | |||
772 | hdmi_present_sense(codec, pin_nid, &spec->sink_eld[spec->num_pins]); | ||
773 | |||
774 | spec->pin[spec->num_pins] = pin_nid; | ||
775 | spec->num_pins++; | ||
776 | |||
777 | /* | ||
778 | * It is assumed that converter nodes come first in the node list and | ||
779 | * hence have been registered and usable now. | ||
780 | */ | ||
781 | return hdmi_read_pin_conn(codec, pin_nid); | ||
782 | } | ||
783 | |||
784 | static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t nid) | ||
785 | { | ||
786 | struct hdmi_spec *spec = codec->spec; | ||
787 | |||
788 | if (spec->num_cvts >= MAX_HDMI_CVTS) { | ||
789 | snd_printk(KERN_WARNING | ||
790 | "HDMI: no space for converter %d\n", nid); | ||
791 | return -EINVAL; | ||
792 | } | ||
793 | |||
794 | spec->cvt[spec->num_cvts] = nid; | ||
795 | spec->num_cvts++; | ||
796 | |||
797 | return 0; | ||
798 | } | ||
799 | |||
800 | static int hdmi_parse_codec(struct hda_codec *codec) | ||
801 | { | ||
802 | hda_nid_t nid; | ||
803 | int i, nodes; | ||
804 | |||
805 | nodes = snd_hda_get_sub_nodes(codec, codec->afg, &nid); | ||
806 | if (!nid || nodes < 0) { | ||
807 | snd_printk(KERN_WARNING "HDMI: failed to get afg sub nodes\n"); | ||
808 | return -EINVAL; | ||
809 | } | ||
810 | |||
811 | for (i = 0; i < nodes; i++, nid++) { | ||
812 | unsigned int caps; | ||
813 | unsigned int type; | ||
814 | |||
815 | caps = snd_hda_param_read(codec, nid, AC_PAR_AUDIO_WIDGET_CAP); | ||
816 | type = get_wcaps_type(caps); | ||
817 | |||
818 | if (!(caps & AC_WCAP_DIGITAL)) | ||
819 | continue; | ||
820 | |||
821 | switch (type) { | ||
822 | case AC_WID_AUD_OUT: | ||
823 | if (hdmi_add_cvt(codec, nid) < 0) | ||
824 | return -EINVAL; | ||
825 | break; | ||
826 | case AC_WID_PIN: | ||
827 | caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); | ||
828 | if (!(caps & (AC_PINCAP_HDMI | AC_PINCAP_DP))) | ||
829 | continue; | ||
830 | if (hdmi_add_pin(codec, nid) < 0) | ||
831 | return -EINVAL; | ||
832 | break; | ||
833 | } | ||
834 | } | ||
835 | |||
836 | /* | ||
837 | * G45/IbexPeak don't support EPSS: the unsolicited pin hot plug event | ||
838 | * can be lost and presence sense verb will become inaccurate if the | ||
839 | * HDA link is powered off at hot plug or hw initialization time. | ||
840 | */ | ||
841 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
842 | if (!(snd_hda_param_read(codec, codec->afg, AC_PAR_POWER_STATE) & | ||
843 | AC_PWRST_EPSS)) | ||
844 | codec->bus->power_keep_link_on = 1; | ||
845 | #endif | ||
846 | |||
847 | return 0; | ||
848 | } | ||
849 | |||
diff --git a/sound/pci/hda/patch_intelhdmi.c b/sound/pci/hda/patch_intelhdmi.c index 918f40378d52..88d035104cc5 100644 --- a/sound/pci/hda/patch_intelhdmi.c +++ b/sound/pci/hda/patch_intelhdmi.c | |||
@@ -40,815 +40,20 @@ | |||
40 | * | 40 | * |
41 | * The HDA correspondence of pipes/ports are converter/pin nodes. | 41 | * The HDA correspondence of pipes/ports are converter/pin nodes. |
42 | */ | 42 | */ |
43 | #define INTEL_HDMI_CVTS 2 | 43 | #define MAX_HDMI_CVTS 2 |
44 | #define INTEL_HDMI_PINS 3 | 44 | #define MAX_HDMI_PINS 3 |
45 | 45 | ||
46 | static char *intel_hdmi_pcm_names[INTEL_HDMI_CVTS] = { | 46 | #include "patch_hdmi.c" |
47 | |||
48 | static char *intel_hdmi_pcm_names[MAX_HDMI_CVTS] = { | ||
47 | "INTEL HDMI 0", | 49 | "INTEL HDMI 0", |
48 | "INTEL HDMI 1", | 50 | "INTEL HDMI 1", |
49 | }; | 51 | }; |
50 | 52 | ||
51 | struct intel_hdmi_spec { | ||
52 | int num_cvts; | ||
53 | int num_pins; | ||
54 | hda_nid_t cvt[INTEL_HDMI_CVTS+1]; /* audio sources */ | ||
55 | hda_nid_t pin[INTEL_HDMI_PINS+1]; /* audio sinks */ | ||
56 | |||
57 | /* | ||
58 | * source connection for each pin | ||
59 | */ | ||
60 | hda_nid_t pin_cvt[INTEL_HDMI_PINS+1]; | ||
61 | |||
62 | /* | ||
63 | * HDMI sink attached to each pin | ||
64 | */ | ||
65 | struct hdmi_eld sink_eld[INTEL_HDMI_PINS]; | ||
66 | |||
67 | /* | ||
68 | * export one pcm per pipe | ||
69 | */ | ||
70 | struct hda_pcm pcm_rec[INTEL_HDMI_CVTS]; | ||
71 | }; | ||
72 | |||
73 | struct hdmi_audio_infoframe { | ||
74 | u8 type; /* 0x84 */ | ||
75 | u8 ver; /* 0x01 */ | ||
76 | u8 len; /* 0x0a */ | ||
77 | |||
78 | u8 checksum; /* PB0 */ | ||
79 | u8 CC02_CT47; /* CC in bits 0:2, CT in 4:7 */ | ||
80 | u8 SS01_SF24; | ||
81 | u8 CXT04; | ||
82 | u8 CA; | ||
83 | u8 LFEPBL01_LSV36_DM_INH7; | ||
84 | u8 reserved[5]; /* PB6 - PB10 */ | ||
85 | }; | ||
86 | |||
87 | /* | ||
88 | * CEA speaker placement: | ||
89 | * | ||
90 | * FLH FCH FRH | ||
91 | * FLW FL FLC FC FRC FR FRW | ||
92 | * | ||
93 | * LFE | ||
94 | * TC | ||
95 | * | ||
96 | * RL RLC RC RRC RR | ||
97 | * | ||
98 | * The Left/Right Surround channel _notions_ LS/RS in SMPTE 320M corresponds to | ||
99 | * CEA RL/RR; The SMPTE channel _assignment_ C/LFE is swapped to CEA LFE/FC. | ||
100 | */ | ||
101 | enum cea_speaker_placement { | ||
102 | FL = (1 << 0), /* Front Left */ | ||
103 | FC = (1 << 1), /* Front Center */ | ||
104 | FR = (1 << 2), /* Front Right */ | ||
105 | FLC = (1 << 3), /* Front Left Center */ | ||
106 | FRC = (1 << 4), /* Front Right Center */ | ||
107 | RL = (1 << 5), /* Rear Left */ | ||
108 | RC = (1 << 6), /* Rear Center */ | ||
109 | RR = (1 << 7), /* Rear Right */ | ||
110 | RLC = (1 << 8), /* Rear Left Center */ | ||
111 | RRC = (1 << 9), /* Rear Right Center */ | ||
112 | LFE = (1 << 10), /* Low Frequency Effect */ | ||
113 | FLW = (1 << 11), /* Front Left Wide */ | ||
114 | FRW = (1 << 12), /* Front Right Wide */ | ||
115 | FLH = (1 << 13), /* Front Left High */ | ||
116 | FCH = (1 << 14), /* Front Center High */ | ||
117 | FRH = (1 << 15), /* Front Right High */ | ||
118 | TC = (1 << 16), /* Top Center */ | ||
119 | }; | ||
120 | |||
121 | /* | ||
122 | * ELD SA bits in the CEA Speaker Allocation data block | ||
123 | */ | ||
124 | static int eld_speaker_allocation_bits[] = { | ||
125 | [0] = FL | FR, | ||
126 | [1] = LFE, | ||
127 | [2] = FC, | ||
128 | [3] = RL | RR, | ||
129 | [4] = RC, | ||
130 | [5] = FLC | FRC, | ||
131 | [6] = RLC | RRC, | ||
132 | /* the following are not defined in ELD yet */ | ||
133 | [7] = FLW | FRW, | ||
134 | [8] = FLH | FRH, | ||
135 | [9] = TC, | ||
136 | [10] = FCH, | ||
137 | }; | ||
138 | |||
139 | struct cea_channel_speaker_allocation { | ||
140 | int ca_index; | ||
141 | int speakers[8]; | ||
142 | |||
143 | /* derived values, just for convenience */ | ||
144 | int channels; | ||
145 | int spk_mask; | ||
146 | }; | ||
147 | |||
148 | /* | ||
149 | * ALSA sequence is: | ||
150 | * | ||
151 | * surround40 surround41 surround50 surround51 surround71 | ||
152 | * ch0 front left = = = = | ||
153 | * ch1 front right = = = = | ||
154 | * ch2 rear left = = = = | ||
155 | * ch3 rear right = = = = | ||
156 | * ch4 LFE center center center | ||
157 | * ch5 LFE LFE | ||
158 | * ch6 side left | ||
159 | * ch7 side right | ||
160 | * | ||
161 | * surround71 = {FL, FR, RLC, RRC, FC, LFE, RL, RR} | ||
162 | */ | ||
163 | static int hdmi_channel_mapping[0x32][8] = { | ||
164 | /* stereo */ | ||
165 | [0x00] = { 0x00, 0x11, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7 }, | ||
166 | /* 2.1 */ | ||
167 | [0x01] = { 0x00, 0x11, 0x22, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7 }, | ||
168 | /* Dolby Surround */ | ||
169 | [0x02] = { 0x00, 0x11, 0x23, 0xf2, 0xf4, 0xf5, 0xf6, 0xf7 }, | ||
170 | /* surround40 */ | ||
171 | [0x08] = { 0x00, 0x11, 0x24, 0x35, 0xf3, 0xf2, 0xf6, 0xf7 }, | ||
172 | /* 4ch */ | ||
173 | [0x03] = { 0x00, 0x11, 0x23, 0x32, 0x44, 0xf5, 0xf6, 0xf7 }, | ||
174 | /* surround41 */ | ||
175 | [0x09] = { 0x00, 0x11, 0x24, 0x34, 0x43, 0xf2, 0xf6, 0xf7 }, | ||
176 | /* surround50 */ | ||
177 | [0x0a] = { 0x00, 0x11, 0x24, 0x35, 0x43, 0xf2, 0xf6, 0xf7 }, | ||
178 | /* surround51 */ | ||
179 | [0x0b] = { 0x00, 0x11, 0x24, 0x35, 0x43, 0x52, 0xf6, 0xf7 }, | ||
180 | /* 7.1 */ | ||
181 | [0x13] = { 0x00, 0x11, 0x26, 0x37, 0x43, 0x52, 0x64, 0x75 }, | ||
182 | }; | ||
183 | |||
184 | /* | ||
185 | * This is an ordered list! | ||
186 | * | ||
187 | * The preceding ones have better chances to be selected by | ||
188 | * hdmi_setup_channel_allocation(). | ||
189 | */ | ||
190 | static struct cea_channel_speaker_allocation channel_allocations[] = { | ||
191 | /* channel: 7 6 5 4 3 2 1 0 */ | ||
192 | { .ca_index = 0x00, .speakers = { 0, 0, 0, 0, 0, 0, FR, FL } }, | ||
193 | /* 2.1 */ | ||
194 | { .ca_index = 0x01, .speakers = { 0, 0, 0, 0, 0, LFE, FR, FL } }, | ||
195 | /* Dolby Surround */ | ||
196 | { .ca_index = 0x02, .speakers = { 0, 0, 0, 0, FC, 0, FR, FL } }, | ||
197 | /* surround40 */ | ||
198 | { .ca_index = 0x08, .speakers = { 0, 0, RR, RL, 0, 0, FR, FL } }, | ||
199 | /* surround41 */ | ||
200 | { .ca_index = 0x09, .speakers = { 0, 0, RR, RL, 0, LFE, FR, FL } }, | ||
201 | /* surround50 */ | ||
202 | { .ca_index = 0x0a, .speakers = { 0, 0, RR, RL, FC, 0, FR, FL } }, | ||
203 | /* surround51 */ | ||
204 | { .ca_index = 0x0b, .speakers = { 0, 0, RR, RL, FC, LFE, FR, FL } }, | ||
205 | /* 6.1 */ | ||
206 | { .ca_index = 0x0f, .speakers = { 0, RC, RR, RL, FC, LFE, FR, FL } }, | ||
207 | /* surround71 */ | ||
208 | { .ca_index = 0x13, .speakers = { RRC, RLC, RR, RL, FC, LFE, FR, FL } }, | ||
209 | |||
210 | { .ca_index = 0x03, .speakers = { 0, 0, 0, 0, FC, LFE, FR, FL } }, | ||
211 | { .ca_index = 0x04, .speakers = { 0, 0, 0, RC, 0, 0, FR, FL } }, | ||
212 | { .ca_index = 0x05, .speakers = { 0, 0, 0, RC, 0, LFE, FR, FL } }, | ||
213 | { .ca_index = 0x06, .speakers = { 0, 0, 0, RC, FC, 0, FR, FL } }, | ||
214 | { .ca_index = 0x07, .speakers = { 0, 0, 0, RC, FC, LFE, FR, FL } }, | ||
215 | { .ca_index = 0x0c, .speakers = { 0, RC, RR, RL, 0, 0, FR, FL } }, | ||
216 | { .ca_index = 0x0d, .speakers = { 0, RC, RR, RL, 0, LFE, FR, FL } }, | ||
217 | { .ca_index = 0x0e, .speakers = { 0, RC, RR, RL, FC, 0, FR, FL } }, | ||
218 | { .ca_index = 0x10, .speakers = { RRC, RLC, RR, RL, 0, 0, FR, FL } }, | ||
219 | { .ca_index = 0x11, .speakers = { RRC, RLC, RR, RL, 0, LFE, FR, FL } }, | ||
220 | { .ca_index = 0x12, .speakers = { RRC, RLC, RR, RL, FC, 0, FR, FL } }, | ||
221 | { .ca_index = 0x14, .speakers = { FRC, FLC, 0, 0, 0, 0, FR, FL } }, | ||
222 | { .ca_index = 0x15, .speakers = { FRC, FLC, 0, 0, 0, LFE, FR, FL } }, | ||
223 | { .ca_index = 0x16, .speakers = { FRC, FLC, 0, 0, FC, 0, FR, FL } }, | ||
224 | { .ca_index = 0x17, .speakers = { FRC, FLC, 0, 0, FC, LFE, FR, FL } }, | ||
225 | { .ca_index = 0x18, .speakers = { FRC, FLC, 0, RC, 0, 0, FR, FL } }, | ||
226 | { .ca_index = 0x19, .speakers = { FRC, FLC, 0, RC, 0, LFE, FR, FL } }, | ||
227 | { .ca_index = 0x1a, .speakers = { FRC, FLC, 0, RC, FC, 0, FR, FL } }, | ||
228 | { .ca_index = 0x1b, .speakers = { FRC, FLC, 0, RC, FC, LFE, FR, FL } }, | ||
229 | { .ca_index = 0x1c, .speakers = { FRC, FLC, RR, RL, 0, 0, FR, FL } }, | ||
230 | { .ca_index = 0x1d, .speakers = { FRC, FLC, RR, RL, 0, LFE, FR, FL } }, | ||
231 | { .ca_index = 0x1e, .speakers = { FRC, FLC, RR, RL, FC, 0, FR, FL } }, | ||
232 | { .ca_index = 0x1f, .speakers = { FRC, FLC, RR, RL, FC, LFE, FR, FL } }, | ||
233 | { .ca_index = 0x20, .speakers = { 0, FCH, RR, RL, FC, 0, FR, FL } }, | ||
234 | { .ca_index = 0x21, .speakers = { 0, FCH, RR, RL, FC, LFE, FR, FL } }, | ||
235 | { .ca_index = 0x22, .speakers = { TC, 0, RR, RL, FC, 0, FR, FL } }, | ||
236 | { .ca_index = 0x23, .speakers = { TC, 0, RR, RL, FC, LFE, FR, FL } }, | ||
237 | { .ca_index = 0x24, .speakers = { FRH, FLH, RR, RL, 0, 0, FR, FL } }, | ||
238 | { .ca_index = 0x25, .speakers = { FRH, FLH, RR, RL, 0, LFE, FR, FL } }, | ||
239 | { .ca_index = 0x26, .speakers = { FRW, FLW, RR, RL, 0, 0, FR, FL } }, | ||
240 | { .ca_index = 0x27, .speakers = { FRW, FLW, RR, RL, 0, LFE, FR, FL } }, | ||
241 | { .ca_index = 0x28, .speakers = { TC, RC, RR, RL, FC, 0, FR, FL } }, | ||
242 | { .ca_index = 0x29, .speakers = { TC, RC, RR, RL, FC, LFE, FR, FL } }, | ||
243 | { .ca_index = 0x2a, .speakers = { FCH, RC, RR, RL, FC, 0, FR, FL } }, | ||
244 | { .ca_index = 0x2b, .speakers = { FCH, RC, RR, RL, FC, LFE, FR, FL } }, | ||
245 | { .ca_index = 0x2c, .speakers = { TC, FCH, RR, RL, FC, 0, FR, FL } }, | ||
246 | { .ca_index = 0x2d, .speakers = { TC, FCH, RR, RL, FC, LFE, FR, FL } }, | ||
247 | { .ca_index = 0x2e, .speakers = { FRH, FLH, RR, RL, FC, 0, FR, FL } }, | ||
248 | { .ca_index = 0x2f, .speakers = { FRH, FLH, RR, RL, FC, LFE, FR, FL } }, | ||
249 | { .ca_index = 0x30, .speakers = { FRW, FLW, RR, RL, FC, 0, FR, FL } }, | ||
250 | { .ca_index = 0x31, .speakers = { FRW, FLW, RR, RL, FC, LFE, FR, FL } }, | ||
251 | }; | ||
252 | |||
253 | /* | ||
254 | * HDA/HDMI auto parsing | ||
255 | */ | ||
256 | |||
257 | static int hda_node_index(hda_nid_t *nids, hda_nid_t nid) | ||
258 | { | ||
259 | int i; | ||
260 | |||
261 | for (i = 0; nids[i]; i++) | ||
262 | if (nids[i] == nid) | ||
263 | return i; | ||
264 | |||
265 | snd_printk(KERN_WARNING "HDMI: nid %d not registered\n", nid); | ||
266 | return -EINVAL; | ||
267 | } | ||
268 | |||
269 | static int intel_hdmi_read_pin_conn(struct hda_codec *codec, hda_nid_t pin_nid) | ||
270 | { | ||
271 | struct intel_hdmi_spec *spec = codec->spec; | ||
272 | hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; | ||
273 | int conn_len, curr; | ||
274 | int index; | ||
275 | |||
276 | if (!(get_wcaps(codec, pin_nid) & AC_WCAP_CONN_LIST)) { | ||
277 | snd_printk(KERN_WARNING | ||
278 | "HDMI: pin %d wcaps %#x " | ||
279 | "does not support connection list\n", | ||
280 | pin_nid, get_wcaps(codec, pin_nid)); | ||
281 | return -EINVAL; | ||
282 | } | ||
283 | |||
284 | conn_len = snd_hda_get_connections(codec, pin_nid, conn_list, | ||
285 | HDA_MAX_CONNECTIONS); | ||
286 | if (conn_len > 1) | ||
287 | curr = snd_hda_codec_read(codec, pin_nid, 0, | ||
288 | AC_VERB_GET_CONNECT_SEL, 0); | ||
289 | else | ||
290 | curr = 0; | ||
291 | |||
292 | index = hda_node_index(spec->pin, pin_nid); | ||
293 | if (index < 0) | ||
294 | return -EINVAL; | ||
295 | |||
296 | spec->pin_cvt[index] = conn_list[curr]; | ||
297 | |||
298 | return 0; | ||
299 | } | ||
300 | |||
301 | static void hdmi_get_show_eld(struct hda_codec *codec, hda_nid_t pin_nid, | ||
302 | struct hdmi_eld *eld) | ||
303 | { | ||
304 | if (!snd_hdmi_get_eld(eld, codec, pin_nid)) | ||
305 | snd_hdmi_show_eld(eld); | ||
306 | } | ||
307 | |||
308 | static void hdmi_present_sense(struct hda_codec *codec, hda_nid_t pin_nid, | ||
309 | struct hdmi_eld *eld) | ||
310 | { | ||
311 | int present = snd_hda_pin_sense(codec, pin_nid); | ||
312 | |||
313 | eld->monitor_present = !!(present & AC_PINSENSE_PRESENCE); | ||
314 | eld->eld_valid = !!(present & AC_PINSENSE_ELDV); | ||
315 | |||
316 | if (present & AC_PINSENSE_ELDV) | ||
317 | hdmi_get_show_eld(codec, pin_nid, eld); | ||
318 | } | ||
319 | |||
320 | static int intel_hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) | ||
321 | { | ||
322 | struct intel_hdmi_spec *spec = codec->spec; | ||
323 | |||
324 | if (spec->num_pins >= INTEL_HDMI_PINS) { | ||
325 | snd_printk(KERN_WARNING | ||
326 | "HDMI: no space for pin %d \n", pin_nid); | ||
327 | return -EINVAL; | ||
328 | } | ||
329 | |||
330 | hdmi_present_sense(codec, pin_nid, &spec->sink_eld[spec->num_pins]); | ||
331 | |||
332 | spec->pin[spec->num_pins] = pin_nid; | ||
333 | spec->num_pins++; | ||
334 | |||
335 | /* | ||
336 | * It is assumed that converter nodes come first in the node list and | ||
337 | * hence have been registered and usable now. | ||
338 | */ | ||
339 | return intel_hdmi_read_pin_conn(codec, pin_nid); | ||
340 | } | ||
341 | |||
342 | static int intel_hdmi_add_cvt(struct hda_codec *codec, hda_nid_t nid) | ||
343 | { | ||
344 | struct intel_hdmi_spec *spec = codec->spec; | ||
345 | |||
346 | if (spec->num_cvts >= INTEL_HDMI_CVTS) { | ||
347 | snd_printk(KERN_WARNING | ||
348 | "HDMI: no space for converter %d \n", nid); | ||
349 | return -EINVAL; | ||
350 | } | ||
351 | |||
352 | spec->cvt[spec->num_cvts] = nid; | ||
353 | spec->num_cvts++; | ||
354 | |||
355 | return 0; | ||
356 | } | ||
357 | |||
358 | static int intel_hdmi_parse_codec(struct hda_codec *codec) | ||
359 | { | ||
360 | hda_nid_t nid; | ||
361 | int i, nodes; | ||
362 | |||
363 | nodes = snd_hda_get_sub_nodes(codec, codec->afg, &nid); | ||
364 | if (!nid || nodes < 0) { | ||
365 | snd_printk(KERN_WARNING "HDMI: failed to get afg sub nodes\n"); | ||
366 | return -EINVAL; | ||
367 | } | ||
368 | |||
369 | for (i = 0; i < nodes; i++, nid++) { | ||
370 | unsigned int caps; | ||
371 | unsigned int type; | ||
372 | |||
373 | caps = snd_hda_param_read(codec, nid, AC_PAR_AUDIO_WIDGET_CAP); | ||
374 | type = get_wcaps_type(caps); | ||
375 | |||
376 | if (!(caps & AC_WCAP_DIGITAL)) | ||
377 | continue; | ||
378 | |||
379 | switch (type) { | ||
380 | case AC_WID_AUD_OUT: | ||
381 | if (intel_hdmi_add_cvt(codec, nid) < 0) | ||
382 | return -EINVAL; | ||
383 | break; | ||
384 | case AC_WID_PIN: | ||
385 | caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); | ||
386 | if (!(caps & (AC_PINCAP_HDMI | AC_PINCAP_DP))) | ||
387 | continue; | ||
388 | if (intel_hdmi_add_pin(codec, nid) < 0) | ||
389 | return -EINVAL; | ||
390 | break; | ||
391 | } | ||
392 | } | ||
393 | |||
394 | /* | ||
395 | * G45/IbexPeak don't support EPSS: the unsolicited pin hot plug event | ||
396 | * can be lost and presence sense verb will become inaccurate if the | ||
397 | * HDA link is powered off at hot plug or hw initialization time. | ||
398 | */ | ||
399 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
400 | if (!(snd_hda_param_read(codec, codec->afg, AC_PAR_POWER_STATE) & | ||
401 | AC_PWRST_EPSS)) | ||
402 | codec->bus->power_keep_link_on = 1; | ||
403 | #endif | ||
404 | |||
405 | return 0; | ||
406 | } | ||
407 | |||
408 | /* | ||
409 | * HDMI routines | ||
410 | */ | ||
411 | |||
412 | #ifdef BE_PARANOID | ||
413 | static void hdmi_get_dip_index(struct hda_codec *codec, hda_nid_t pin_nid, | ||
414 | int *packet_index, int *byte_index) | ||
415 | { | ||
416 | int val; | ||
417 | |||
418 | val = snd_hda_codec_read(codec, pin_nid, 0, | ||
419 | AC_VERB_GET_HDMI_DIP_INDEX, 0); | ||
420 | |||
421 | *packet_index = val >> 5; | ||
422 | *byte_index = val & 0x1f; | ||
423 | } | ||
424 | #endif | ||
425 | |||
426 | static void hdmi_set_dip_index(struct hda_codec *codec, hda_nid_t pin_nid, | ||
427 | int packet_index, int byte_index) | ||
428 | { | ||
429 | int val; | ||
430 | |||
431 | val = (packet_index << 5) | (byte_index & 0x1f); | ||
432 | |||
433 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_INDEX, val); | ||
434 | } | ||
435 | |||
436 | static void hdmi_write_dip_byte(struct hda_codec *codec, hda_nid_t pin_nid, | ||
437 | unsigned char val) | ||
438 | { | ||
439 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_DATA, val); | ||
440 | } | ||
441 | |||
442 | static void hdmi_enable_output(struct hda_codec *codec, hda_nid_t pin_nid) | ||
443 | { | ||
444 | /* Unmute */ | ||
445 | if (get_wcaps(codec, pin_nid) & AC_WCAP_OUT_AMP) | ||
446 | snd_hda_codec_write(codec, pin_nid, 0, | ||
447 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); | ||
448 | /* Enable pin out */ | ||
449 | snd_hda_codec_write(codec, pin_nid, 0, | ||
450 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
451 | } | ||
452 | |||
453 | /* | ||
454 | * Enable Audio InfoFrame Transmission | ||
455 | */ | ||
456 | static void hdmi_start_infoframe_trans(struct hda_codec *codec, | ||
457 | hda_nid_t pin_nid) | ||
458 | { | ||
459 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); | ||
460 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_XMIT, | ||
461 | AC_DIPXMIT_BEST); | ||
462 | } | ||
463 | |||
464 | /* | ||
465 | * Disable Audio InfoFrame Transmission | ||
466 | */ | ||
467 | static void hdmi_stop_infoframe_trans(struct hda_codec *codec, | ||
468 | hda_nid_t pin_nid) | ||
469 | { | ||
470 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); | ||
471 | snd_hda_codec_write(codec, pin_nid, 0, AC_VERB_SET_HDMI_DIP_XMIT, | ||
472 | AC_DIPXMIT_DISABLE); | ||
473 | } | ||
474 | |||
475 | static int hdmi_get_channel_count(struct hda_codec *codec, hda_nid_t nid) | ||
476 | { | ||
477 | return 1 + snd_hda_codec_read(codec, nid, 0, | ||
478 | AC_VERB_GET_CVT_CHAN_COUNT, 0); | ||
479 | } | ||
480 | |||
481 | static void hdmi_set_channel_count(struct hda_codec *codec, | ||
482 | hda_nid_t nid, int chs) | ||
483 | { | ||
484 | if (chs != hdmi_get_channel_count(codec, nid)) | ||
485 | snd_hda_codec_write(codec, nid, 0, | ||
486 | AC_VERB_SET_CVT_CHAN_COUNT, chs - 1); | ||
487 | } | ||
488 | |||
489 | static void hdmi_debug_channel_mapping(struct hda_codec *codec, | ||
490 | hda_nid_t pin_nid) | ||
491 | { | ||
492 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
493 | int i; | ||
494 | int slot; | ||
495 | |||
496 | for (i = 0; i < 8; i++) { | ||
497 | slot = snd_hda_codec_read(codec, pin_nid, 0, | ||
498 | AC_VERB_GET_HDMI_CHAN_SLOT, i); | ||
499 | printk(KERN_DEBUG "HDMI: ASP channel %d => slot %d\n", | ||
500 | slot >> 4, slot & 0xf); | ||
501 | } | ||
502 | #endif | ||
503 | } | ||
504 | |||
505 | |||
506 | /* | ||
507 | * Audio InfoFrame routines | ||
508 | */ | ||
509 | |||
510 | static void hdmi_debug_dip_size(struct hda_codec *codec, hda_nid_t pin_nid) | ||
511 | { | ||
512 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
513 | int i; | ||
514 | int size; | ||
515 | |||
516 | size = snd_hdmi_get_eld_size(codec, pin_nid); | ||
517 | printk(KERN_DEBUG "HDMI: ELD buf size is %d\n", size); | ||
518 | |||
519 | for (i = 0; i < 8; i++) { | ||
520 | size = snd_hda_codec_read(codec, pin_nid, 0, | ||
521 | AC_VERB_GET_HDMI_DIP_SIZE, i); | ||
522 | printk(KERN_DEBUG "HDMI: DIP GP[%d] buf size is %d\n", i, size); | ||
523 | } | ||
524 | #endif | ||
525 | } | ||
526 | |||
527 | static void hdmi_clear_dip_buffers(struct hda_codec *codec, hda_nid_t pin_nid) | ||
528 | { | ||
529 | #ifdef BE_PARANOID | ||
530 | int i, j; | ||
531 | int size; | ||
532 | int pi, bi; | ||
533 | for (i = 0; i < 8; i++) { | ||
534 | size = snd_hda_codec_read(codec, pin_nid, 0, | ||
535 | AC_VERB_GET_HDMI_DIP_SIZE, i); | ||
536 | if (size == 0) | ||
537 | continue; | ||
538 | |||
539 | hdmi_set_dip_index(codec, pin_nid, i, 0x0); | ||
540 | for (j = 1; j < 1000; j++) { | ||
541 | hdmi_write_dip_byte(codec, pin_nid, 0x0); | ||
542 | hdmi_get_dip_index(codec, pin_nid, &pi, &bi); | ||
543 | if (pi != i) | ||
544 | snd_printd(KERN_INFO "dip index %d: %d != %d\n", | ||
545 | bi, pi, i); | ||
546 | if (bi == 0) /* byte index wrapped around */ | ||
547 | break; | ||
548 | } | ||
549 | snd_printd(KERN_INFO | ||
550 | "HDMI: DIP GP[%d] buf reported size=%d, written=%d\n", | ||
551 | i, size, j); | ||
552 | } | ||
553 | #endif | ||
554 | } | ||
555 | |||
556 | static void hdmi_checksum_audio_infoframe(struct hdmi_audio_infoframe *ai) | ||
557 | { | ||
558 | u8 *bytes = (u8 *)ai; | ||
559 | u8 sum = 0; | ||
560 | int i; | ||
561 | |||
562 | ai->checksum = 0; | ||
563 | |||
564 | for (i = 0; i < sizeof(*ai); i++) | ||
565 | sum += bytes[i]; | ||
566 | |||
567 | ai->checksum = - sum; | ||
568 | } | ||
569 | |||
570 | static void hdmi_fill_audio_infoframe(struct hda_codec *codec, | ||
571 | hda_nid_t pin_nid, | ||
572 | struct hdmi_audio_infoframe *ai) | ||
573 | { | ||
574 | u8 *bytes = (u8 *)ai; | ||
575 | int i; | ||
576 | |||
577 | hdmi_debug_dip_size(codec, pin_nid); | ||
578 | hdmi_clear_dip_buffers(codec, pin_nid); /* be paranoid */ | ||
579 | |||
580 | hdmi_checksum_audio_infoframe(ai); | ||
581 | |||
582 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); | ||
583 | for (i = 0; i < sizeof(*ai); i++) | ||
584 | hdmi_write_dip_byte(codec, pin_nid, bytes[i]); | ||
585 | } | ||
586 | |||
587 | /* | ||
588 | * Compute derived values in channel_allocations[]. | ||
589 | */ | ||
590 | static void init_channel_allocations(void) | ||
591 | { | ||
592 | int i, j; | ||
593 | struct cea_channel_speaker_allocation *p; | ||
594 | |||
595 | for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { | ||
596 | p = channel_allocations + i; | ||
597 | p->channels = 0; | ||
598 | p->spk_mask = 0; | ||
599 | for (j = 0; j < ARRAY_SIZE(p->speakers); j++) | ||
600 | if (p->speakers[j]) { | ||
601 | p->channels++; | ||
602 | p->spk_mask |= p->speakers[j]; | ||
603 | } | ||
604 | } | ||
605 | } | ||
606 | |||
607 | /* | ||
608 | * The transformation takes two steps: | ||
609 | * | ||
610 | * eld->spk_alloc => (eld_speaker_allocation_bits[]) => spk_mask | ||
611 | * spk_mask => (channel_allocations[]) => ai->CA | ||
612 | * | ||
613 | * TODO: it could select the wrong CA from multiple candidates. | ||
614 | */ | ||
615 | static int hdmi_setup_channel_allocation(struct hda_codec *codec, hda_nid_t nid, | ||
616 | struct hdmi_audio_infoframe *ai) | ||
617 | { | ||
618 | struct intel_hdmi_spec *spec = codec->spec; | ||
619 | struct hdmi_eld *eld; | ||
620 | int i; | ||
621 | int spk_mask = 0; | ||
622 | int channels = 1 + (ai->CC02_CT47 & 0x7); | ||
623 | char buf[SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE]; | ||
624 | |||
625 | /* | ||
626 | * CA defaults to 0 for basic stereo audio | ||
627 | */ | ||
628 | if (channels <= 2) | ||
629 | return 0; | ||
630 | |||
631 | i = hda_node_index(spec->pin_cvt, nid); | ||
632 | if (i < 0) | ||
633 | return 0; | ||
634 | eld = &spec->sink_eld[i]; | ||
635 | |||
636 | /* | ||
637 | * HDMI sink's ELD info cannot always be retrieved for now, e.g. | ||
638 | * in console or for audio devices. Assume the highest speakers | ||
639 | * configuration, to _not_ prohibit multi-channel audio playback. | ||
640 | */ | ||
641 | if (!eld->spk_alloc) | ||
642 | eld->spk_alloc = 0xffff; | ||
643 | |||
644 | /* | ||
645 | * expand ELD's speaker allocation mask | ||
646 | * | ||
647 | * ELD tells the speaker mask in a compact(paired) form, | ||
648 | * expand ELD's notions to match the ones used by Audio InfoFrame. | ||
649 | */ | ||
650 | for (i = 0; i < ARRAY_SIZE(eld_speaker_allocation_bits); i++) { | ||
651 | if (eld->spk_alloc & (1 << i)) | ||
652 | spk_mask |= eld_speaker_allocation_bits[i]; | ||
653 | } | ||
654 | |||
655 | /* search for the first working match in the CA table */ | ||
656 | for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { | ||
657 | if (channels == channel_allocations[i].channels && | ||
658 | (spk_mask & channel_allocations[i].spk_mask) == | ||
659 | channel_allocations[i].spk_mask) { | ||
660 | ai->CA = channel_allocations[i].ca_index; | ||
661 | break; | ||
662 | } | ||
663 | } | ||
664 | |||
665 | snd_print_channel_allocation(eld->spk_alloc, buf, sizeof(buf)); | ||
666 | snd_printdd(KERN_INFO | ||
667 | "HDMI: select CA 0x%x for %d-channel allocation: %s\n", | ||
668 | ai->CA, channels, buf); | ||
669 | |||
670 | return ai->CA; | ||
671 | } | ||
672 | |||
673 | static void hdmi_setup_channel_mapping(struct hda_codec *codec, | ||
674 | hda_nid_t pin_nid, | ||
675 | struct hdmi_audio_infoframe *ai) | ||
676 | { | ||
677 | int i; | ||
678 | int ca = ai->CA; | ||
679 | int err; | ||
680 | |||
681 | if (hdmi_channel_mapping[ca][1] == 0) { | ||
682 | for (i = 0; i < channel_allocations[ca].channels; i++) | ||
683 | hdmi_channel_mapping[ca][i] = i | (i << 4); | ||
684 | for (; i < 8; i++) | ||
685 | hdmi_channel_mapping[ca][i] = 0xf | (i << 4); | ||
686 | } | ||
687 | |||
688 | for (i = 0; i < 8; i++) { | ||
689 | err = snd_hda_codec_write(codec, pin_nid, 0, | ||
690 | AC_VERB_SET_HDMI_CHAN_SLOT, | ||
691 | hdmi_channel_mapping[ca][i]); | ||
692 | if (err) { | ||
693 | snd_printdd(KERN_INFO "HDMI: channel mapping failed\n"); | ||
694 | break; | ||
695 | } | ||
696 | } | ||
697 | |||
698 | hdmi_debug_channel_mapping(codec, pin_nid); | ||
699 | } | ||
700 | |||
701 | static bool hdmi_infoframe_uptodate(struct hda_codec *codec, hda_nid_t pin_nid, | ||
702 | struct hdmi_audio_infoframe *ai) | ||
703 | { | ||
704 | u8 *bytes = (u8 *)ai; | ||
705 | u8 val; | ||
706 | int i; | ||
707 | |||
708 | if (snd_hda_codec_read(codec, pin_nid, 0, AC_VERB_GET_HDMI_DIP_XMIT, 0) | ||
709 | != AC_DIPXMIT_BEST) | ||
710 | return false; | ||
711 | |||
712 | hdmi_set_dip_index(codec, pin_nid, 0x0, 0x0); | ||
713 | for (i = 0; i < sizeof(*ai); i++) { | ||
714 | val = snd_hda_codec_read(codec, pin_nid, 0, | ||
715 | AC_VERB_GET_HDMI_DIP_DATA, 0); | ||
716 | if (val != bytes[i]) | ||
717 | return false; | ||
718 | } | ||
719 | |||
720 | return true; | ||
721 | } | ||
722 | |||
723 | static void hdmi_setup_audio_infoframe(struct hda_codec *codec, hda_nid_t nid, | ||
724 | struct snd_pcm_substream *substream) | ||
725 | { | ||
726 | struct intel_hdmi_spec *spec = codec->spec; | ||
727 | hda_nid_t pin_nid; | ||
728 | int i; | ||
729 | struct hdmi_audio_infoframe ai = { | ||
730 | .type = 0x84, | ||
731 | .ver = 0x01, | ||
732 | .len = 0x0a, | ||
733 | .CC02_CT47 = substream->runtime->channels - 1, | ||
734 | }; | ||
735 | |||
736 | hdmi_setup_channel_allocation(codec, nid, &ai); | ||
737 | |||
738 | for (i = 0; i < spec->num_pins; i++) { | ||
739 | if (spec->pin_cvt[i] != nid) | ||
740 | continue; | ||
741 | if (!spec->sink_eld[i].monitor_present) | ||
742 | continue; | ||
743 | |||
744 | pin_nid = spec->pin[i]; | ||
745 | if (!hdmi_infoframe_uptodate(codec, pin_nid, &ai)) { | ||
746 | hdmi_setup_channel_mapping(codec, pin_nid, &ai); | ||
747 | hdmi_stop_infoframe_trans(codec, pin_nid); | ||
748 | hdmi_fill_audio_infoframe(codec, pin_nid, &ai); | ||
749 | hdmi_start_infoframe_trans(codec, pin_nid); | ||
750 | } | ||
751 | } | ||
752 | } | ||
753 | |||
754 | |||
755 | /* | 53 | /* |
756 | * Unsolicited events | 54 | * HDMI callbacks |
757 | */ | 55 | */ |
758 | 56 | ||
759 | static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | ||
760 | { | ||
761 | struct intel_hdmi_spec *spec = codec->spec; | ||
762 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; | ||
763 | int pind = !!(res & AC_UNSOL_RES_PD); | ||
764 | int eldv = !!(res & AC_UNSOL_RES_ELDV); | ||
765 | int index; | ||
766 | |||
767 | printk(KERN_INFO | ||
768 | "HDMI hot plug event: Pin=%d Presence_Detect=%d ELD_Valid=%d\n", | ||
769 | tag, pind, eldv); | ||
770 | |||
771 | index = hda_node_index(spec->pin, tag); | ||
772 | if (index < 0) | ||
773 | return; | ||
774 | |||
775 | spec->sink_eld[index].monitor_present = pind; | ||
776 | spec->sink_eld[index].eld_valid = eldv; | ||
777 | |||
778 | if (pind && eldv) { | ||
779 | hdmi_get_show_eld(codec, spec->pin[index], &spec->sink_eld[index]); | ||
780 | /* TODO: do real things about ELD */ | ||
781 | } | ||
782 | } | ||
783 | |||
784 | static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) | ||
785 | { | ||
786 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; | ||
787 | int subtag = (res & AC_UNSOL_RES_SUBTAG) >> AC_UNSOL_RES_SUBTAG_SHIFT; | ||
788 | int cp_state = !!(res & AC_UNSOL_RES_CP_STATE); | ||
789 | int cp_ready = !!(res & AC_UNSOL_RES_CP_READY); | ||
790 | |||
791 | printk(KERN_INFO | ||
792 | "HDMI CP event: PIN=%d SUBTAG=0x%x CP_STATE=%d CP_READY=%d\n", | ||
793 | tag, | ||
794 | subtag, | ||
795 | cp_state, | ||
796 | cp_ready); | ||
797 | |||
798 | /* TODO */ | ||
799 | if (cp_state) | ||
800 | ; | ||
801 | if (cp_ready) | ||
802 | ; | ||
803 | } | ||
804 | |||
805 | |||
806 | static void intel_hdmi_unsol_event(struct hda_codec *codec, unsigned int res) | ||
807 | { | ||
808 | struct intel_hdmi_spec *spec = codec->spec; | ||
809 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; | ||
810 | int subtag = (res & AC_UNSOL_RES_SUBTAG) >> AC_UNSOL_RES_SUBTAG_SHIFT; | ||
811 | |||
812 | if (hda_node_index(spec->pin, tag) < 0) { | ||
813 | snd_printd(KERN_INFO "Unexpected HDMI event tag 0x%x\n", tag); | ||
814 | return; | ||
815 | } | ||
816 | |||
817 | if (subtag == 0) | ||
818 | hdmi_intrinsic_event(codec, res); | ||
819 | else | ||
820 | hdmi_non_intrinsic_event(codec, res); | ||
821 | } | ||
822 | |||
823 | /* | ||
824 | * Callbacks | ||
825 | */ | ||
826 | |||
827 | static void hdmi_setup_stream(struct hda_codec *codec, hda_nid_t nid, | ||
828 | u32 stream_tag, int format) | ||
829 | { | ||
830 | int tag; | ||
831 | int fmt; | ||
832 | |||
833 | tag = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0) >> 4; | ||
834 | fmt = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_STREAM_FORMAT, 0); | ||
835 | |||
836 | snd_printdd("hdmi_setup_stream: " | ||
837 | "NID=0x%x, %sstream=0x%x, %sformat=0x%x\n", | ||
838 | nid, | ||
839 | tag == stream_tag ? "" : "new-", | ||
840 | stream_tag, | ||
841 | fmt == format ? "" : "new-", | ||
842 | format); | ||
843 | |||
844 | if (tag != stream_tag) | ||
845 | snd_hda_codec_write(codec, nid, 0, | ||
846 | AC_VERB_SET_CHANNEL_STREAMID, stream_tag << 4); | ||
847 | if (fmt != format) | ||
848 | snd_hda_codec_write(codec, nid, 0, | ||
849 | AC_VERB_SET_STREAM_FORMAT, format); | ||
850 | } | ||
851 | |||
852 | static int intel_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | 57 | static int intel_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
853 | struct hda_codec *codec, | 58 | struct hda_codec *codec, |
854 | unsigned int stream_tag, | 59 | unsigned int stream_tag, |
@@ -882,7 +87,7 @@ static struct hda_pcm_stream intel_hdmi_pcm_playback = { | |||
882 | 87 | ||
883 | static int intel_hdmi_build_pcms(struct hda_codec *codec) | 88 | static int intel_hdmi_build_pcms(struct hda_codec *codec) |
884 | { | 89 | { |
885 | struct intel_hdmi_spec *spec = codec->spec; | 90 | struct hdmi_spec *spec = codec->spec; |
886 | struct hda_pcm *info = spec->pcm_rec; | 91 | struct hda_pcm *info = spec->pcm_rec; |
887 | int i; | 92 | int i; |
888 | 93 | ||
@@ -908,7 +113,7 @@ static int intel_hdmi_build_pcms(struct hda_codec *codec) | |||
908 | 113 | ||
909 | static int intel_hdmi_build_controls(struct hda_codec *codec) | 114 | static int intel_hdmi_build_controls(struct hda_codec *codec) |
910 | { | 115 | { |
911 | struct intel_hdmi_spec *spec = codec->spec; | 116 | struct hdmi_spec *spec = codec->spec; |
912 | int err; | 117 | int err; |
913 | int i; | 118 | int i; |
914 | 119 | ||
@@ -923,7 +128,7 @@ static int intel_hdmi_build_controls(struct hda_codec *codec) | |||
923 | 128 | ||
924 | static int intel_hdmi_init(struct hda_codec *codec) | 129 | static int intel_hdmi_init(struct hda_codec *codec) |
925 | { | 130 | { |
926 | struct intel_hdmi_spec *spec = codec->spec; | 131 | struct hdmi_spec *spec = codec->spec; |
927 | int i; | 132 | int i; |
928 | 133 | ||
929 | for (i = 0; spec->pin[i]; i++) { | 134 | for (i = 0; spec->pin[i]; i++) { |
@@ -937,7 +142,7 @@ static int intel_hdmi_init(struct hda_codec *codec) | |||
937 | 142 | ||
938 | static void intel_hdmi_free(struct hda_codec *codec) | 143 | static void intel_hdmi_free(struct hda_codec *codec) |
939 | { | 144 | { |
940 | struct intel_hdmi_spec *spec = codec->spec; | 145 | struct hdmi_spec *spec = codec->spec; |
941 | int i; | 146 | int i; |
942 | 147 | ||
943 | for (i = 0; i < spec->num_pins; i++) | 148 | for (i = 0; i < spec->num_pins; i++) |
@@ -951,12 +156,12 @@ static struct hda_codec_ops intel_hdmi_patch_ops = { | |||
951 | .free = intel_hdmi_free, | 156 | .free = intel_hdmi_free, |
952 | .build_pcms = intel_hdmi_build_pcms, | 157 | .build_pcms = intel_hdmi_build_pcms, |
953 | .build_controls = intel_hdmi_build_controls, | 158 | .build_controls = intel_hdmi_build_controls, |
954 | .unsol_event = intel_hdmi_unsol_event, | 159 | .unsol_event = hdmi_unsol_event, |
955 | }; | 160 | }; |
956 | 161 | ||
957 | static int patch_intel_hdmi(struct hda_codec *codec) | 162 | static int patch_intel_hdmi(struct hda_codec *codec) |
958 | { | 163 | { |
959 | struct intel_hdmi_spec *spec; | 164 | struct hdmi_spec *spec; |
960 | int i; | 165 | int i; |
961 | 166 | ||
962 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 167 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
@@ -964,7 +169,7 @@ static int patch_intel_hdmi(struct hda_codec *codec) | |||
964 | return -ENOMEM; | 169 | return -ENOMEM; |
965 | 170 | ||
966 | codec->spec = spec; | 171 | codec->spec = spec; |
967 | if (intel_hdmi_parse_codec(codec) < 0) { | 172 | if (hdmi_parse_codec(codec) < 0) { |
968 | codec->spec = NULL; | 173 | codec->spec = NULL; |
969 | kfree(spec); | 174 | kfree(spec); |
970 | return -EINVAL; | 175 | return -EINVAL; |
diff --git a/sound/pci/hda/patch_nvhdmi.c b/sound/pci/hda/patch_nvhdmi.c index 6afdab09bab7..70669a246902 100644 --- a/sound/pci/hda/patch_nvhdmi.c +++ b/sound/pci/hda/patch_nvhdmi.c | |||
@@ -29,13 +29,23 @@ | |||
29 | #include "hda_codec.h" | 29 | #include "hda_codec.h" |
30 | #include "hda_local.h" | 30 | #include "hda_local.h" |
31 | 31 | ||
32 | #define MAX_HDMI_CVTS 1 | ||
33 | #define MAX_HDMI_PINS 1 | ||
34 | |||
35 | #include "patch_hdmi.c" | ||
36 | |||
37 | static char *nvhdmi_pcm_names[MAX_HDMI_CVTS] = { | ||
38 | "NVIDIA HDMI", | ||
39 | }; | ||
40 | |||
32 | /* define below to restrict the supported rates and formats */ | 41 | /* define below to restrict the supported rates and formats */ |
33 | /* #define LIMITED_RATE_FMT_SUPPORT */ | 42 | /* #define LIMITED_RATE_FMT_SUPPORT */ |
34 | 43 | ||
35 | struct nvhdmi_spec { | 44 | enum HDACodec { |
36 | struct hda_multi_out multiout; | 45 | HDA_CODEC_NVIDIA_MCP7X, |
37 | 46 | HDA_CODEC_NVIDIA_MCP89, | |
38 | struct hda_pcm pcm_rec; | 47 | HDA_CODEC_NVIDIA_GT21X, |
48 | HDA_CODEC_INVALID | ||
39 | }; | 49 | }; |
40 | 50 | ||
41 | #define Nv_VERB_SET_Channel_Allocation 0xF79 | 51 | #define Nv_VERB_SET_Channel_Allocation 0xF79 |
@@ -43,15 +53,18 @@ struct nvhdmi_spec { | |||
43 | #define Nv_VERB_SET_Audio_Protection_On 0xF98 | 53 | #define Nv_VERB_SET_Audio_Protection_On 0xF98 |
44 | #define Nv_VERB_SET_Audio_Protection_Off 0xF99 | 54 | #define Nv_VERB_SET_Audio_Protection_Off 0xF99 |
45 | 55 | ||
46 | #define Nv_Master_Convert_nid 0x04 | 56 | #define nvhdmi_master_con_nid_7x 0x04 |
47 | #define Nv_Master_Pin_nid 0x05 | 57 | #define nvhdmi_master_pin_nid_7x 0x05 |
48 | 58 | ||
49 | static hda_nid_t nvhdmi_convert_nids[4] = { | 59 | #define nvhdmi_master_con_nid_89 0x04 |
60 | #define nvhdmi_master_pin_nid_89 0x05 | ||
61 | |||
62 | static hda_nid_t nvhdmi_con_nids_7x[4] = { | ||
50 | /*front, rear, clfe, rear_surr */ | 63 | /*front, rear, clfe, rear_surr */ |
51 | 0x6, 0x8, 0xa, 0xc, | 64 | 0x6, 0x8, 0xa, 0xc, |
52 | }; | 65 | }; |
53 | 66 | ||
54 | static struct hda_verb nvhdmi_basic_init[] = { | 67 | static struct hda_verb nvhdmi_basic_init_7x[] = { |
55 | /* set audio protect on */ | 68 | /* set audio protect on */ |
56 | { 0x1, Nv_VERB_SET_Audio_Protection_On, 0x1}, | 69 | { 0x1, Nv_VERB_SET_Audio_Protection_On, 0x1}, |
57 | /* enable digital output on pin widget */ | 70 | /* enable digital output on pin widget */ |
@@ -84,22 +97,60 @@ static struct hda_verb nvhdmi_basic_init[] = { | |||
84 | */ | 97 | */ |
85 | static int nvhdmi_build_controls(struct hda_codec *codec) | 98 | static int nvhdmi_build_controls(struct hda_codec *codec) |
86 | { | 99 | { |
87 | struct nvhdmi_spec *spec = codec->spec; | 100 | struct hdmi_spec *spec = codec->spec; |
88 | int err; | 101 | int err; |
102 | int i; | ||
89 | 103 | ||
90 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); | 104 | if ((spec->codec_type == HDA_CODEC_NVIDIA_MCP89) |
91 | if (err < 0) | 105 | || (spec->codec_type == HDA_CODEC_NVIDIA_GT21X)) { |
92 | return err; | 106 | for (i = 0; i < codec->num_pcms; i++) { |
107 | err = snd_hda_create_spdif_out_ctls(codec, | ||
108 | spec->cvt[i]); | ||
109 | if (err < 0) | ||
110 | return err; | ||
111 | } | ||
112 | } else { | ||
113 | err = snd_hda_create_spdif_out_ctls(codec, | ||
114 | spec->multiout.dig_out_nid); | ||
115 | if (err < 0) | ||
116 | return err; | ||
117 | } | ||
93 | 118 | ||
94 | return 0; | 119 | return 0; |
95 | } | 120 | } |
96 | 121 | ||
97 | static int nvhdmi_init(struct hda_codec *codec) | 122 | static int nvhdmi_init(struct hda_codec *codec) |
98 | { | 123 | { |
99 | snd_hda_sequence_write(codec, nvhdmi_basic_init); | 124 | struct hdmi_spec *spec = codec->spec; |
125 | int i; | ||
126 | if ((spec->codec_type == HDA_CODEC_NVIDIA_MCP89) | ||
127 | || (spec->codec_type == HDA_CODEC_NVIDIA_GT21X)) { | ||
128 | for (i = 0; spec->pin[i]; i++) { | ||
129 | hdmi_enable_output(codec, spec->pin[i]); | ||
130 | snd_hda_codec_write(codec, spec->pin[i], 0, | ||
131 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
132 | AC_USRSP_EN | spec->pin[i]); | ||
133 | } | ||
134 | } else { | ||
135 | snd_hda_sequence_write(codec, nvhdmi_basic_init_7x); | ||
136 | } | ||
100 | return 0; | 137 | return 0; |
101 | } | 138 | } |
102 | 139 | ||
140 | static void nvhdmi_free(struct hda_codec *codec) | ||
141 | { | ||
142 | struct hdmi_spec *spec = codec->spec; | ||
143 | int i; | ||
144 | |||
145 | if ((spec->codec_type == HDA_CODEC_NVIDIA_MCP89) | ||
146 | || (spec->codec_type == HDA_CODEC_NVIDIA_GT21X)) { | ||
147 | for (i = 0; i < spec->num_pins; i++) | ||
148 | snd_hda_eld_proc_free(codec, &spec->sink_eld[i]); | ||
149 | } | ||
150 | |||
151 | kfree(spec); | ||
152 | } | ||
153 | |||
103 | /* | 154 | /* |
104 | * Digital out | 155 | * Digital out |
105 | */ | 156 | */ |
@@ -107,25 +158,25 @@ static int nvhdmi_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, | |||
107 | struct hda_codec *codec, | 158 | struct hda_codec *codec, |
108 | struct snd_pcm_substream *substream) | 159 | struct snd_pcm_substream *substream) |
109 | { | 160 | { |
110 | struct nvhdmi_spec *spec = codec->spec; | 161 | struct hdmi_spec *spec = codec->spec; |
111 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); | 162 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
112 | } | 163 | } |
113 | 164 | ||
114 | static int nvhdmi_dig_playback_pcm_close_8ch(struct hda_pcm_stream *hinfo, | 165 | static int nvhdmi_dig_playback_pcm_close_8ch_7x(struct hda_pcm_stream *hinfo, |
115 | struct hda_codec *codec, | 166 | struct hda_codec *codec, |
116 | struct snd_pcm_substream *substream) | 167 | struct snd_pcm_substream *substream) |
117 | { | 168 | { |
118 | struct nvhdmi_spec *spec = codec->spec; | 169 | struct hdmi_spec *spec = codec->spec; |
119 | int i; | 170 | int i; |
120 | 171 | ||
121 | snd_hda_codec_write(codec, Nv_Master_Convert_nid, | 172 | snd_hda_codec_write(codec, nvhdmi_master_con_nid_7x, |
122 | 0, AC_VERB_SET_CHANNEL_STREAMID, 0); | 173 | 0, AC_VERB_SET_CHANNEL_STREAMID, 0); |
123 | for (i = 0; i < 4; i++) { | 174 | for (i = 0; i < 4; i++) { |
124 | /* set the stream id */ | 175 | /* set the stream id */ |
125 | snd_hda_codec_write(codec, nvhdmi_convert_nids[i], 0, | 176 | snd_hda_codec_write(codec, nvhdmi_con_nids_7x[i], 0, |
126 | AC_VERB_SET_CHANNEL_STREAMID, 0); | 177 | AC_VERB_SET_CHANNEL_STREAMID, 0); |
127 | /* set the stream format */ | 178 | /* set the stream format */ |
128 | snd_hda_codec_write(codec, nvhdmi_convert_nids[i], 0, | 179 | snd_hda_codec_write(codec, nvhdmi_con_nids_7x[i], 0, |
129 | AC_VERB_SET_STREAM_FORMAT, 0); | 180 | AC_VERB_SET_STREAM_FORMAT, 0); |
130 | } | 181 | } |
131 | 182 | ||
@@ -136,10 +187,25 @@ static int nvhdmi_dig_playback_pcm_close_2ch(struct hda_pcm_stream *hinfo, | |||
136 | struct hda_codec *codec, | 187 | struct hda_codec *codec, |
137 | struct snd_pcm_substream *substream) | 188 | struct snd_pcm_substream *substream) |
138 | { | 189 | { |
139 | struct nvhdmi_spec *spec = codec->spec; | 190 | struct hdmi_spec *spec = codec->spec; |
140 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); | 191 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
141 | } | 192 | } |
142 | 193 | ||
194 | static int nvhdmi_dig_playback_pcm_prepare_8ch_89(struct hda_pcm_stream *hinfo, | ||
195 | struct hda_codec *codec, | ||
196 | unsigned int stream_tag, | ||
197 | unsigned int format, | ||
198 | struct snd_pcm_substream *substream) | ||
199 | { | ||
200 | hdmi_set_channel_count(codec, hinfo->nid, | ||
201 | substream->runtime->channels); | ||
202 | |||
203 | hdmi_setup_audio_infoframe(codec, hinfo->nid, substream); | ||
204 | |||
205 | hdmi_setup_stream(codec, hinfo->nid, stream_tag, format); | ||
206 | return 0; | ||
207 | } | ||
208 | |||
143 | static int nvhdmi_dig_playback_pcm_prepare_8ch(struct hda_pcm_stream *hinfo, | 209 | static int nvhdmi_dig_playback_pcm_prepare_8ch(struct hda_pcm_stream *hinfo, |
144 | struct hda_codec *codec, | 210 | struct hda_codec *codec, |
145 | unsigned int stream_tag, | 211 | unsigned int stream_tag, |
@@ -181,29 +247,29 @@ static int nvhdmi_dig_playback_pcm_prepare_8ch(struct hda_pcm_stream *hinfo, | |||
181 | /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */ | 247 | /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */ |
182 | if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE)) | 248 | if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE)) |
183 | snd_hda_codec_write(codec, | 249 | snd_hda_codec_write(codec, |
184 | Nv_Master_Convert_nid, | 250 | nvhdmi_master_con_nid_7x, |
185 | 0, | 251 | 0, |
186 | AC_VERB_SET_DIGI_CONVERT_1, | 252 | AC_VERB_SET_DIGI_CONVERT_1, |
187 | codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff); | 253 | codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff); |
188 | 254 | ||
189 | /* set the stream id */ | 255 | /* set the stream id */ |
190 | snd_hda_codec_write(codec, Nv_Master_Convert_nid, 0, | 256 | snd_hda_codec_write(codec, nvhdmi_master_con_nid_7x, 0, |
191 | AC_VERB_SET_CHANNEL_STREAMID, (stream_tag << 4) | 0x0); | 257 | AC_VERB_SET_CHANNEL_STREAMID, (stream_tag << 4) | 0x0); |
192 | 258 | ||
193 | /* set the stream format */ | 259 | /* set the stream format */ |
194 | snd_hda_codec_write(codec, Nv_Master_Convert_nid, 0, | 260 | snd_hda_codec_write(codec, nvhdmi_master_con_nid_7x, 0, |
195 | AC_VERB_SET_STREAM_FORMAT, format); | 261 | AC_VERB_SET_STREAM_FORMAT, format); |
196 | 262 | ||
197 | /* turn on again (if needed) */ | 263 | /* turn on again (if needed) */ |
198 | /* enable and set the channel status audio/data flag */ | 264 | /* enable and set the channel status audio/data flag */ |
199 | if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE)) { | 265 | if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE)) { |
200 | snd_hda_codec_write(codec, | 266 | snd_hda_codec_write(codec, |
201 | Nv_Master_Convert_nid, | 267 | nvhdmi_master_con_nid_7x, |
202 | 0, | 268 | 0, |
203 | AC_VERB_SET_DIGI_CONVERT_1, | 269 | AC_VERB_SET_DIGI_CONVERT_1, |
204 | codec->spdif_ctls & 0xff); | 270 | codec->spdif_ctls & 0xff); |
205 | snd_hda_codec_write(codec, | 271 | snd_hda_codec_write(codec, |
206 | Nv_Master_Convert_nid, | 272 | nvhdmi_master_con_nid_7x, |
207 | 0, | 273 | 0, |
208 | AC_VERB_SET_DIGI_CONVERT_2, dataDCC2); | 274 | AC_VERB_SET_DIGI_CONVERT_2, dataDCC2); |
209 | } | 275 | } |
@@ -220,19 +286,19 @@ static int nvhdmi_dig_playback_pcm_prepare_8ch(struct hda_pcm_stream *hinfo, | |||
220 | if (codec->spdif_status_reset && | 286 | if (codec->spdif_status_reset && |
221 | (codec->spdif_ctls & AC_DIG1_ENABLE)) | 287 | (codec->spdif_ctls & AC_DIG1_ENABLE)) |
222 | snd_hda_codec_write(codec, | 288 | snd_hda_codec_write(codec, |
223 | nvhdmi_convert_nids[i], | 289 | nvhdmi_con_nids_7x[i], |
224 | 0, | 290 | 0, |
225 | AC_VERB_SET_DIGI_CONVERT_1, | 291 | AC_VERB_SET_DIGI_CONVERT_1, |
226 | codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff); | 292 | codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff); |
227 | /* set the stream id */ | 293 | /* set the stream id */ |
228 | snd_hda_codec_write(codec, | 294 | snd_hda_codec_write(codec, |
229 | nvhdmi_convert_nids[i], | 295 | nvhdmi_con_nids_7x[i], |
230 | 0, | 296 | 0, |
231 | AC_VERB_SET_CHANNEL_STREAMID, | 297 | AC_VERB_SET_CHANNEL_STREAMID, |
232 | (stream_tag << 4) | channel_id); | 298 | (stream_tag << 4) | channel_id); |
233 | /* set the stream format */ | 299 | /* set the stream format */ |
234 | snd_hda_codec_write(codec, | 300 | snd_hda_codec_write(codec, |
235 | nvhdmi_convert_nids[i], | 301 | nvhdmi_con_nids_7x[i], |
236 | 0, | 302 | 0, |
237 | AC_VERB_SET_STREAM_FORMAT, | 303 | AC_VERB_SET_STREAM_FORMAT, |
238 | format); | 304 | format); |
@@ -241,12 +307,12 @@ static int nvhdmi_dig_playback_pcm_prepare_8ch(struct hda_pcm_stream *hinfo, | |||
241 | if (codec->spdif_status_reset && | 307 | if (codec->spdif_status_reset && |
242 | (codec->spdif_ctls & AC_DIG1_ENABLE)) { | 308 | (codec->spdif_ctls & AC_DIG1_ENABLE)) { |
243 | snd_hda_codec_write(codec, | 309 | snd_hda_codec_write(codec, |
244 | nvhdmi_convert_nids[i], | 310 | nvhdmi_con_nids_7x[i], |
245 | 0, | 311 | 0, |
246 | AC_VERB_SET_DIGI_CONVERT_1, | 312 | AC_VERB_SET_DIGI_CONVERT_1, |
247 | codec->spdif_ctls & 0xff); | 313 | codec->spdif_ctls & 0xff); |
248 | snd_hda_codec_write(codec, | 314 | snd_hda_codec_write(codec, |
249 | nvhdmi_convert_nids[i], | 315 | nvhdmi_con_nids_7x[i], |
250 | 0, | 316 | 0, |
251 | AC_VERB_SET_DIGI_CONVERT_2, dataDCC2); | 317 | AC_VERB_SET_DIGI_CONVERT_2, dataDCC2); |
252 | } | 318 | } |
@@ -261,28 +327,47 @@ static int nvhdmi_dig_playback_pcm_prepare_8ch(struct hda_pcm_stream *hinfo, | |||
261 | return 0; | 327 | return 0; |
262 | } | 328 | } |
263 | 329 | ||
330 | static int nvhdmi_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | ||
331 | struct hda_codec *codec, | ||
332 | struct snd_pcm_substream *substream) | ||
333 | { | ||
334 | return 0; | ||
335 | } | ||
336 | |||
264 | static int nvhdmi_dig_playback_pcm_prepare_2ch(struct hda_pcm_stream *hinfo, | 337 | static int nvhdmi_dig_playback_pcm_prepare_2ch(struct hda_pcm_stream *hinfo, |
265 | struct hda_codec *codec, | 338 | struct hda_codec *codec, |
266 | unsigned int stream_tag, | 339 | unsigned int stream_tag, |
267 | unsigned int format, | 340 | unsigned int format, |
268 | struct snd_pcm_substream *substream) | 341 | struct snd_pcm_substream *substream) |
269 | { | 342 | { |
270 | struct nvhdmi_spec *spec = codec->spec; | 343 | struct hdmi_spec *spec = codec->spec; |
271 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, stream_tag, | 344 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, stream_tag, |
272 | format, substream); | 345 | format, substream); |
273 | } | 346 | } |
274 | 347 | ||
275 | static struct hda_pcm_stream nvhdmi_pcm_digital_playback_8ch = { | 348 | static struct hda_pcm_stream nvhdmi_pcm_digital_playback_8ch_89 = { |
349 | .substreams = 1, | ||
350 | .channels_min = 2, | ||
351 | .rates = SUPPORTED_RATES, | ||
352 | .maxbps = SUPPORTED_MAXBPS, | ||
353 | .formats = SUPPORTED_FORMATS, | ||
354 | .ops = { | ||
355 | .prepare = nvhdmi_dig_playback_pcm_prepare_8ch_89, | ||
356 | .cleanup = nvhdmi_playback_pcm_cleanup, | ||
357 | }, | ||
358 | }; | ||
359 | |||
360 | static struct hda_pcm_stream nvhdmi_pcm_digital_playback_8ch_7x = { | ||
276 | .substreams = 1, | 361 | .substreams = 1, |
277 | .channels_min = 2, | 362 | .channels_min = 2, |
278 | .channels_max = 8, | 363 | .channels_max = 8, |
279 | .nid = Nv_Master_Convert_nid, | 364 | .nid = nvhdmi_master_con_nid_7x, |
280 | .rates = SUPPORTED_RATES, | 365 | .rates = SUPPORTED_RATES, |
281 | .maxbps = SUPPORTED_MAXBPS, | 366 | .maxbps = SUPPORTED_MAXBPS, |
282 | .formats = SUPPORTED_FORMATS, | 367 | .formats = SUPPORTED_FORMATS, |
283 | .ops = { | 368 | .ops = { |
284 | .open = nvhdmi_dig_playback_pcm_open, | 369 | .open = nvhdmi_dig_playback_pcm_open, |
285 | .close = nvhdmi_dig_playback_pcm_close_8ch, | 370 | .close = nvhdmi_dig_playback_pcm_close_8ch_7x, |
286 | .prepare = nvhdmi_dig_playback_pcm_prepare_8ch | 371 | .prepare = nvhdmi_dig_playback_pcm_prepare_8ch |
287 | }, | 372 | }, |
288 | }; | 373 | }; |
@@ -291,7 +376,7 @@ static struct hda_pcm_stream nvhdmi_pcm_digital_playback_2ch = { | |||
291 | .substreams = 1, | 376 | .substreams = 1, |
292 | .channels_min = 2, | 377 | .channels_min = 2, |
293 | .channels_max = 2, | 378 | .channels_max = 2, |
294 | .nid = Nv_Master_Convert_nid, | 379 | .nid = nvhdmi_master_con_nid_7x, |
295 | .rates = SUPPORTED_RATES, | 380 | .rates = SUPPORTED_RATES, |
296 | .maxbps = SUPPORTED_MAXBPS, | 381 | .maxbps = SUPPORTED_MAXBPS, |
297 | .formats = SUPPORTED_FORMATS, | 382 | .formats = SUPPORTED_FORMATS, |
@@ -302,10 +387,36 @@ static struct hda_pcm_stream nvhdmi_pcm_digital_playback_2ch = { | |||
302 | }, | 387 | }, |
303 | }; | 388 | }; |
304 | 389 | ||
305 | static int nvhdmi_build_pcms_8ch(struct hda_codec *codec) | 390 | static int nvhdmi_build_pcms_8ch_89(struct hda_codec *codec) |
391 | { | ||
392 | struct hdmi_spec *spec = codec->spec; | ||
393 | struct hda_pcm *info = spec->pcm_rec; | ||
394 | int i; | ||
395 | |||
396 | codec->num_pcms = spec->num_cvts; | ||
397 | codec->pcm_info = info; | ||
398 | |||
399 | for (i = 0; i < codec->num_pcms; i++, info++) { | ||
400 | unsigned int chans; | ||
401 | |||
402 | chans = get_wcaps(codec, spec->cvt[i]); | ||
403 | chans = get_wcaps_channels(chans); | ||
404 | |||
405 | info->name = nvhdmi_pcm_names[i]; | ||
406 | info->pcm_type = HDA_PCM_TYPE_HDMI; | ||
407 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] | ||
408 | = nvhdmi_pcm_digital_playback_8ch_89; | ||
409 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->cvt[i]; | ||
410 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = chans; | ||
411 | } | ||
412 | |||
413 | return 0; | ||
414 | } | ||
415 | |||
416 | static int nvhdmi_build_pcms_8ch_7x(struct hda_codec *codec) | ||
306 | { | 417 | { |
307 | struct nvhdmi_spec *spec = codec->spec; | 418 | struct hdmi_spec *spec = codec->spec; |
308 | struct hda_pcm *info = &spec->pcm_rec; | 419 | struct hda_pcm *info = spec->pcm_rec; |
309 | 420 | ||
310 | codec->num_pcms = 1; | 421 | codec->num_pcms = 1; |
311 | codec->pcm_info = info; | 422 | codec->pcm_info = info; |
@@ -313,15 +424,15 @@ static int nvhdmi_build_pcms_8ch(struct hda_codec *codec) | |||
313 | info->name = "NVIDIA HDMI"; | 424 | info->name = "NVIDIA HDMI"; |
314 | info->pcm_type = HDA_PCM_TYPE_HDMI; | 425 | info->pcm_type = HDA_PCM_TYPE_HDMI; |
315 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] | 426 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] |
316 | = nvhdmi_pcm_digital_playback_8ch; | 427 | = nvhdmi_pcm_digital_playback_8ch_7x; |
317 | 428 | ||
318 | return 0; | 429 | return 0; |
319 | } | 430 | } |
320 | 431 | ||
321 | static int nvhdmi_build_pcms_2ch(struct hda_codec *codec) | 432 | static int nvhdmi_build_pcms_2ch(struct hda_codec *codec) |
322 | { | 433 | { |
323 | struct nvhdmi_spec *spec = codec->spec; | 434 | struct hdmi_spec *spec = codec->spec; |
324 | struct hda_pcm *info = &spec->pcm_rec; | 435 | struct hda_pcm *info = spec->pcm_rec; |
325 | 436 | ||
326 | codec->num_pcms = 1; | 437 | codec->num_pcms = 1; |
327 | codec->pcm_info = info; | 438 | codec->pcm_info = info; |
@@ -334,14 +445,17 @@ static int nvhdmi_build_pcms_2ch(struct hda_codec *codec) | |||
334 | return 0; | 445 | return 0; |
335 | } | 446 | } |
336 | 447 | ||
337 | static void nvhdmi_free(struct hda_codec *codec) | 448 | static struct hda_codec_ops nvhdmi_patch_ops_8ch_89 = { |
338 | { | 449 | .build_controls = nvhdmi_build_controls, |
339 | kfree(codec->spec); | 450 | .build_pcms = nvhdmi_build_pcms_8ch_89, |
340 | } | 451 | .init = nvhdmi_init, |
452 | .free = nvhdmi_free, | ||
453 | .unsol_event = hdmi_unsol_event, | ||
454 | }; | ||
341 | 455 | ||
342 | static struct hda_codec_ops nvhdmi_patch_ops_8ch = { | 456 | static struct hda_codec_ops nvhdmi_patch_ops_8ch_7x = { |
343 | .build_controls = nvhdmi_build_controls, | 457 | .build_controls = nvhdmi_build_controls, |
344 | .build_pcms = nvhdmi_build_pcms_8ch, | 458 | .build_pcms = nvhdmi_build_pcms_8ch_7x, |
345 | .init = nvhdmi_init, | 459 | .init = nvhdmi_init, |
346 | .free = nvhdmi_free, | 460 | .free = nvhdmi_free, |
347 | }; | 461 | }; |
@@ -353,9 +467,36 @@ static struct hda_codec_ops nvhdmi_patch_ops_2ch = { | |||
353 | .free = nvhdmi_free, | 467 | .free = nvhdmi_free, |
354 | }; | 468 | }; |
355 | 469 | ||
356 | static int patch_nvhdmi_8ch(struct hda_codec *codec) | 470 | static int patch_nvhdmi_8ch_89(struct hda_codec *codec) |
471 | { | ||
472 | struct hdmi_spec *spec; | ||
473 | int i; | ||
474 | |||
475 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
476 | if (spec == NULL) | ||
477 | return -ENOMEM; | ||
478 | |||
479 | codec->spec = spec; | ||
480 | spec->codec_type = HDA_CODEC_NVIDIA_MCP89; | ||
481 | |||
482 | if (hdmi_parse_codec(codec) < 0) { | ||
483 | codec->spec = NULL; | ||
484 | kfree(spec); | ||
485 | return -EINVAL; | ||
486 | } | ||
487 | codec->patch_ops = nvhdmi_patch_ops_8ch_89; | ||
488 | |||
489 | for (i = 0; i < spec->num_pins; i++) | ||
490 | snd_hda_eld_proc_new(codec, &spec->sink_eld[i], i); | ||
491 | |||
492 | init_channel_allocations(); | ||
493 | |||
494 | return 0; | ||
495 | } | ||
496 | |||
497 | static int patch_nvhdmi_8ch_7x(struct hda_codec *codec) | ||
357 | { | 498 | { |
358 | struct nvhdmi_spec *spec; | 499 | struct hdmi_spec *spec; |
359 | 500 | ||
360 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 501 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
361 | if (spec == NULL) | 502 | if (spec == NULL) |
@@ -365,16 +506,17 @@ static int patch_nvhdmi_8ch(struct hda_codec *codec) | |||
365 | 506 | ||
366 | spec->multiout.num_dacs = 0; /* no analog */ | 507 | spec->multiout.num_dacs = 0; /* no analog */ |
367 | spec->multiout.max_channels = 8; | 508 | spec->multiout.max_channels = 8; |
368 | spec->multiout.dig_out_nid = Nv_Master_Convert_nid; | 509 | spec->multiout.dig_out_nid = nvhdmi_master_con_nid_7x; |
510 | spec->codec_type = HDA_CODEC_NVIDIA_MCP7X; | ||
369 | 511 | ||
370 | codec->patch_ops = nvhdmi_patch_ops_8ch; | 512 | codec->patch_ops = nvhdmi_patch_ops_8ch_7x; |
371 | 513 | ||
372 | return 0; | 514 | return 0; |
373 | } | 515 | } |
374 | 516 | ||
375 | static int patch_nvhdmi_2ch(struct hda_codec *codec) | 517 | static int patch_nvhdmi_2ch(struct hda_codec *codec) |
376 | { | 518 | { |
377 | struct nvhdmi_spec *spec; | 519 | struct hdmi_spec *spec; |
378 | 520 | ||
379 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 521 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
380 | if (spec == NULL) | 522 | if (spec == NULL) |
@@ -384,7 +526,8 @@ static int patch_nvhdmi_2ch(struct hda_codec *codec) | |||
384 | 526 | ||
385 | spec->multiout.num_dacs = 0; /* no analog */ | 527 | spec->multiout.num_dacs = 0; /* no analog */ |
386 | spec->multiout.max_channels = 2; | 528 | spec->multiout.max_channels = 2; |
387 | spec->multiout.dig_out_nid = Nv_Master_Convert_nid; | 529 | spec->multiout.dig_out_nid = nvhdmi_master_con_nid_7x; |
530 | spec->codec_type = HDA_CODEC_NVIDIA_MCP7X; | ||
388 | 531 | ||
389 | codec->patch_ops = nvhdmi_patch_ops_2ch; | 532 | codec->patch_ops = nvhdmi_patch_ops_2ch; |
390 | 533 | ||
@@ -395,13 +538,24 @@ static int patch_nvhdmi_2ch(struct hda_codec *codec) | |||
395 | * patch entries | 538 | * patch entries |
396 | */ | 539 | */ |
397 | static struct hda_codec_preset snd_hda_preset_nvhdmi[] = { | 540 | static struct hda_codec_preset snd_hda_preset_nvhdmi[] = { |
398 | { .id = 0x10de0002, .name = "MCP78 HDMI", .patch = patch_nvhdmi_8ch }, | ||
399 | { .id = 0x10de0003, .name = "MCP78 HDMI", .patch = patch_nvhdmi_8ch }, | ||
400 | { .id = 0x10de0005, .name = "MCP78 HDMI", .patch = patch_nvhdmi_8ch }, | ||
401 | { .id = 0x10de0006, .name = "MCP78 HDMI", .patch = patch_nvhdmi_8ch }, | ||
402 | { .id = 0x10de0007, .name = "MCP7A HDMI", .patch = patch_nvhdmi_8ch }, | ||
403 | { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi_2ch }, | 541 | { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi_2ch }, |
404 | { .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi_2ch }, | 542 | { .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi_2ch }, |
543 | { .id = 0x10de0002, .name = "MCP77/78 HDMI", | ||
544 | .patch = patch_nvhdmi_8ch_7x }, | ||
545 | { .id = 0x10de0003, .name = "MCP77/78 HDMI", | ||
546 | .patch = patch_nvhdmi_8ch_7x }, | ||
547 | { .id = 0x10de0005, .name = "MCP77/78 HDMI", | ||
548 | .patch = patch_nvhdmi_8ch_7x }, | ||
549 | { .id = 0x10de0006, .name = "MCP77/78 HDMI", | ||
550 | .patch = patch_nvhdmi_8ch_7x }, | ||
551 | { .id = 0x10de0007, .name = "MCP79/7A HDMI", | ||
552 | .patch = patch_nvhdmi_8ch_7x }, | ||
553 | { .id = 0x10de000c, .name = "MCP89 HDMI", | ||
554 | .patch = patch_nvhdmi_8ch_89 }, | ||
555 | { .id = 0x10de000b, .name = "GT21x HDMI", | ||
556 | .patch = patch_nvhdmi_8ch_89 }, | ||
557 | { .id = 0x10de000d, .name = "GT240 HDMI", | ||
558 | .patch = patch_nvhdmi_8ch_89 }, | ||
405 | {} /* terminator */ | 559 | {} /* terminator */ |
406 | }; | 560 | }; |
407 | 561 | ||
@@ -412,9 +566,12 @@ MODULE_ALIAS("snd-hda-codec-id:10de0006"); | |||
412 | MODULE_ALIAS("snd-hda-codec-id:10de0007"); | 566 | MODULE_ALIAS("snd-hda-codec-id:10de0007"); |
413 | MODULE_ALIAS("snd-hda-codec-id:10de0067"); | 567 | MODULE_ALIAS("snd-hda-codec-id:10de0067"); |
414 | MODULE_ALIAS("snd-hda-codec-id:10de8001"); | 568 | MODULE_ALIAS("snd-hda-codec-id:10de8001"); |
569 | MODULE_ALIAS("snd-hda-codec-id:10de000c"); | ||
570 | MODULE_ALIAS("snd-hda-codec-id:10de000b"); | ||
571 | MODULE_ALIAS("snd-hda-codec-id:10de000d"); | ||
415 | 572 | ||
416 | MODULE_LICENSE("GPL"); | 573 | MODULE_LICENSE("GPL"); |
417 | MODULE_DESCRIPTION("Nvidia HDMI HD-audio codec"); | 574 | MODULE_DESCRIPTION("NVIDIA HDMI HD-audio codec"); |
418 | 575 | ||
419 | static struct hda_codec_preset_list nvhdmi_list = { | 576 | static struct hda_codec_preset_list nvhdmi_list = { |
420 | .preset = snd_hda_preset_nvhdmi, | 577 | .preset = snd_hda_preset_nvhdmi, |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index e8cbe216e912..5d2fbb87b871 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -4915,7 +4915,7 @@ static void fixup_automic_adc(struct hda_codec *codec) | |||
4915 | static void fixup_single_adc(struct hda_codec *codec) | 4915 | static void fixup_single_adc(struct hda_codec *codec) |
4916 | { | 4916 | { |
4917 | struct alc_spec *spec = codec->spec; | 4917 | struct alc_spec *spec = codec->spec; |
4918 | hda_nid_t pin; | 4918 | hda_nid_t pin = 0; |
4919 | int i; | 4919 | int i; |
4920 | 4920 | ||
4921 | /* search for the input pin; there must be only one */ | 4921 | /* search for the input pin; there must be only one */ |
@@ -13561,6 +13561,8 @@ static void alc269_lifebook_unsol_event(struct hda_codec *codec, | |||
13561 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) | 13561 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
13562 | { | 13562 | { |
13563 | struct alc_spec *spec = codec->spec; | 13563 | struct alc_spec *spec = codec->spec; |
13564 | spec->autocfg.hp_pins[0] = 0x15; | ||
13565 | spec->autocfg.speaker_pins[0] = 0x14; | ||
13564 | spec->ext_mic.pin = 0x18; | 13566 | spec->ext_mic.pin = 0x18; |
13565 | spec->ext_mic.mux_idx = 0; | 13567 | spec->ext_mic.mux_idx = 0; |
13566 | spec->int_mic.pin = 0x19; | 13568 | spec->int_mic.pin = 0x19; |
@@ -13656,6 +13658,8 @@ static void alc269_laptop_unsol_event(struct hda_codec *codec, | |||
13656 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) | 13658 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
13657 | { | 13659 | { |
13658 | struct alc_spec *spec = codec->spec; | 13660 | struct alc_spec *spec = codec->spec; |
13661 | spec->autocfg.hp_pins[0] = 0x15; | ||
13662 | spec->autocfg.speaker_pins[0] = 0x14; | ||
13659 | spec->ext_mic.pin = 0x18; | 13663 | spec->ext_mic.pin = 0x18; |
13660 | spec->ext_mic.mux_idx = 0; | 13664 | spec->ext_mic.mux_idx = 0; |
13661 | spec->int_mic.pin = 0x12; | 13665 | spec->int_mic.pin = 0x12; |
@@ -13666,6 +13670,8 @@ static void alc269_laptop_dmic_setup(struct hda_codec *codec) | |||
13666 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) | 13670 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
13667 | { | 13671 | { |
13668 | struct alc_spec *spec = codec->spec; | 13672 | struct alc_spec *spec = codec->spec; |
13673 | spec->autocfg.hp_pins[0] = 0x15; | ||
13674 | spec->autocfg.speaker_pins[0] = 0x14; | ||
13669 | spec->ext_mic.pin = 0x18; | 13675 | spec->ext_mic.pin = 0x18; |
13670 | spec->ext_mic.mux_idx = 0; | 13676 | spec->ext_mic.mux_idx = 0; |
13671 | spec->int_mic.pin = 0x12; | 13677 | spec->int_mic.pin = 0x12; |
@@ -13676,6 +13682,8 @@ static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) | |||
13676 | static void alc269_laptop_amic_setup(struct hda_codec *codec) | 13682 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
13677 | { | 13683 | { |
13678 | struct alc_spec *spec = codec->spec; | 13684 | struct alc_spec *spec = codec->spec; |
13685 | spec->autocfg.hp_pins[0] = 0x15; | ||
13686 | spec->autocfg.speaker_pins[0] = 0x14; | ||
13679 | spec->ext_mic.pin = 0x18; | 13687 | spec->ext_mic.pin = 0x18; |
13680 | spec->ext_mic.mux_idx = 0; | 13688 | spec->ext_mic.mux_idx = 0; |
13681 | spec->int_mic.pin = 0x19; | 13689 | spec->int_mic.pin = 0x19; |
diff --git a/sound/pci/oxygen/xonar_wm87x6.c b/sound/pci/oxygen/xonar_wm87x6.c index 7754db166d9e..dbc4b89d74e4 100644 --- a/sound/pci/oxygen/xonar_wm87x6.c +++ b/sound/pci/oxygen/xonar_wm87x6.c | |||
@@ -68,7 +68,7 @@ static void wm8776_write(struct oxygen *chip, | |||
68 | OXYGEN_SPI_CEN_LATCH_CLOCK_LO, | 68 | OXYGEN_SPI_CEN_LATCH_CLOCK_LO, |
69 | (reg << 9) | value); | 69 | (reg << 9) | value); |
70 | if (reg < ARRAY_SIZE(data->wm8776_regs)) { | 70 | if (reg < ARRAY_SIZE(data->wm8776_regs)) { |
71 | if (reg >= WM8776_HPLVOL || reg <= WM8776_DACMASTER) | 71 | if (reg >= WM8776_HPLVOL && reg <= WM8776_DACMASTER) |
72 | value &= ~WM8776_UPDATE; | 72 | value &= ~WM8776_UPDATE; |
73 | data->wm8776_regs[reg] = value; | 73 | data->wm8776_regs[reg] = value; |
74 | } | 74 | } |
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index 960a227eb653..ad4462677615 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c | |||
@@ -1974,9 +1974,9 @@ snd_riptide_proc_read(struct snd_info_entry *entry, | |||
1974 | } | 1974 | } |
1975 | snd_iprintf(buffer, "Paths:\n"); | 1975 | snd_iprintf(buffer, "Paths:\n"); |
1976 | i = getpaths(cif, p); | 1976 | i = getpaths(cif, p); |
1977 | while (i--) { | 1977 | while (i >= 2) { |
1978 | snd_iprintf(buffer, "%x->%x ", p[i - 1], p[i]); | 1978 | i -= 2; |
1979 | i--; | 1979 | snd_iprintf(buffer, "%x->%x ", p[i], p[i + 1]); |
1980 | } | 1980 | } |
1981 | snd_iprintf(buffer, "\n"); | 1981 | snd_iprintf(buffer, "\n"); |
1982 | } | 1982 | } |
diff --git a/sound/soc/codecs/ak4104.c b/sound/soc/codecs/ak4104.c index b9ef7e45891d..b68d99fb6af0 100644 --- a/sound/soc/codecs/ak4104.c +++ b/sound/soc/codecs/ak4104.c | |||
@@ -90,12 +90,10 @@ static int ak4104_spi_write(struct snd_soc_codec *codec, unsigned int reg, | |||
90 | if (reg >= codec->reg_cache_size) | 90 | if (reg >= codec->reg_cache_size) |
91 | return -EINVAL; | 91 | return -EINVAL; |
92 | 92 | ||
93 | reg &= AK4104_REG_MASK; | ||
94 | reg |= AK4104_WRITE; | ||
95 | |||
96 | /* only write to the hardware if value has changed */ | 93 | /* only write to the hardware if value has changed */ |
97 | if (cache[reg] != value) { | 94 | if (cache[reg] != value) { |
98 | u8 tmp[2] = { reg, value }; | 95 | u8 tmp[2] = { (reg & AK4104_REG_MASK) | AK4104_WRITE, value }; |
96 | |||
99 | if (spi_write(spi, tmp, sizeof(tmp))) { | 97 | if (spi_write(spi, tmp, sizeof(tmp))) { |
100 | dev_err(&spi->dev, "SPI write failed\n"); | 98 | dev_err(&spi->dev, "SPI write failed\n"); |
101 | return -EIO; | 99 | return -EIO; |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index a03bac943aaf..c8b0556ef431 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -427,24 +427,24 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) | |||
427 | if (!runtime->hw.rates) { | 427 | if (!runtime->hw.rates) { |
428 | printk(KERN_ERR "asoc: %s <-> %s No matching rates\n", | 428 | printk(KERN_ERR "asoc: %s <-> %s No matching rates\n", |
429 | codec_dai->name, cpu_dai->name); | 429 | codec_dai->name, cpu_dai->name); |
430 | goto machine_err; | 430 | goto config_err; |
431 | } | 431 | } |
432 | if (!runtime->hw.formats) { | 432 | if (!runtime->hw.formats) { |
433 | printk(KERN_ERR "asoc: %s <-> %s No matching formats\n", | 433 | printk(KERN_ERR "asoc: %s <-> %s No matching formats\n", |
434 | codec_dai->name, cpu_dai->name); | 434 | codec_dai->name, cpu_dai->name); |
435 | goto machine_err; | 435 | goto config_err; |
436 | } | 436 | } |
437 | if (!runtime->hw.channels_min || !runtime->hw.channels_max) { | 437 | if (!runtime->hw.channels_min || !runtime->hw.channels_max) { |
438 | printk(KERN_ERR "asoc: %s <-> %s No matching channels\n", | 438 | printk(KERN_ERR "asoc: %s <-> %s No matching channels\n", |
439 | codec_dai->name, cpu_dai->name); | 439 | codec_dai->name, cpu_dai->name); |
440 | goto machine_err; | 440 | goto config_err; |
441 | } | 441 | } |
442 | 442 | ||
443 | /* Symmetry only applies if we've already got an active stream. */ | 443 | /* Symmetry only applies if we've already got an active stream. */ |
444 | if (cpu_dai->active || codec_dai->active) { | 444 | if (cpu_dai->active || codec_dai->active) { |
445 | ret = soc_pcm_apply_symmetry(substream); | 445 | ret = soc_pcm_apply_symmetry(substream); |
446 | if (ret != 0) | 446 | if (ret != 0) |
447 | goto machine_err; | 447 | goto config_err; |
448 | } | 448 | } |
449 | 449 | ||
450 | pr_debug("asoc: %s <-> %s info:\n", codec_dai->name, cpu_dai->name); | 450 | pr_debug("asoc: %s <-> %s info:\n", codec_dai->name, cpu_dai->name); |
@@ -464,10 +464,14 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) | |||
464 | mutex_unlock(&pcm_mutex); | 464 | mutex_unlock(&pcm_mutex); |
465 | return 0; | 465 | return 0; |
466 | 466 | ||
467 | machine_err: | 467 | config_err: |
468 | if (machine->ops && machine->ops->shutdown) | 468 | if (machine->ops && machine->ops->shutdown) |
469 | machine->ops->shutdown(substream); | 469 | machine->ops->shutdown(substream); |
470 | 470 | ||
471 | machine_err: | ||
472 | if (codec_dai->ops->shutdown) | ||
473 | codec_dai->ops->shutdown(substream, codec_dai); | ||
474 | |||
471 | codec_dai_err: | 475 | codec_dai_err: |
472 | if (platform->pcm_ops->close) | 476 | if (platform->pcm_ops->close) |
473 | platform->pcm_ops->close(substream); | 477 | platform->pcm_ops->close(substream); |
diff --git a/sound/usb/Kconfig b/sound/usb/Kconfig index 8c2925814ce4..c570ae3e6d55 100644 --- a/sound/usb/Kconfig +++ b/sound/usb/Kconfig | |||
@@ -22,13 +22,13 @@ config SND_USB_AUDIO | |||
22 | will be called snd-usb-audio. | 22 | will be called snd-usb-audio. |
23 | 23 | ||
24 | config SND_USB_UA101 | 24 | config SND_USB_UA101 |
25 | tristate "Edirol UA-101 driver (EXPERIMENTAL)" | 25 | tristate "Edirol UA-101/UA-1000 driver (EXPERIMENTAL)" |
26 | depends on EXPERIMENTAL | 26 | depends on EXPERIMENTAL |
27 | select SND_PCM | 27 | select SND_PCM |
28 | select SND_RAWMIDI | 28 | select SND_RAWMIDI |
29 | help | 29 | help |
30 | Say Y here to include support for the Edirol UA-101 audio/MIDI | 30 | Say Y here to include support for the Edirol UA-101 and UA-1000 |
31 | interface. | 31 | audio/MIDI interfaces. |
32 | 32 | ||
33 | To compile this driver as a module, choose M here: the module | 33 | To compile this driver as a module, choose M here: the module |
34 | will be called snd-ua101. | 34 | will be called snd-ua101. |
diff --git a/sound/usb/caiaq/midi.h b/sound/usb/caiaq/midi.h index 9d16db027fc3..380f984babc9 100644 --- a/sound/usb/caiaq/midi.h +++ b/sound/usb/caiaq/midi.h | |||
@@ -3,6 +3,6 @@ | |||
3 | 3 | ||
4 | int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *dev); | 4 | int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *dev); |
5 | void snd_usb_caiaq_midi_handle_input(struct snd_usb_caiaqdev *dev, int port, const char *buf, int len); | 5 | void snd_usb_caiaq_midi_handle_input(struct snd_usb_caiaqdev *dev, int port, const char *buf, int len); |
6 | void snd_usb_caiaq_midi_output_done(struct urb* urb); | 6 | void snd_usb_caiaq_midi_output_done(struct urb *urb); |
7 | 7 | ||
8 | #endif /* CAIAQ_MIDI_H */ | 8 | #endif /* CAIAQ_MIDI_H */ |
diff --git a/sound/usb/ua101.c b/sound/usb/ua101.c index 4f4ccdf70dd0..3d458d3b9962 100644 --- a/sound/usb/ua101.c +++ b/sound/usb/ua101.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Edirol UA-101 driver | 2 | * Edirol UA-101/UA-1000 driver |
3 | * Copyright (c) Clemens Ladisch <clemens@ladisch.de> | 3 | * Copyright (c) Clemens Ladisch <clemens@ladisch.de> |
4 | * | 4 | * |
5 | * This driver is free software: you can redistribute it and/or modify | 5 | * This driver is free software: you can redistribute it and/or modify |
@@ -25,13 +25,10 @@ | |||
25 | #include <sound/pcm_params.h> | 25 | #include <sound/pcm_params.h> |
26 | #include "usbaudio.h" | 26 | #include "usbaudio.h" |
27 | 27 | ||
28 | MODULE_DESCRIPTION("Edirol UA-101 driver"); | 28 | MODULE_DESCRIPTION("Edirol UA-101/1000 driver"); |
29 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); | 29 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); |
30 | MODULE_LICENSE("GPL v2"); | 30 | MODULE_LICENSE("GPL v2"); |
31 | MODULE_SUPPORTED_DEVICE("{{Edirol,UA-101}}"); | 31 | MODULE_SUPPORTED_DEVICE("{{Edirol,UA-101},{Edirol,UA-1000}}"); |
32 | |||
33 | /* I use my UA-1A for testing because I don't have a UA-101 ... */ | ||
34 | #define UA1A_HACK | ||
35 | 32 | ||
36 | /* | 33 | /* |
37 | * Should not be lower than the minimum scheduling delay of the host | 34 | * Should not be lower than the minimum scheduling delay of the host |
@@ -132,9 +129,6 @@ struct ua101 { | |||
132 | dma_addr_t dma; | 129 | dma_addr_t dma; |
133 | } buffers[MAX_MEMORY_BUFFERS]; | 130 | } buffers[MAX_MEMORY_BUFFERS]; |
134 | } capture, playback; | 131 | } capture, playback; |
135 | |||
136 | unsigned int fps[10]; | ||
137 | unsigned int frame_counter; | ||
138 | }; | 132 | }; |
139 | 133 | ||
140 | static DEFINE_MUTEX(devices_mutex); | 134 | static DEFINE_MUTEX(devices_mutex); |
@@ -424,16 +418,6 @@ static void capture_urb_complete(struct urb *urb) | |||
424 | if (do_period_elapsed) | 418 | if (do_period_elapsed) |
425 | snd_pcm_period_elapsed(stream->substream); | 419 | snd_pcm_period_elapsed(stream->substream); |
426 | 420 | ||
427 | /* for debugging: measure the sample rate relative to the USB clock */ | ||
428 | ua->fps[ua->frame_counter++ / ua->packets_per_second] += frames; | ||
429 | if (ua->frame_counter >= ARRAY_SIZE(ua->fps) * ua->packets_per_second) { | ||
430 | printk(KERN_DEBUG "capture rate:"); | ||
431 | for (frames = 0; frames < ARRAY_SIZE(ua->fps); ++frames) | ||
432 | printk(KERN_CONT " %u", ua->fps[frames]); | ||
433 | printk(KERN_CONT "\n"); | ||
434 | memset(ua->fps, 0, sizeof(ua->fps)); | ||
435 | ua->frame_counter = 0; | ||
436 | } | ||
437 | return; | 421 | return; |
438 | 422 | ||
439 | stream_stopped: | 423 | stream_stopped: |
@@ -1200,13 +1184,30 @@ static int ua101_probe(struct usb_interface *interface, | |||
1200 | .type = QUIRK_MIDI_FIXED_ENDPOINT, | 1184 | .type = QUIRK_MIDI_FIXED_ENDPOINT, |
1201 | .data = &midi_ep | 1185 | .data = &midi_ep |
1202 | }; | 1186 | }; |
1187 | static const int intf_numbers[2][3] = { | ||
1188 | { /* UA-101 */ | ||
1189 | [INTF_PLAYBACK] = 0, | ||
1190 | [INTF_CAPTURE] = 1, | ||
1191 | [INTF_MIDI] = 2, | ||
1192 | }, | ||
1193 | { /* UA-1000 */ | ||
1194 | [INTF_CAPTURE] = 1, | ||
1195 | [INTF_PLAYBACK] = 2, | ||
1196 | [INTF_MIDI] = 3, | ||
1197 | }, | ||
1198 | }; | ||
1203 | struct snd_card *card; | 1199 | struct snd_card *card; |
1204 | struct ua101 *ua; | 1200 | struct ua101 *ua; |
1205 | unsigned int card_index, i; | 1201 | unsigned int card_index, i; |
1202 | int is_ua1000; | ||
1203 | const char *name; | ||
1206 | char usb_path[32]; | 1204 | char usb_path[32]; |
1207 | int err; | 1205 | int err; |
1208 | 1206 | ||
1209 | if (interface->altsetting->desc.bInterfaceNumber != 0) | 1207 | is_ua1000 = usb_id->idProduct == 0x0044; |
1208 | |||
1209 | if (interface->altsetting->desc.bInterfaceNumber != | ||
1210 | intf_numbers[is_ua1000][0]) | ||
1210 | return -ENODEV; | 1211 | return -ENODEV; |
1211 | 1212 | ||
1212 | mutex_lock(&devices_mutex); | 1213 | mutex_lock(&devices_mutex); |
@@ -1239,20 +1240,13 @@ static int ua101_probe(struct usb_interface *interface, | |||
1239 | init_waitqueue_head(&ua->rate_feedback_wait); | 1240 | init_waitqueue_head(&ua->rate_feedback_wait); |
1240 | init_waitqueue_head(&ua->alsa_playback_wait); | 1241 | init_waitqueue_head(&ua->alsa_playback_wait); |
1241 | 1242 | ||
1242 | #ifdef UA1A_HACK | ||
1243 | if (ua->dev->descriptor.idProduct == cpu_to_le16(0x0018)) { | ||
1244 | ua->intf[2] = interface; | ||
1245 | ua->intf[0] = usb_ifnum_to_if(ua->dev, 1); | ||
1246 | ua->intf[1] = usb_ifnum_to_if(ua->dev, 2); | ||
1247 | usb_driver_claim_interface(&ua101_driver, ua->intf[0], ua); | ||
1248 | usb_driver_claim_interface(&ua101_driver, ua->intf[1], ua); | ||
1249 | } else { | ||
1250 | #endif | ||
1251 | ua->intf[0] = interface; | 1243 | ua->intf[0] = interface; |
1252 | for (i = 1; i < ARRAY_SIZE(ua->intf); ++i) { | 1244 | for (i = 1; i < ARRAY_SIZE(ua->intf); ++i) { |
1253 | ua->intf[i] = usb_ifnum_to_if(ua->dev, i); | 1245 | ua->intf[i] = usb_ifnum_to_if(ua->dev, |
1246 | intf_numbers[is_ua1000][i]); | ||
1254 | if (!ua->intf[i]) { | 1247 | if (!ua->intf[i]) { |
1255 | dev_err(&ua->dev->dev, "interface %u not found\n", i); | 1248 | dev_err(&ua->dev->dev, "interface %u not found\n", |
1249 | intf_numbers[is_ua1000][i]); | ||
1256 | err = -ENXIO; | 1250 | err = -ENXIO; |
1257 | goto probe_error; | 1251 | goto probe_error; |
1258 | } | 1252 | } |
@@ -1264,39 +1258,19 @@ static int ua101_probe(struct usb_interface *interface, | |||
1264 | goto probe_error; | 1258 | goto probe_error; |
1265 | } | 1259 | } |
1266 | } | 1260 | } |
1267 | #ifdef UA1A_HACK | ||
1268 | } | ||
1269 | #endif | ||
1270 | 1261 | ||
1271 | snd_card_set_dev(card, &interface->dev); | 1262 | snd_card_set_dev(card, &interface->dev); |
1272 | 1263 | ||
1273 | #ifdef UA1A_HACK | ||
1274 | if (ua->dev->descriptor.idProduct == cpu_to_le16(0x0018)) { | ||
1275 | ua->format_bit = SNDRV_PCM_FMTBIT_S16_LE; | ||
1276 | ua->rate = 44100; | ||
1277 | ua->packets_per_second = 1000; | ||
1278 | ua->capture.channels = 2; | ||
1279 | ua->playback.channels = 2; | ||
1280 | ua->capture.frame_bytes = 4; | ||
1281 | ua->playback.frame_bytes = 4; | ||
1282 | ua->capture.usb_pipe = usb_rcvisocpipe(ua->dev, 2); | ||
1283 | ua->playback.usb_pipe = usb_sndisocpipe(ua->dev, 1); | ||
1284 | ua->capture.max_packet_bytes = 192; | ||
1285 | ua->playback.max_packet_bytes = 192; | ||
1286 | } else { | ||
1287 | #endif | ||
1288 | err = detect_usb_format(ua); | 1264 | err = detect_usb_format(ua); |
1289 | if (err < 0) | 1265 | if (err < 0) |
1290 | goto probe_error; | 1266 | goto probe_error; |
1291 | #ifdef UA1A_HACK | ||
1292 | } | ||
1293 | #endif | ||
1294 | 1267 | ||
1268 | name = usb_id->idProduct == 0x0044 ? "UA-1000" : "UA-101"; | ||
1295 | strcpy(card->driver, "UA-101"); | 1269 | strcpy(card->driver, "UA-101"); |
1296 | strcpy(card->shortname, "UA-101"); | 1270 | strcpy(card->shortname, name); |
1297 | usb_make_path(ua->dev, usb_path, sizeof(usb_path)); | 1271 | usb_make_path(ua->dev, usb_path, sizeof(usb_path)); |
1298 | snprintf(ua->card->longname, sizeof(ua->card->longname), | 1272 | snprintf(ua->card->longname, sizeof(ua->card->longname), |
1299 | "EDIROL UA-101 (serial %s), %u Hz at %s, %s speed", | 1273 | "EDIROL %s (serial %s), %u Hz at %s, %s speed", name, |
1300 | ua->dev->serial ? ua->dev->serial : "?", ua->rate, usb_path, | 1274 | ua->dev->serial ? ua->dev->serial : "?", ua->rate, usb_path, |
1301 | ua->dev->speed == USB_SPEED_HIGH ? "high" : "full"); | 1275 | ua->dev->speed == USB_SPEED_HIGH ? "high" : "full"); |
1302 | 1276 | ||
@@ -1314,24 +1288,18 @@ static int ua101_probe(struct usb_interface *interface, | |||
1314 | if (err < 0) | 1288 | if (err < 0) |
1315 | goto probe_error; | 1289 | goto probe_error; |
1316 | 1290 | ||
1317 | err = snd_pcm_new(card, "UA-101", 0, 1, 1, &ua->pcm); | 1291 | err = snd_pcm_new(card, name, 0, 1, 1, &ua->pcm); |
1318 | if (err < 0) | 1292 | if (err < 0) |
1319 | goto probe_error; | 1293 | goto probe_error; |
1320 | ua->pcm->private_data = ua; | 1294 | ua->pcm->private_data = ua; |
1321 | strcpy(ua->pcm->name, "UA-101"); | 1295 | strcpy(ua->pcm->name, name); |
1322 | snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_PLAYBACK, &playback_pcm_ops); | 1296 | snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_PLAYBACK, &playback_pcm_ops); |
1323 | snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_CAPTURE, &capture_pcm_ops); | 1297 | snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_CAPTURE, &capture_pcm_ops); |
1324 | 1298 | ||
1325 | #ifdef UA1A_HACK | ||
1326 | if (ua->dev->descriptor.idProduct != cpu_to_le16(0x0018)) { | ||
1327 | #endif | ||
1328 | err = snd_usbmidi_create(card, ua->intf[INTF_MIDI], | 1299 | err = snd_usbmidi_create(card, ua->intf[INTF_MIDI], |
1329 | &ua->midi_list, &midi_quirk); | 1300 | &ua->midi_list, &midi_quirk); |
1330 | if (err < 0) | 1301 | if (err < 0) |
1331 | goto probe_error; | 1302 | goto probe_error; |
1332 | #ifdef UA1A_HACK | ||
1333 | } | ||
1334 | #endif | ||
1335 | 1303 | ||
1336 | err = snd_card_register(card); | 1304 | err = snd_card_register(card); |
1337 | if (err < 0) | 1305 | if (err < 0) |
@@ -1386,11 +1354,9 @@ static void ua101_disconnect(struct usb_interface *interface) | |||
1386 | } | 1354 | } |
1387 | 1355 | ||
1388 | static struct usb_device_id ua101_ids[] = { | 1356 | static struct usb_device_id ua101_ids[] = { |
1389 | #ifdef UA1A_HACK | 1357 | { USB_DEVICE(0x0582, 0x0044) }, /* UA-1000 high speed */ |
1390 | { USB_DEVICE(0x0582, 0x0018) }, | 1358 | { USB_DEVICE(0x0582, 0x007d) }, /* UA-101 high speed */ |
1391 | #endif | 1359 | { USB_DEVICE(0x0582, 0x008d) }, /* UA-101 full speed */ |
1392 | { USB_DEVICE(0x0582, 0x007d) }, | ||
1393 | { USB_DEVICE(0x0582, 0x008d) }, | ||
1394 | { } | 1360 | { } |
1395 | }; | 1361 | }; |
1396 | MODULE_DEVICE_TABLE(usb, ua101_ids); | 1362 | MODULE_DEVICE_TABLE(usb, ua101_ids); |
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index c539f7fe292f..11b0826b8fe6 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -2483,7 +2483,6 @@ static int parse_audio_format_i_type(struct snd_usb_audio *chip, | |||
2483 | sample_width, sample_bytes); | 2483 | sample_width, sample_bytes); |
2484 | } | 2484 | } |
2485 | /* check the format byte size */ | 2485 | /* check the format byte size */ |
2486 | printk(" XXXXX SAMPLE BYTES %d\n", sample_bytes); | ||
2487 | switch (sample_bytes) { | 2486 | switch (sample_bytes) { |
2488 | case 1: | 2487 | case 1: |
2489 | pcm_format = SNDRV_PCM_FORMAT_S8; | 2488 | pcm_format = SNDRV_PCM_FORMAT_S8; |
@@ -2581,6 +2580,9 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof | |||
2581 | chip->usb_id == USB_ID(0x0d8c, 0x0102)) && | 2580 | chip->usb_id == USB_ID(0x0d8c, 0x0102)) && |
2582 | fp->altsetting == 5 && fp->maxpacksize == 392) | 2581 | fp->altsetting == 5 && fp->maxpacksize == 392) |
2583 | rate = 96000; | 2582 | rate = 96000; |
2583 | /* Creative VF0470 Live Cam reports 16 kHz instead of 8kHz */ | ||
2584 | if (rate == 16000 && chip->usb_id == USB_ID(0x041e, 0x4068)) | ||
2585 | rate = 8000; | ||
2584 | fp->rate_table[fp->nr_rates] = rate; | 2586 | fp->rate_table[fp->nr_rates] = rate; |
2585 | if (!fp->rate_min || rate < fp->rate_min) | 2587 | if (!fp->rate_min || rate < fp->rate_min) |
2586 | fp->rate_min = rate; | 2588 | fp->rate_min = rate; |
@@ -3386,58 +3388,6 @@ static int create_uaxx_quirk(struct snd_usb_audio *chip, | |||
3386 | return 0; | 3388 | return 0; |
3387 | } | 3389 | } |
3388 | 3390 | ||
3389 | /* | ||
3390 | * Create a stream for an Edirol UA-1000 interface. | ||
3391 | */ | ||
3392 | static int create_ua1000_quirk(struct snd_usb_audio *chip, | ||
3393 | struct usb_interface *iface, | ||
3394 | const struct snd_usb_audio_quirk *quirk) | ||
3395 | { | ||
3396 | static const struct audioformat ua1000_format = { | ||
3397 | .format = SNDRV_PCM_FORMAT_S32_LE, | ||
3398 | .fmt_type = UAC_FORMAT_TYPE_I, | ||
3399 | .altsetting = 1, | ||
3400 | .altset_idx = 1, | ||
3401 | .attributes = 0, | ||
3402 | .rates = SNDRV_PCM_RATE_CONTINUOUS, | ||
3403 | }; | ||
3404 | struct usb_host_interface *alts; | ||
3405 | struct usb_interface_descriptor *altsd; | ||
3406 | struct audioformat *fp; | ||
3407 | int stream, err; | ||
3408 | |||
3409 | if (iface->num_altsetting != 2) | ||
3410 | return -ENXIO; | ||
3411 | alts = &iface->altsetting[1]; | ||
3412 | altsd = get_iface_desc(alts); | ||
3413 | if (alts->extralen != 11 || alts->extra[1] != USB_DT_CS_INTERFACE || | ||
3414 | altsd->bNumEndpoints != 1) | ||
3415 | return -ENXIO; | ||
3416 | |||
3417 | fp = kmemdup(&ua1000_format, sizeof(*fp), GFP_KERNEL); | ||
3418 | if (!fp) | ||
3419 | return -ENOMEM; | ||
3420 | |||
3421 | fp->channels = alts->extra[4]; | ||
3422 | fp->iface = altsd->bInterfaceNumber; | ||
3423 | fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress; | ||
3424 | fp->ep_attr = get_endpoint(alts, 0)->bmAttributes; | ||
3425 | fp->datainterval = parse_datainterval(chip, alts); | ||
3426 | fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); | ||
3427 | fp->rate_max = fp->rate_min = combine_triple(&alts->extra[8]); | ||
3428 | |||
3429 | stream = (fp->endpoint & USB_DIR_IN) | ||
3430 | ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK; | ||
3431 | err = add_audio_endpoint(chip, stream, fp); | ||
3432 | if (err < 0) { | ||
3433 | kfree(fp); | ||
3434 | return err; | ||
3435 | } | ||
3436 | /* FIXME: playback must be synchronized to capture */ | ||
3437 | usb_set_interface(chip->dev, fp->iface, 0); | ||
3438 | return 0; | ||
3439 | } | ||
3440 | |||
3441 | static int snd_usb_create_quirk(struct snd_usb_audio *chip, | 3391 | static int snd_usb_create_quirk(struct snd_usb_audio *chip, |
3442 | struct usb_interface *iface, | 3392 | struct usb_interface *iface, |
3443 | const struct snd_usb_audio_quirk *quirk); | 3393 | const struct snd_usb_audio_quirk *quirk); |
@@ -3686,7 +3636,6 @@ static int snd_usb_create_quirk(struct snd_usb_audio *chip, | |||
3686 | [QUIRK_MIDI_CME] = create_any_midi_quirk, | 3636 | [QUIRK_MIDI_CME] = create_any_midi_quirk, |
3687 | [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, | 3637 | [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, |
3688 | [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, | 3638 | [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, |
3689 | [QUIRK_AUDIO_EDIROL_UA1000] = create_ua1000_quirk, | ||
3690 | [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk, | 3639 | [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk, |
3691 | [QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk | 3640 | [QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk |
3692 | }; | 3641 | }; |
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index 6b016d4aac6b..42c299cbf63a 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h | |||
@@ -75,7 +75,6 @@ enum quirk_type { | |||
75 | QUIRK_MIDI_US122L, | 75 | QUIRK_MIDI_US122L, |
76 | QUIRK_AUDIO_STANDARD_INTERFACE, | 76 | QUIRK_AUDIO_STANDARD_INTERFACE, |
77 | QUIRK_AUDIO_FIXED_ENDPOINT, | 77 | QUIRK_AUDIO_FIXED_ENDPOINT, |
78 | QUIRK_AUDIO_EDIROL_UA1000, | ||
79 | QUIRK_AUDIO_EDIROL_UAXX, | 78 | QUIRK_AUDIO_EDIROL_UAXX, |
80 | QUIRK_AUDIO_ALIGN_TRANSFER, | 79 | QUIRK_AUDIO_ALIGN_TRANSFER, |
81 | 80 | ||
@@ -112,7 +111,7 @@ struct snd_usb_midi_endpoint_info { | |||
112 | 111 | ||
113 | /* for QUIRK_AUDIO/MIDI_STANDARD_INTERFACE, data is NULL */ | 112 | /* for QUIRK_AUDIO/MIDI_STANDARD_INTERFACE, data is NULL */ |
114 | 113 | ||
115 | /* for QUIRK_AUDIO_EDIROL_UA700_UA25/UA1000, data is NULL */ | 114 | /* for QUIRK_AUDIO_EDIROL_UAXX, data is NULL */ |
116 | 115 | ||
117 | /* for QUIRK_IGNORE_INTERFACE, data is NULL */ | 116 | /* for QUIRK_IGNORE_INTERFACE, data is NULL */ |
118 | 117 | ||
diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h index f06faf7917b9..2b426c1fd0e8 100644 --- a/sound/usb/usbquirks.h +++ b/sound/usb/usbquirks.h | |||
@@ -1016,36 +1016,6 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
1016 | } | 1016 | } |
1017 | }, | 1017 | }, |
1018 | { | 1018 | { |
1019 | USB_DEVICE(0x0582, 0x0044), | ||
1020 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { | ||
1021 | .vendor_name = "Roland", | ||
1022 | .product_name = "UA-1000", | ||
1023 | .ifnum = QUIRK_ANY_INTERFACE, | ||
1024 | .type = QUIRK_COMPOSITE, | ||
1025 | .data = (const struct snd_usb_audio_quirk[]) { | ||
1026 | { | ||
1027 | .ifnum = 1, | ||
1028 | .type = QUIRK_AUDIO_EDIROL_UA1000 | ||
1029 | }, | ||
1030 | { | ||
1031 | .ifnum = 2, | ||
1032 | .type = QUIRK_AUDIO_EDIROL_UA1000 | ||
1033 | }, | ||
1034 | { | ||
1035 | .ifnum = 3, | ||
1036 | .type = QUIRK_MIDI_FIXED_ENDPOINT, | ||
1037 | .data = & (const struct snd_usb_midi_endpoint_info) { | ||
1038 | .out_cables = 0x0003, | ||
1039 | .in_cables = 0x0003 | ||
1040 | } | ||
1041 | }, | ||
1042 | { | ||
1043 | .ifnum = -1 | ||
1044 | } | ||
1045 | } | ||
1046 | } | ||
1047 | }, | ||
1048 | { | ||
1049 | /* has ID 0x0049 when not in "Advanced Driver" mode */ | 1019 | /* has ID 0x0049 when not in "Advanced Driver" mode */ |
1050 | USB_DEVICE(0x0582, 0x0047), | 1020 | USB_DEVICE(0x0582, 0x0047), |
1051 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { | 1021 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { |