Пример #1
0
/*
 * Checks if the given EXI device is a MMC/SD card and makes it available
 * if true.
 */
static int sd_probe(struct exi_device *exi_device)
{
	struct sd_host *host;
	int retval;

	/* don't try to drive a device which already has a real identifier */
	if (exi_device->eid.id != EXI_ID_NONE)
		return -ENODEV;

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

	host->exi_device = exi_device_get(exi_device);
	WARN_ON(exi_get_drvdata(exi_device));
	exi_set_drvdata(exi_device, host);
	retval = sd_init(host);
	if (retval) {
		exi_set_drvdata(exi_device, NULL);
		host->exi_device = NULL;
		kfree(host);
		exi_device_put(exi_device);
	}
	return retval;
}
Пример #2
0
/*
 * Makes unavailable the MMC/SD card identified by the EXI device `exi_device'.
 */
static void sd_remove(struct exi_device *exi_device)
{
	struct sd_host *host = exi_get_drvdata(exi_device);

	WARN_ON(!host);
	WARN_ON(!host->exi_device);

	exi_set_drvdata(exi_device, NULL);
	if (host)
		sd_kill(host);
	exi_device_put(exi_device);
}
Пример #3
0
static void rtc_remove(struct exi_device *dev)
{
	struct rtc_private *priv = exi_get_drvdata(dev);
	unsigned long flags;

	if (priv) {
		spin_lock_irqsave(&priv->lock, flags);
		ppc_md.set_rtc_time = NULL;
		ppc_md.get_rtc_time = NULL;
		spin_unlock_irqrestore(&priv->lock, flags);
	}
	exi_device_put(dev);
}
Пример #4
0
static void gcnrtc_remove(struct exi_device *dev)
{
	struct gcnrtc_drvdata *drvdata = exi_get_drvdata(dev);
	unsigned long flags;

	if (drvdata) {
		spin_lock_irqsave(&drvdata->lock, flags);
		ppc_md.set_rtc_time = NULL;
		ppc_md.get_rtc_time = NULL;
		spin_unlock_irqrestore(&drvdata->lock, flags);

		if (!IS_ERR(drvdata->rtc_dev))
			rtc_device_unregister(drvdata->rtc_dev);
	}
	exi_device_put(dev);
}