/* * Loads the SRAM contents. * Context: user. */ static void sram_load(struct exi_device *dev) { struct gcnrtc_drvdata *drvdata = exi_get_drvdata(dev); struct gcn_sram *sram = &drvdata->sram; u32 req; exi_dev_take(dev); /* select the SRAM device */ exi_dev_select(dev); /* send the appropriate command */ req = 0x20000100; exi_dev_write(dev, &req, sizeof(req)); /* read the SRAM data */ exi_dev_read(dev, sram, sizeof(*sram)); /* deselect the SRAM device */ exi_dev_deselect(dev); exi_dev_give(dev); return; }
/* * 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; }
/* * 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); }
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); }
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); }
/* * Loads the SRAM contents. * Context: user. */ static void sram_load(struct exi_device *dev) { struct rtc_private *priv = exi_get_drvdata(dev); struct gcn_sram *sram = &priv->sram; u32 req; /* select the SRAM device */ if (exi_dev_select(dev) == 0) { /* send the appropriate command */ req = 0x20000100; exi_dev_write(dev, &req, sizeof(req)); /* read the SRAM data */ exi_dev_read(dev, sram, sizeof(*sram)); /* deselect the SRAM device */ exi_dev_deselect(dev); } return; }