X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fmmc%2Fwbsd.c;h=9df0ddeb3ff97f107eeb519508f8d905b1642fc4;hb=63648fb5c0173614064e329503cc75c907dcb1a1;hp=3ace875decc4475270aa8abc066471a3abd634bf;hpb=955c5038823748e529a49f0e33ab635d92843500;p=linux-2.6 diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c index 3ace875dec..9df0ddeb3f 100644 --- a/drivers/mmc/wbsd.c +++ b/drivers/mmc/wbsd.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -42,7 +42,7 @@ #include "wbsd.h" #define DRIVER_NAME "wbsd" -#define DRIVER_VERSION "1.4" +#define DRIVER_VERSION "1.5" #ifdef CONFIG_MMC_DEBUG #define DBG(x...) \ @@ -201,7 +201,7 @@ static void wbsd_reset(struct wbsd_host* host) { u8 setup; - printk(KERN_ERR DRIVER_NAME ": Resetting chip\n"); + printk(KERN_ERR "%s: Resetting chip\n", mmc_hostname(host->mmc)); /* * Soft reset of chip (SD/MMC part). @@ -880,8 +880,9 @@ static void wbsd_finish_data(struct wbsd_host* host, struct mmc_data* data) */ if (count) { - printk(KERN_ERR DRIVER_NAME ": Incomplete DMA " - "transfer. %d bytes left.\n", count); + printk(KERN_ERR "%s: Incomplete DMA transfer. " + "%d bytes left.\n", + mmc_hostname(host->mmc), count); data->error = MMC_ERR_FAILED; } @@ -1169,8 +1170,8 @@ static void wbsd_tasklet_card(unsigned long param) if (host->mrq) { - printk(KERN_ERR DRIVER_NAME - ": Card removed during transfer!\n"); + printk(KERN_ERR "%s: Card removed during transfer!\n", + mmc_hostname(host->mmc)); wbsd_reset(host); host->mrq->cmd->error = MMC_ERR_FAILED; @@ -1455,13 +1456,11 @@ static int __devinit wbsd_scan(struct wbsd_host* host) * Iterate through all ports, all codes to * find hardware that is in our known list. */ - for (i = 0;i < sizeof(config_ports)/sizeof(int);i++) - { + for (i = 0; i < ARRAY_SIZE(config_ports); i++) { if (!request_region(config_ports[i], 2, DRIVER_NAME)) continue; - for (j = 0;j < sizeof(unlock_codes)/sizeof(int);j++) - { + for (j = 0; j < ARRAY_SIZE(unlock_codes); j++) { id = 0xFFFF; host->config = config_ports[i]; @@ -1477,8 +1476,7 @@ static int __devinit wbsd_scan(struct wbsd_host* host) wbsd_lock_config(host); - for (k = 0;k < sizeof(valid_ids)/sizeof(int);k++) - { + for (k = 0; k < ARRAY_SIZE(valid_ids); k++) { if (id == valid_ids[k]) { host->chip_id = id; @@ -1601,8 +1599,7 @@ static void __devexit wbsd_release_dma(struct wbsd_host* host) if (host->dma_addr) dma_unmap_single(host->mmc->dev, host->dma_addr, WBSD_DMA_SIZE, DMA_BIDIRECTIONAL); - if (host->dma_buffer) - kfree(host->dma_buffer); + kfree(host->dma_buffer); if (host->dma >= 0) free_dma(host->dma); @@ -1852,9 +1849,9 @@ static int __devinit wbsd_init(struct device* dev, int base, int irq, int dma, /* * See if chip needs to be configured. */ - if (pnp && (host->config != 0)) + if (pnp) { - if (!wbsd_chip_validate(host)) + if ((host->config != 0) && !wbsd_chip_validate(host)) { printk(KERN_WARNING DRIVER_NAME ": PnP active but chip not configured! " @@ -1932,14 +1929,14 @@ static void __devexit wbsd_shutdown(struct device* dev, int pnp) * Non-PnP */ -static int __devinit wbsd_probe(struct device* dev) +static int __devinit wbsd_probe(struct platform_device* dev) { - return wbsd_init(dev, io, irq, dma, 0); + return wbsd_init(&dev->dev, io, irq, dma, 0); } -static int __devexit wbsd_remove(struct device* dev) +static int __devexit wbsd_remove(struct platform_device* dev) { - wbsd_shutdown(dev, 0); + wbsd_shutdown(&dev->dev, 0); return 0; } @@ -1983,9 +1980,9 @@ static void __devexit wbsd_pnp_remove(struct pnp_dev * dev) #ifdef CONFIG_PM -static int wbsd_suspend(struct device *dev, pm_message_t state) +static int wbsd_suspend(struct platform_device *dev, pm_message_t state) { - struct mmc_host *mmc = dev_get_drvdata(dev); + struct mmc_host *mmc = platform_get_drvdata(dev); struct wbsd_host *host; int ret; @@ -2005,9 +2002,9 @@ static int wbsd_suspend(struct device *dev, pm_message_t state) return 0; } -static int wbsd_resume(struct device *dev) +static int wbsd_resume(struct platform_device *dev) { - struct mmc_host *mmc = dev_get_drvdata(dev); + struct mmc_host *mmc = platform_get_drvdata(dev); struct wbsd_host *host; if (!mmc) @@ -2038,14 +2035,15 @@ static int wbsd_resume(struct device *dev) static struct platform_device *wbsd_device; -static struct device_driver wbsd_driver = { - .name = DRIVER_NAME, - .bus = &platform_bus_type, +static struct platform_driver wbsd_driver = { .probe = wbsd_probe, - .remove = wbsd_remove, + .remove = __devexit_p(wbsd_remove), .suspend = wbsd_suspend, .resume = wbsd_resume, + .driver = { + .name = DRIVER_NAME, + }, }; #ifdef CONFIG_PNP @@ -2054,7 +2052,7 @@ static struct pnp_driver wbsd_pnp_driver = { .name = DRIVER_NAME, .id_table = pnp_dev_table, .probe = wbsd_pnp_probe, - .remove = wbsd_pnp_remove, + .remove = __devexit_p(wbsd_pnp_remove), }; #endif /* CONFIG_PNP */ @@ -2085,7 +2083,7 @@ static int __init wbsd_drv_init(void) if (nopnp) { - result = driver_register(&wbsd_driver); + result = platform_driver_register(&wbsd_driver); if (result < 0) return result; @@ -2111,7 +2109,7 @@ static void __exit wbsd_drv_exit(void) { platform_device_unregister(wbsd_device); - driver_unregister(&wbsd_driver); + platform_driver_unregister(&wbsd_driver); } DBG("unloaded\n"); @@ -2127,6 +2125,7 @@ module_param(irq, uint, 0444); module_param(dma, int, 0444); MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Pierre Ossman "); MODULE_DESCRIPTION("Winbond W83L51xD SD/MMC card interface driver"); MODULE_VERSION(DRIVER_VERSION);