mmc: dw: don't check resource with devm_ioremap_resource
Subsystems (2)
PATCH 2/3 mmc: dw: eliminate useless usage of ret
In reply to Andy ShevchenkoIn few places usage of ret variable is not needed. This patch simplifies that pieces of code.
--- drivers/mmc/host/dw_mmc-pci.c | 8 ++------ drivers/mmc/host/dw_mmc-pltfm.c | 17 +++-------------- 2 files changed, 5 insertions(+), 20 deletions(-)
drivers/mmc/host/dw_mmc-pci.c +2 -6
@@ -100,22 +100,18 @@ static void dw_mci_pci_remove(struct pci_dev *pdev)#ifdef CONFIG_PM_SLEEP static int dw_mci_pci_suspend (struct device *dev) { -int ret;struct pci_dev *pdev =to_pci_dev (dev);struct dw_mci *host =pci_get_drvdata (pdev); - ret =dw_mci_suspend (host); -return ret; +return dw_mci_suspend (host); }static int dw_mci_pci_resume (struct device *dev) { -int ret;struct pci_dev *pdev =to_pci_dev (dev);struct dw_mci *host =pci_get_drvdata (pdev); - ret =dw_mci_resume (host); -return ret; +return dw_mci_resume (host); }#else #define dw_mci_pci_suspend NULL
drivers/mmc/host/dw_mmc-pltfm.c +3 -14
@@ -56,8 +56,7 @@ int dw_mci_pltfm_register(struct platform_device *pdev, }platform_set_drvdata (pdev, host); - ret =dw_mci_probe (host); -return ret; +return dw_mci_probe (host); }EXPORT_SYMBOL_GPL (dw_mci_pltfm_register);
@@ -81,26 +80,16 @@ EXPORT_SYMBOL_GPL(dw_mci_pltfm_remove);*/ static int dw_mci_pltfm_suspend (struct device *dev) { -int ret;struct dw_mci *host =dev_get_drvdata (dev); - ret =dw_mci_suspend (host); -if (ret) -return ret; - -return 0 ; +return dw_mci_suspend (host); }static int dw_mci_pltfm_resume (struct device *dev) { -int ret;struct dw_mci *host =dev_get_drvdata (dev); - ret =dw_mci_resume (host); -if (ret) -return ret; - -return 0 ; +return dw_mci_resume (host); }#else #define dw_mci_pltfm_suspend NULL
Signature · 1 line
1.8.2.rc0.22.gb3600c3
PATCH 3/3 mmc: dw: convert to use pcim_* and devm_*
In reply to Andy ShevchenkoThe PCI driver is getting simplier and tidier with pcim_* and devm_* functions in use.
--- drivers/mmc/host/dw_mmc-pci.c | 50 +++++++++++++------------------------------ 1 file changed, 15 insertions(+), 35 deletions(-)
drivers/mmc/host/dw_mmc-pci.c +15 -35
@@ -21,7 +21,6 @@#include "dw_mmc.h" #define PCI_BAR_NO 2 -#define COMPLETE_BAR 0#define SYNOPSYS_DW_MCI_VENDOR_ID 0x700#define SYNOPSYS_DW_MCI_DEVICE_ID 0x1107/* Defining the Capabilities */
@@ -38,51 +37,37 @@ static struct dw_mci_board pci_board_data = { };static int dw_mci_pci_probe (struct pci_dev *pdev, -const struct pci_device_id *entries) +const struct pci_device_id *entries) {struct dw_mci *host;int ret; - ret =pci_enable_device (pdev); + ret =pcim_enable_device (pdev);if (ret)return ret; -if (pci_request_regions (pdev,"dw_mmc_pci" )) { - ret = -ENODEV ; - goto err_disable_dev; - } - host =kzalloc (sizeof (struct dw_mci ),GFP_KERNEL ); -if (!host) { - ret = -ENOMEM ; - goto err_release; - } + host =devm_kzalloc (&pdev->dev,sizeof (struct dw_mci ),GFP_KERNEL ); +if (!host) +return -ENOMEM ; host->irq = pdev->irq; host->irq_flags =IRQF_SHARED ; host->dev = &pdev->dev; host->pdata = &pci_board_data; - host->regs =pci_iomap (pdev,PCI_BAR_NO ,COMPLETE_BAR ); -if (!host->regs) { - ret = -EIO ; - goto err_unmap; - } + ret =pcim_iomap_regions (pdev,1 <<PCI_BAR_NO ,pci_name (pdev)); +if (ret) +return ret; + + host->regs =pcim_iomap_table (pdev)[0 ]; -pci_set_drvdata (pdev, host); ret =dw_mci_probe (host);if (ret) - goto err_probe_failed; -return ret; - -err_probe_failed: -pci_iounmap (pdev, host->regs); -err_unmap: -kfree (host); -err_release: -pci_release_regions (pdev); -err_disable_dev: -pci_disable_device (pdev); -return ret; +return ret; + +pci_set_drvdata (pdev, host); + +return 0 ; }static void dw_mci_pci_remove (struct pci_dev *pdev)
@@ -90,11 +75,6 @@ static void dw_mci_pci_remove(struct pci_dev *pdev)struct dw_mci *host =pci_get_drvdata (pdev);dw_mci_remove (host); -pci_set_drvdata (pdev,NULL ); -pci_release_regions (pdev); -pci_iounmap (pdev, host->regs); -kfree (host); -pci_disable_device (pdev); }#ifdef CONFIG_PM_SLEEP
Signature · 1 line
1.8.2.rc0.22.gb3600c3
PATCH 1/3 mmc: dw: don't check resource with devm_ioremap_resource
devm_ioremap_resource does sanity checks on the given resource. No need to duplicate this in the driver.
--- drivers/mmc/host/dw_mmc-pltfm.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/mmc/host/dw_mmc-pltfm.c +3 -5
@@ -25,7 +25,7 @@#include "dw_mmc.h" int dw_mci_pltfm_register (struct platform_device *pdev, -const struct dw_mci_drv_data *drv_data) +const struct dw_mci_drv_data *drv_data) {struct dw_mci *host;struct resource *regs;
@@ -35,10 +35,6 @@ int dw_mci_pltfm_register(struct platform_device *pdev,if (!host)return -ENOMEM ; - regs =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (!regs) -return -ENXIO ; - host->irq =platform_get_irq (pdev,0 );if (host->irq <0 )return host->irq;
@@ -47,6 +43,8 @@ int dw_mci_pltfm_register(struct platform_device *pdev, host->dev = &pdev->dev; host->irq_flags =0 ; host->pdata = pdev->dev.platform_data; + + regs =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); host->regs =devm_ioremap_resource (&pdev->dev, regs);if (IS_ERR (host->regs))return PTR_ERR (host->regs);
Signature · 1 line
1.8.2.rc0.22.gb3600c3
Quoted 4 lines · Andy Shevchenko
devm_ioremap_resourcedoes sanity checks on the given resource. No need to duplicate this in the driver.Signed-off-by Andy Shevchenko <[email protected]>
Looks good to me.
'dw_mmc'(instead of 'dw') as a prefix of subject is expected with other patches, though. Specially, dw_mmc-pci is for PATCH 3/3.
RE: [PATCH 2/3] mmc: dw: eliminate useless usage of ret
In reply to Andy ShevchenkoQuoted 4 lines · Andy Shevchenko
In few places usage of ret variable is not needed. This patch simplifies that pieces of code.
Signed-off-by Andy Shevchenko <[email protected]>
RE: [PATCH 3/3] mmc: dw: convert to use pcim_* and devm_*
In reply to Andy ShevchenkoQuoted 4 lines · Andy Shevchenko
The PCI driver is getting simplier and tidier with pcim_* and devm_* functions in use.
Signed-off-by Andy Shevchenko <[email protected]>
Quoted 9 lines · Seungwon Jeon
Quoted 4 lines · Andy Shevchenko
devm_ioremap_resourcedoes sanity checks on the given resource. No need to duplicate this in the driver.Signed-off-by Andy Shevchenko <[email protected]>Looks good to me.
'dw_mmc'(instead of 'dw') as a prefix of subject is expected with other patches, though. Specially, dw_mmc-pci is for PATCH 3/3.
Shall I resubmit patches?
I think no-one can mess up with this, because we fortunately have only one mmc designware driver there.
Quoted 1 line
Acked-by Seungwon Jeon <[email protected]>
Thanks for review.
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Hi Andy,
Quoted 7 lines · Andy Shevchenko
Quoted 6 lines · Seungwon Jeon
Quoted 4 lines · Andy Shevchenko
devm_ioremap_resourcedoes sanity checks on the given resource. No need to duplicate this in the driver.Signed-off-by Andy Shevchenko <[email protected]>
Quoted 7 lines
Quoted 3 lines
Looks good to me.
'dw_mmc'(instead of 'dw') as a prefix of subject is expected with other patches, though. Specially, dw_mmc-pci is for PATCH 3/3.Shall I resubmit patches?
I think no-one can mess up with this, because we fortunately have only one mmc designware driver there.
Thanks, I pushed all three patches to mmc-next for 3.11 and corrected the titles.
- Chris.
Signature · 2 lines
Chris Ball <[email protected]> <http://printf.net/> One Laptop Per Child