diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/aoa/soundbus/core.c | 77 | ||||
-rw-r--r-- | sound/sparc/amd7930.c | 4 | ||||
-rw-r--r-- | sound/sparc/cs4231.c | 2 |
3 files changed, 34 insertions, 49 deletions
diff --git a/sound/aoa/soundbus/core.c b/sound/aoa/soundbus/core.c index 6f004f70e308..8b2e9b905cda 100644 --- a/sound/aoa/soundbus/core.c +++ b/sound/aoa/soundbus/core.c | |||
@@ -61,10 +61,9 @@ static int soundbus_uevent(struct device *dev, char **envp, int num_envp, | |||
61 | { | 61 | { |
62 | struct soundbus_dev * soundbus_dev; | 62 | struct soundbus_dev * soundbus_dev; |
63 | struct of_device * of; | 63 | struct of_device * of; |
64 | char *scratch; | ||
65 | const char *compat; | 64 | const char *compat; |
66 | int i = 0; | 65 | int retval = 0, i = 0, length = 0; |
67 | int length, cplen, seen = 0; | 66 | int cplen, seen = 0; |
68 | 67 | ||
69 | if (!dev) | 68 | if (!dev) |
70 | return -ENODEV; | 69 | return -ENODEV; |
@@ -76,21 +75,17 @@ static int soundbus_uevent(struct device *dev, char **envp, int num_envp, | |||
76 | of = &soundbus_dev->ofdev; | 75 | of = &soundbus_dev->ofdev; |
77 | 76 | ||
78 | /* stuff we want to pass to /sbin/hotplug */ | 77 | /* stuff we want to pass to /sbin/hotplug */ |
79 | envp[i++] = scratch = buffer; | 78 | retval = add_uevent_var(envp, num_envp, &i, |
80 | length = scnprintf (scratch, buffer_size, "OF_NAME=%s", of->node->name); | 79 | buffer, buffer_size, &length, |
81 | ++length; | 80 | "OF_NAME=%s", of->node->name); |
82 | buffer_size -= length; | 81 | if (retval) |
83 | if ((buffer_size <= 0) || (i >= num_envp)) | 82 | return retval; |
84 | return -ENOMEM; | 83 | |
85 | scratch += length; | 84 | retval = add_uevent_var(envp, num_envp, &i, |
86 | 85 | buffer, buffer_size, &length, | |
87 | envp[i++] = scratch; | 86 | "OF_TYPE=%s", of->node->type); |
88 | length = scnprintf (scratch, buffer_size, "OF_TYPE=%s", of->node->type); | 87 | if (retval) |
89 | ++length; | 88 | return retval; |
90 | buffer_size -= length; | ||
91 | if ((buffer_size <= 0) || (i >= num_envp)) | ||
92 | return -ENOMEM; | ||
93 | scratch += length; | ||
94 | 89 | ||
95 | /* Since the compatible field can contain pretty much anything | 90 | /* Since the compatible field can contain pretty much anything |
96 | * it's not really legal to split it out with commas. We split it | 91 | * it's not really legal to split it out with commas. We split it |
@@ -98,39 +93,29 @@ static int soundbus_uevent(struct device *dev, char **envp, int num_envp, | |||
98 | 93 | ||
99 | compat = of_get_property(of->node, "compatible", &cplen); | 94 | compat = of_get_property(of->node, "compatible", &cplen); |
100 | while (compat && cplen > 0) { | 95 | while (compat && cplen > 0) { |
101 | envp[i++] = scratch; | 96 | int tmp = length; |
102 | length = scnprintf (scratch, buffer_size, | 97 | retval = add_uevent_var(envp, num_envp, &i, |
103 | "OF_COMPATIBLE_%d=%s", seen, compat); | 98 | buffer, buffer_size, &length, |
104 | ++length; | 99 | "OF_COMPATIBLE_%d=%s", seen, compat); |
105 | buffer_size -= length; | 100 | if (retval) |
106 | if ((buffer_size <= 0) || (i >= num_envp)) | 101 | return retval; |
107 | return -ENOMEM; | 102 | compat += length - tmp; |
108 | scratch += length; | 103 | cplen -= length - tmp; |
109 | length = strlen (compat) + 1; | 104 | seen += 1; |
110 | compat += length; | ||
111 | cplen -= length; | ||
112 | seen++; | ||
113 | } | 105 | } |
114 | 106 | ||
115 | envp[i++] = scratch; | 107 | retval = add_uevent_var(envp, num_envp, &i, |
116 | length = scnprintf (scratch, buffer_size, "OF_COMPATIBLE_N=%d", seen); | 108 | buffer, buffer_size, &length, |
117 | ++length; | 109 | "OF_COMPATIBLE_N=%d", seen); |
118 | buffer_size -= length; | 110 | if (retval) |
119 | if ((buffer_size <= 0) || (i >= num_envp)) | 111 | return retval; |
120 | return -ENOMEM; | 112 | retval = add_uevent_var(envp, num_envp, &i, |
121 | scratch += length; | 113 | buffer, buffer_size, &length, |
122 | 114 | "MODALIAS=%s", soundbus_dev->modalias); | |
123 | envp[i++] = scratch; | ||
124 | length = scnprintf (scratch, buffer_size, "MODALIAS=%s", | ||
125 | soundbus_dev->modalias); | ||
126 | |||
127 | buffer_size -= length; | ||
128 | if ((buffer_size <= 0) || (i >= num_envp)) | ||
129 | return -ENOMEM; | ||
130 | 115 | ||
131 | envp[i] = NULL; | 116 | envp[i] = NULL; |
132 | 117 | ||
133 | return 0; | 118 | return retval; |
134 | } | 119 | } |
135 | 120 | ||
136 | static int soundbus_device_remove(struct device *dev) | 121 | static int soundbus_device_remove(struct device *dev) |
diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c index c899786f30f5..07962a35f241 100644 --- a/sound/sparc/amd7930.c +++ b/sound/sparc/amd7930.c | |||
@@ -1067,8 +1067,8 @@ out_err: | |||
1067 | 1067 | ||
1068 | static int __devinit amd7930_obio_attach(struct device_node *dp) | 1068 | static int __devinit amd7930_obio_attach(struct device_node *dp) |
1069 | { | 1069 | { |
1070 | struct linux_prom_registers *regs; | 1070 | const struct linux_prom_registers *regs; |
1071 | struct linux_prom_irqs *irqp; | 1071 | const struct linux_prom_irqs *irqp; |
1072 | struct resource res, *rp; | 1072 | struct resource res, *rp; |
1073 | int len; | 1073 | int len; |
1074 | 1074 | ||
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c index f5956d557f70..900a00de35fd 100644 --- a/sound/sparc/cs4231.c +++ b/sound/sparc/cs4231.c | |||
@@ -2284,7 +2284,7 @@ static int __init cs4231_init(void) | |||
2284 | if (!strcmp(edev->prom_node->name, "SUNW,CS4231")) { | 2284 | if (!strcmp(edev->prom_node->name, "SUNW,CS4231")) { |
2285 | match = 1; | 2285 | match = 1; |
2286 | } else if (!strcmp(edev->prom_node->name, "audio")) { | 2286 | } else if (!strcmp(edev->prom_node->name, "audio")) { |
2287 | char *compat; | 2287 | const char *compat; |
2288 | 2288 | ||
2289 | compat = of_get_property(edev->prom_node, | 2289 | compat = of_get_property(edev->prom_node, |
2290 | "compatible", NULL); | 2290 | "compatible", NULL); |