Skip to content

Commit 43cc71e

Browse files
kaysieversgregkh
authored andcommitted
platform: prefix MODALIAS with "platform:"
Prefix platform modalias strings with "platform:", which modprobe config to blacklist alias resolving if userspace configures it. Send uevents for all platform devices. Add MODULE_ALIAS's to: pxa2xx_pcmcia, ds1742 and pcspkr to trigger module autoloading by userspace. $ modinfo pcspkr alias: platform:pcspkr license: GPL description: PC Speaker beeper driver ... $ modprobe -n -v platform:pcspkr insmod /lib/modules/2.6.23-rc3-g28e8351a-dirty/kernel/drivers/input/misc/pcspkr.ko Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Cc: David Brownell <david-b@pacbell.net> Cc: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 782e3b3 commit 43cc71e

4 files changed

Lines changed: 5 additions & 15 deletions

File tree

‎drivers/base/platform.c‎

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,6 @@ static void platform_device_release(struct device *dev)
160160
*
161161
* Create a platform device object which can have other objects attached
162162
* to it, and which will have attached objects freed when it is released.
163-
*
164-
* This device will be marked as not supporting hotpluggable drivers; no
165-
* device add/remove uevents will be generated. In the unusual case that
166-
* the device isn't being dynamically allocated as a legacy "probe the
167-
* hardware" driver, infrastructure code should reverse this marking.
168163
*/
169164
struct platform_device *platform_device_alloc(const char *name, unsigned int id)
170165
{
@@ -177,12 +172,6 @@ struct platform_device *platform_device_alloc(const char *name, unsigned int id)
177172
pa->pdev.id = id;
178173
device_initialize(&pa->pdev.dev);
179174
pa->pdev.dev.release = platform_device_release;
180-
181-
/* prevent hotplug "modprobe $(MODALIAS)" from causing trouble in
182-
* legacy probe-the-hardware drivers, which don't properly split
183-
* out device enumeration logic from drivers.
184-
*/
185-
pa->pdev.dev.uevent_suppress = 1;
186175
}
187176

188177
return pa ? &pa->pdev : NULL;
@@ -530,7 +519,7 @@ static ssize_t
530519
modalias_show(struct device *dev, struct device_attribute *a, char *buf)
531520
{
532521
struct platform_device *pdev = to_platform_device(dev);
533-
int len = snprintf(buf, PAGE_SIZE, "%s\n", pdev->name);
522+
int len = snprintf(buf, PAGE_SIZE, "platform:%s\n", pdev->name);
534523

535524
return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
536525
}
@@ -546,7 +535,7 @@ static int platform_uevent(struct device *dev, char **envp, int num_envp,
546535
struct platform_device *pdev = to_platform_device(dev);
547536

548537
envp[0] = buffer;
549-
snprintf(buffer, buffer_size, "MODALIAS=%s", pdev->name);
538+
snprintf(buffer, buffer_size, "MODALIAS=platform:%s", pdev->name);
550539
return 0;
551540
}
552541

‎drivers/input/misc/pcspkr.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
2424
MODULE_DESCRIPTION("PC Speaker beeper driver");
2525
MODULE_LICENSE("GPL");
26+
MODULE_ALIAS("platform:pcspkr");
2627

2728
#ifdef CONFIG_X86
2829
/* Use the global PIT lock ! */

‎drivers/pcmcia/pxa2xx_mainstone.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ static int __init mst_pcmcia_init(void)
175175
if (!mst_pcmcia_device)
176176
return -ENOMEM;
177177

178-
mst_pcmcia_device->dev.uevent_suppress = 0;
179178
mst_pcmcia_device->dev.platform_data = &mst_pcmcia_ops;
180179

181180
ret = platform_device_add(mst_pcmcia_device);
@@ -195,3 +194,4 @@ fs_initcall(mst_pcmcia_init);
195194
module_exit(mst_pcmcia_exit);
196195

197196
MODULE_LICENSE("GPL");
197+
MODULE_ALIAS("platform:pxa2xx-pcmcia");

‎drivers/pcmcia/pxa2xx_sharpsl.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ static int __init sharpsl_pcmcia_init(void)
261261
if (!sharpsl_pcmcia_device)
262262
return -ENOMEM;
263263

264-
sharpsl_pcmcia_device->dev.uevent_suppress = 0;
265264
sharpsl_pcmcia_device->dev.platform_data = &sharpsl_pcmcia_ops;
266265
sharpsl_pcmcia_device->dev.parent = platform_scoop_config->devs[0].dev;
267266

@@ -284,3 +283,4 @@ module_exit(sharpsl_pcmcia_exit);
284283

285284
MODULE_DESCRIPTION("Sharp SL Series PCMCIA Support");
286285
MODULE_LICENSE("GPL");
286+
MODULE_ALIAS("platform:pxa2xx-pcmcia");

0 commit comments

Comments
 (0)