static int gcnrtc_probe(struct exi_device *dev) { struct gcnrtc_drvdata *drvdata = &gcnrtc_drvdata; unsigned long flags; int retval = -ENODEV; if (exi_device_get(dev)) { spin_lock_init(&drvdata->lock); exi_set_drvdata(dev, drvdata); drvdata->dev = dev; memset(&drvdata->sram, 0, sizeof(struct gcn_sram)); sram_load(dev); spin_lock_irqsave(&drvdata->lock, flags); ppc_md.set_rtc_time = gcnrtc_plat_rtc_set_time; ppc_md.get_rtc_time = gcnrtc_plat_rtc_get_time; spin_unlock_irqrestore(&drvdata->lock, flags); drvdata->rtc_dev = rtc_device_register(DRV_MODULE_NAME, &dev->dev, &gcnrtc_ops, THIS_MODULE); retval = 0; } return retval; }
static int rtc_probe(struct exi_device *dev) { struct rtc_private *priv = &rtc_private; unsigned long flags; int retval = -ENODEV; if (exi_device_get(dev)) { spin_lock_init(&priv->lock); exi_set_drvdata(dev, priv); priv->dev = dev; memset(&priv->sram, 0, sizeof(struct gcn_sram)); sram_load(dev); spin_lock_irqsave(&priv->lock, flags); ppc_md.set_rtc_time = gcn_set_rtc_time; ppc_md.get_rtc_time = gcn_get_rtc_time; spin_unlock_irqrestore(&priv->lock, flags); retval = 0; } return retval; }
/* * 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; }