Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 217430
b: refs/heads/master
c: de5e2dd
h: refs/heads/master
v: v3
  • Loading branch information
Eric Dumazet authored and Linus Torvalds committed Oct 26, 2010
1 parent b982522 commit 5b27926
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1f9fa5216eacf4fdf9d3e4ab57feb8b642f0e78b
refs/heads/master: de5e2ddf9bb3ce7b643223b9b0718062254f302f
30 changes: 19 additions & 11 deletions trunk/drivers/char/ipmi/ipmi_si_intf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1665,6 +1665,17 @@ static int check_hotmod_int_op(const char *curr, const char *option,
return 0;
}

static struct smi_info *smi_info_alloc(void)
{
struct smi_info *info = kzalloc(sizeof(*info), GFP_KERNEL);

if (info) {
spin_lock_init(&info->si_lock);
spin_lock_init(&info->msg_lock);
}
return info;
}

static int hotmod_handler(const char *val, struct kernel_param *kp)
{
char *str = kstrdup(val, GFP_KERNEL);
Expand Down Expand Up @@ -1779,7 +1790,7 @@ static int hotmod_handler(const char *val, struct kernel_param *kp)
}

if (op == HM_ADD) {
info = kzalloc(sizeof(*info), GFP_KERNEL);
info = smi_info_alloc();
if (!info) {
rv = -ENOMEM;
goto out;
Expand Down Expand Up @@ -1844,7 +1855,7 @@ static __devinit void hardcode_find_bmc(void)
if (!ports[i] && !addrs[i])
continue;

info = kzalloc(sizeof(*info), GFP_KERNEL);
info = smi_info_alloc();
if (!info)
return;

Expand Down Expand Up @@ -2027,7 +2038,7 @@ static __devinit int try_init_spmi(struct SPMITable *spmi)
return -ENODEV;
}

info = kzalloc(sizeof(*info), GFP_KERNEL);
info = smi_info_alloc();
if (!info) {
printk(KERN_ERR PFX "Could not allocate SI data (3)\n");
return -ENOMEM;
Expand Down Expand Up @@ -2137,7 +2148,7 @@ static int __devinit ipmi_pnp_probe(struct pnp_dev *dev,
if (!acpi_dev)
return -ENODEV;

info = kzalloc(sizeof(*info), GFP_KERNEL);
info = smi_info_alloc();
if (!info)
return -ENOMEM;

Expand Down Expand Up @@ -2318,7 +2329,7 @@ static __devinit void try_init_dmi(struct dmi_ipmi_data *ipmi_data)
{
struct smi_info *info;

info = kzalloc(sizeof(*info), GFP_KERNEL);
info = smi_info_alloc();
if (!info) {
printk(KERN_ERR PFX "Could not allocate SI data\n");
return;
Expand Down Expand Up @@ -2425,7 +2436,7 @@ static int __devinit ipmi_pci_probe(struct pci_dev *pdev,
int class_type = pdev->class & PCI_ERMC_CLASSCODE_TYPE_MASK;
struct smi_info *info;

info = kzalloc(sizeof(*info), GFP_KERNEL);
info = smi_info_alloc();
if (!info)
return -ENOMEM;

Expand Down Expand Up @@ -2566,7 +2577,7 @@ static int __devinit ipmi_of_probe(struct platform_device *dev,
return -EINVAL;
}

info = kzalloc(sizeof(*info), GFP_KERNEL);
info = smi_info_alloc();

if (!info) {
dev_err(&dev->dev,
Expand Down Expand Up @@ -3013,7 +3024,7 @@ static __devinit void default_find_bmc(void)
if (check_legacy_ioport(ipmi_defaults[i].port))
continue;
#endif
info = kzalloc(sizeof(*info), GFP_KERNEL);
info = smi_info_alloc();
if (!info)
return;

Expand Down Expand Up @@ -3138,9 +3149,6 @@ static int try_smi_init(struct smi_info *new_smi)
goto out_err;
}

spin_lock_init(&(new_smi->si_lock));
spin_lock_init(&(new_smi->msg_lock));

/* Do low-level detection first. */
if (new_smi->handlers->detect(new_smi->si_sm)) {
if (new_smi->addr_source)
Expand Down

0 comments on commit 5b27926

Please sign in to comment.