]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge branch 'spi' of git://gitorious.org/linus-tree/linus-tree into spi/next
authorGrant Likely <grant.likely@secretlab.ca>
Tue, 20 Mar 2012 16:19:49 +0000 (16:19 +0000)
committerGrant Likely <grant.likely@secretlab.ca>
Tue, 20 Mar 2012 16:19:49 +0000 (16:19 +0000)
1  2 
drivers/spi/spi-omap2-mcspi.c

index bb9274c2526d7b109f131073a92d1d15037e2d38,cb2c0e390b1f19b45fd0674b594438704e3df1ec..33f54cd07fe00093f922383686371914a8b8521b
@@@ -1081,31 -1078,11 +1080,31 @@@ static int omap_mcspi_runtime_resume(st
        return 0;
  }
  
 +static struct omap2_mcspi_platform_config omap2_pdata = {
 +      .regs_offset = 0,
 +};
 +
 +static struct omap2_mcspi_platform_config omap4_pdata = {
 +      .regs_offset = OMAP4_MCSPI_REG_OFFSET,
 +};
 +
 +static const struct of_device_id omap_mcspi_of_match[] = {
 +      {
 +              .compatible = "ti,omap2-mcspi",
 +              .data = &omap2_pdata,
 +      },
 +      {
 +              .compatible = "ti,omap4-mcspi",
 +              .data = &omap4_pdata,
 +      },
 +      { },
 +};
 +MODULE_DEVICE_TABLE(of, omap_mcspi_of_match);
  
- static int __init omap2_mcspi_probe(struct platform_device *pdev)
+ static int __devinit omap2_mcspi_probe(struct platform_device *pdev)
  {
        struct spi_master       *master;
 -      struct omap2_mcspi_platform_config *pdata = pdev->dev.platform_data;
 +      struct omap2_mcspi_platform_config *pdata;
        struct omap2_mcspi      *mcspi;
        struct resource         *r;
        int                     status = 0, i;
                goto free_master;
        }
  
 -      r->start += pdata->regs_offset;
 -      r->end += pdata->regs_offset;
 +      r->start += regs_offset;
 +      r->end += regs_offset;
        mcspi->phys = r->start;
-       if (!request_mem_region(r->start, resource_size(r),
-                               dev_name(&pdev->dev))) {
-               status = -EBUSY;
-               goto free_master;
-       }
  
-       mcspi->base = ioremap(r->start, resource_size(r));
+       mcspi->base = devm_request_and_ioremap(&pdev->dev, r);
        if (!mcspi->base) {
                dev_dbg(&pdev->dev, "can't ioremap MCSPI\n");
                status = -ENOMEM;
@@@ -1324,24 -1269,11 +1308,12 @@@ static struct platform_driver omap2_mcs
        .driver = {
                .name =         "omap2_mcspi",
                .owner =        THIS_MODULE,
 -              .pm =           &omap2_mcspi_pm_ops
 +              .pm =           &omap2_mcspi_pm_ops,
 +              .of_match_table = omap_mcspi_of_match,
        },
-       .remove =       __exit_p(omap2_mcspi_remove),
+       .probe =        omap2_mcspi_probe,
+       .remove =       __devexit_p(omap2_mcspi_remove),
  };
  
- static int __init omap2_mcspi_init(void)
- {
-       return platform_driver_probe(&omap2_mcspi_driver, omap2_mcspi_probe);
- }
- subsys_initcall(omap2_mcspi_init);
- static void __exit omap2_mcspi_exit(void)
- {
-       platform_driver_unregister(&omap2_mcspi_driver);
- }
- module_exit(omap2_mcspi_exit);
+ module_platform_driver(omap2_mcspi_driver);
  MODULE_LICENSE("GPL");