aboutsummaryrefslogtreecommitdiff
path: root/drivers/mfd/pcf50633-adc.c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2010-05-24 23:37:19 +0200
committerLars-Peter Clausen <lars@metafoo.de>2010-06-08 15:37:09 +0200
commit4a29094bdf6ff382b7558e242ddb91c67fc200c7 (patch)
treea6956e158bdcf88c2b916e2f383a810f81acef86 /drivers/mfd/pcf50633-adc.c
parent7c3f9799aa31d974507bf73e8c29172ecc672ecf (diff)
MFD: pcf50633: Use mfd cells to register child devices
This patch changes the pcf50633 core code to use mfd cells to register child devices instead of calling platform_device_{alloc,add} for each child. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Diffstat (limited to 'drivers/mfd/pcf50633-adc.c')
-rw-r--r--drivers/mfd/pcf50633-adc.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/mfd/pcf50633-adc.c b/drivers/mfd/pcf50633-adc.c
index aed0d2a9b03..bf77c8f9f6a 100644
--- a/drivers/mfd/pcf50633-adc.c
+++ b/drivers/mfd/pcf50633-adc.c
@@ -51,11 +51,6 @@ struct pcf50633_adc {
struct mutex queue_mutex;
};
-static inline struct pcf50633_adc *__to_adc(struct pcf50633 *pcf)
-{
- return platform_get_drvdata(pcf->adc_pdev);
-}
-
static void adc_setup(struct pcf50633 *pcf, int channel, int avg)
{
channel &= PCF50633_ADCC1_ADCMUX_MASK;
@@ -71,7 +66,7 @@ static void adc_setup(struct pcf50633 *pcf, int channel, int avg)
static void trigger_next_adc_job_if_any(struct pcf50633 *pcf)
{
- struct pcf50633_adc *adc = __to_adc(pcf);
+ struct pcf50633_adc *adc = pcf->adc;
int head;
head = adc->queue_head;
@@ -85,7 +80,7 @@ static void trigger_next_adc_job_if_any(struct pcf50633 *pcf)
static int
adc_enqueue_request(struct pcf50633 *pcf, struct pcf50633_adc_request *req)
{
- struct pcf50633_adc *adc = __to_adc(pcf);
+ struct pcf50633_adc *adc = pcf->adc;
int head, tail;
mutex_lock(&adc->queue_mutex);
@@ -201,13 +196,14 @@ static void pcf50633_adc_irq(int irq, void *data)
static int __devinit pcf50633_adc_probe(struct platform_device *pdev)
{
+ struct pcf50633 *pcf = dev_to_pcf50633(pdev->dev.parent);
struct pcf50633_adc *adc;
adc = kzalloc(sizeof(*adc), GFP_KERNEL);
if (!adc)
return -ENOMEM;
- adc->pcf = dev_to_pcf50633(pdev->dev.parent);
+ adc->pcf = pcf;
platform_set_drvdata(pdev, adc);
pcf50633_register_irq(adc->pcf, PCF50633_IRQ_ADCRDY,
@@ -215,6 +211,8 @@ static int __devinit pcf50633_adc_probe(struct platform_device *pdev)
mutex_init(&adc->queue_mutex);
+ pcf->adc = adc;
+
return 0;
}
@@ -223,6 +221,8 @@ static int __devexit pcf50633_adc_remove(struct platform_device *pdev)
struct pcf50633_adc *adc = platform_get_drvdata(pdev);
int i, head;
+ adc->pcf->adc = NULL;
+
pcf50633_free_irq(adc->pcf, PCF50633_IRQ_ADCRDY);
mutex_lock(&adc->queue_mutex);