diff options
author | Dmitry Torokhov <dtor_core@ameritech.net> | 2006-06-26 01:31:38 -0400 |
---|---|---|
committer | Dmitry Torokhov <dtor_core@ameritech.net> | 2006-06-26 01:31:38 -0400 |
commit | 4854c7b27f0975a2b629f35ea3996d2968eb7c4f (patch) | |
tree | 4102bdb70289764a2058aff0f907b13d7cf0e0d1 /drivers/char/ipmi | |
parent | 3cbd5b32cb625f5c0f1b1476d154fac873dd49ce (diff) | |
parent | fcc18e83e1f6fd9fa6b333735bf0fcd530655511 (diff) |
Merge rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'drivers/char/ipmi')
-rw-r--r-- | drivers/char/ipmi/ipmi_si_intf.c | 38 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_watchdog.c | 25 |
2 files changed, 31 insertions, 32 deletions
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index b36eef0e9d19..02a7dd7a8a55 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -1184,20 +1184,20 @@ static void port_outl(struct si_sm_io *io, unsigned int offset, | |||
1184 | static void port_cleanup(struct smi_info *info) | 1184 | static void port_cleanup(struct smi_info *info) |
1185 | { | 1185 | { |
1186 | unsigned int addr = info->io.addr_data; | 1186 | unsigned int addr = info->io.addr_data; |
1187 | int mapsize; | 1187 | int idx; |
1188 | 1188 | ||
1189 | if (addr) { | 1189 | if (addr) { |
1190 | mapsize = ((info->io_size * info->io.regspacing) | 1190 | for (idx = 0; idx < info->io_size; idx++) { |
1191 | - (info->io.regspacing - info->io.regsize)); | 1191 | release_region(addr + idx * info->io.regspacing, |
1192 | 1192 | info->io.regsize); | |
1193 | release_region (addr, mapsize); | 1193 | } |
1194 | } | 1194 | } |
1195 | } | 1195 | } |
1196 | 1196 | ||
1197 | static int port_setup(struct smi_info *info) | 1197 | static int port_setup(struct smi_info *info) |
1198 | { | 1198 | { |
1199 | unsigned int addr = info->io.addr_data; | 1199 | unsigned int addr = info->io.addr_data; |
1200 | int mapsize; | 1200 | int idx; |
1201 | 1201 | ||
1202 | if (!addr) | 1202 | if (!addr) |
1203 | return -ENODEV; | 1203 | return -ENODEV; |
@@ -1225,16 +1225,22 @@ static int port_setup(struct smi_info *info) | |||
1225 | return -EINVAL; | 1225 | return -EINVAL; |
1226 | } | 1226 | } |
1227 | 1227 | ||
1228 | /* Calculate the total amount of memory to claim. This is an | 1228 | /* Some BIOSes reserve disjoint I/O regions in their ACPI |
1229 | * unusual looking calculation, but it avoids claiming any | 1229 | * tables. This causes problems when trying to register the |
1230 | * more memory than it has to. It will claim everything | 1230 | * entire I/O region. Therefore we must register each I/O |
1231 | * between the first address to the end of the last full | 1231 | * port separately. |
1232 | * register. */ | 1232 | */ |
1233 | mapsize = ((info->io_size * info->io.regspacing) | 1233 | for (idx = 0; idx < info->io_size; idx++) { |
1234 | - (info->io.regspacing - info->io.regsize)); | 1234 | if (request_region(addr + idx * info->io.regspacing, |
1235 | 1235 | info->io.regsize, DEVICE_NAME) == NULL) { | |
1236 | if (request_region(addr, mapsize, DEVICE_NAME) == NULL) | 1236 | /* Undo allocations */ |
1237 | return -EIO; | 1237 | while (idx--) { |
1238 | release_region(addr + idx * info->io.regspacing, | ||
1239 | info->io.regsize); | ||
1240 | } | ||
1241 | return -EIO; | ||
1242 | } | ||
1243 | } | ||
1238 | return 0; | 1244 | return 0; |
1239 | } | 1245 | } |
1240 | 1246 | ||
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index 2d11ddd99e55..8f8867170973 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c | |||
@@ -212,24 +212,16 @@ static int set_param_str(const char *val, struct kernel_param *kp) | |||
212 | { | 212 | { |
213 | action_fn fn = (action_fn) kp->arg; | 213 | action_fn fn = (action_fn) kp->arg; |
214 | int rv = 0; | 214 | int rv = 0; |
215 | const char *end; | 215 | char *dup, *s; |
216 | char valcp[16]; | 216 | |
217 | int len; | 217 | dup = kstrdup(val, GFP_KERNEL); |
218 | 218 | if (!dup) | |
219 | /* Truncate leading and trailing spaces. */ | 219 | return -ENOMEM; |
220 | while (isspace(*val)) | 220 | |
221 | val++; | 221 | s = strstrip(dup); |
222 | end = val + strlen(val) - 1; | ||
223 | while ((end >= val) && isspace(*end)) | ||
224 | end--; | ||
225 | len = end - val + 1; | ||
226 | if (len > sizeof(valcp) - 1) | ||
227 | return -EINVAL; | ||
228 | memcpy(valcp, val, len); | ||
229 | valcp[len] = '\0'; | ||
230 | 222 | ||
231 | down_read(®ister_sem); | 223 | down_read(®ister_sem); |
232 | rv = fn(valcp, NULL); | 224 | rv = fn(s, NULL); |
233 | if (rv) | 225 | if (rv) |
234 | goto out_unlock; | 226 | goto out_unlock; |
235 | 227 | ||
@@ -239,6 +231,7 @@ static int set_param_str(const char *val, struct kernel_param *kp) | |||
239 | 231 | ||
240 | out_unlock: | 232 | out_unlock: |
241 | up_read(®ister_sem); | 233 | up_read(®ister_sem); |
234 | kfree(dup); | ||
242 | return rv; | 235 | return rv; |
243 | } | 236 | } |
244 | 237 | ||