Commit 90b2d4f1 authored by Corey Minyard's avatar Corey Minyard
Browse files

ipmi_si: Remove hacks for adding a dummy platform devices



All the IPMI address sources now supply a real device.  This cheap
hack is no longer necessary.

Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
parent e17c6571
Loading
Loading
Loading
Loading
+3 −42
Original line number Diff line number Diff line
@@ -229,15 +229,9 @@ struct smi_info {
	/* From the get device id response... */
	struct ipmi_device_id device_id;

	/* Default driver model device. */
	struct platform_device *pdev;

	/* Have we added the device group to the device? */
	bool dev_group_added;

	/* Have we added the platform device? */
	bool pdev_registered;

	/* Counters and things for the proc filesystem. */
	atomic_t stats[SI_NUM_STATS];

@@ -1969,25 +1963,10 @@ static int try_smi_init(struct smi_info *new_smi)

	/* Do this early so it's available for logs. */
	if (!new_smi->io.dev) {
		init_name = kasprintf(GFP_KERNEL, "ipmi_si.%d",
				      new_smi->si_num);

		/*
		 * If we don't already have a device from something
		 * else (like PCI), then register a new one.
		 */
		new_smi->pdev = platform_device_alloc("ipmi_si",
						      new_smi->si_num);
		if (!new_smi->pdev) {
			pr_err("Unable to allocate platform device\n");
			rv = -ENOMEM;
		pr_err("IPMI interface added with no device\n");
		rv = EIO;
		goto out_err;
	}
		new_smi->io.dev = &new_smi->pdev->dev;
		new_smi->io.dev->driver = &ipmi_platform_driver.driver;
		/* Nulled by device_add() */
		new_smi->io.dev->init_name = init_name;
	}

	/* Allocate the state machine's data and initialize it. */
	new_smi->si_sm = kmalloc(new_smi->handlers->size(), GFP_KERNEL);
@@ -2059,17 +2038,6 @@ static int try_smi_init(struct smi_info *new_smi)
		atomic_set(&new_smi->req_events, 1);
	}

	if (new_smi->pdev && !new_smi->pdev_registered) {
		rv = platform_device_add(new_smi->pdev);
		if (rv) {
			dev_err(new_smi->io.dev,
				"Unable to register system interface device: %d\n",
				rv);
			goto out_err;
		}
		new_smi->pdev_registered = true;
	}

	dev_set_drvdata(new_smi->io.dev, new_smi);
	rv = device_add_group(new_smi->io.dev, &ipmi_si_dev_attr_group);
	if (rv) {
@@ -2253,13 +2221,6 @@ static void cleanup_one_si(struct smi_info *smi_info)
	if (smi_info->intf)
		ipmi_unregister_smi(smi_info->intf);

	if (smi_info->pdev) {
		if (smi_info->pdev_registered)
			platform_device_unregister(smi_info->pdev);
		else
			platform_device_put(smi_info->pdev);
	}

	kfree(smi_info);
}