aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/mc13xxx-spi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/mc13xxx-spi.c')
-rw-r--r--drivers/mfd/mc13xxx-spi.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c
index 5f14ef6693c2..38ab67829791 100644
--- a/drivers/mfd/mc13xxx-spi.c
+++ b/drivers/mfd/mc13xxx-spi.c
@@ -13,7 +13,6 @@
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/mutex.h>
17#include <linux/interrupt.h> 16#include <linux/interrupt.h>
18#include <linux/mfd/core.h> 17#include <linux/mfd/core.h>
19#include <linux/mfd/mc13xxx.h> 18#include <linux/mfd/mc13xxx.h>
@@ -129,27 +128,24 @@ static struct regmap_bus regmap_mc13xxx_bus = {
129static int mc13xxx_spi_probe(struct spi_device *spi) 128static int mc13xxx_spi_probe(struct spi_device *spi)
130{ 129{
131 struct mc13xxx *mc13xxx; 130 struct mc13xxx *mc13xxx;
132 struct mc13xxx_platform_data *pdata = dev_get_platdata(&spi->dev);
133 int ret; 131 int ret;
134 132
135 mc13xxx = devm_kzalloc(&spi->dev, sizeof(*mc13xxx), GFP_KERNEL); 133 mc13xxx = devm_kzalloc(&spi->dev, sizeof(*mc13xxx), GFP_KERNEL);
136 if (!mc13xxx) 134 if (!mc13xxx)
137 return -ENOMEM; 135 return -ENOMEM;
138 136
139 spi_set_drvdata(spi, mc13xxx); 137 dev_set_drvdata(&spi->dev, mc13xxx);
138
140 spi->mode = SPI_MODE_0 | SPI_CS_HIGH; 139 spi->mode = SPI_MODE_0 | SPI_CS_HIGH;
141 140
142 mc13xxx->dev = &spi->dev; 141 mc13xxx->irq = spi->irq;
143 mutex_init(&mc13xxx->lock);
144 142
145 mc13xxx->regmap = devm_regmap_init(&spi->dev, &regmap_mc13xxx_bus, 143 mc13xxx->regmap = devm_regmap_init(&spi->dev, &regmap_mc13xxx_bus,
146 &spi->dev, 144 &spi->dev,
147 &mc13xxx_regmap_spi_config); 145 &mc13xxx_regmap_spi_config);
148 if (IS_ERR(mc13xxx->regmap)) { 146 if (IS_ERR(mc13xxx->regmap)) {
149 ret = PTR_ERR(mc13xxx->regmap); 147 ret = PTR_ERR(mc13xxx->regmap);
150 dev_err(mc13xxx->dev, "Failed to initialize register map: %d\n", 148 dev_err(&spi->dev, "Failed to initialize regmap: %d\n", ret);
151 ret);
152 spi_set_drvdata(spi, NULL);
153 return ret; 149 return ret;
154 } 150 }
155 151
@@ -164,16 +160,12 @@ static int mc13xxx_spi_probe(struct spi_device *spi)
164 mc13xxx->variant = (void *)id_entry->driver_data; 160 mc13xxx->variant = (void *)id_entry->driver_data;
165 } 161 }
166 162
167 return mc13xxx_common_init(mc13xxx, pdata, spi->irq); 163 return mc13xxx_common_init(&spi->dev);
168} 164}
169 165
170static int mc13xxx_spi_remove(struct spi_device *spi) 166static int mc13xxx_spi_remove(struct spi_device *spi)
171{ 167{
172 struct mc13xxx *mc13xxx = spi_get_drvdata(spi); 168 return mc13xxx_common_exit(&spi->dev);
173
174 mc13xxx_common_cleanup(mc13xxx);
175
176 return 0;
177} 169}
178 170
179static struct spi_driver mc13xxx_spi_driver = { 171static struct spi_driver mc13xxx_spi_driver = {