diff options
author | MyungJoo Ham <myungjoo.ham@samsung.com> | 2011-06-29 21:09:40 -0400 |
---|---|---|
committer | Anton Vorontsov <cbouatmailru@gmail.com> | 2011-07-08 09:01:57 -0400 |
commit | 464f29a21792e0e506d936d147beea72a5f8e904 (patch) | |
tree | b70a0029f91f7dfef842d392a56c0b0ce0ac47dd /drivers/power/max8903_charger.c | |
parent | bb4ce9708785f40849f1a64931e6cc3b26171201 (diff) |
max8903_charger: Allow platform data to be __initdata
Platform files may have declared 8903 platform data as __initdata. This
patch removes the dependency on pdata pointer so that using __initdata
on pdata will not incur errors. Note that such error does not incur
SECTION MISMATCH warning in (at least some) compilers.
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Diffstat (limited to 'drivers/power/max8903_charger.c')
-rw-r--r-- | drivers/power/max8903_charger.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/power/max8903_charger.c b/drivers/power/max8903_charger.c index 33ff0e37809e..a9b0209a2f55 100644 --- a/drivers/power/max8903_charger.c +++ b/drivers/power/max8903_charger.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <linux/power/max8903_charger.h> | 28 | #include <linux/power/max8903_charger.h> |
29 | 29 | ||
30 | struct max8903_data { | 30 | struct max8903_data { |
31 | struct max8903_pdata *pdata; | 31 | struct max8903_pdata pdata; |
32 | struct device *dev; | 32 | struct device *dev; |
33 | struct power_supply psy; | 33 | struct power_supply psy; |
34 | bool fault; | 34 | bool fault; |
@@ -52,8 +52,8 @@ static int max8903_get_property(struct power_supply *psy, | |||
52 | switch (psp) { | 52 | switch (psp) { |
53 | case POWER_SUPPLY_PROP_STATUS: | 53 | case POWER_SUPPLY_PROP_STATUS: |
54 | val->intval = POWER_SUPPLY_STATUS_UNKNOWN; | 54 | val->intval = POWER_SUPPLY_STATUS_UNKNOWN; |
55 | if (data->pdata->chg) { | 55 | if (data->pdata.chg) { |
56 | if (gpio_get_value(data->pdata->chg) == 0) | 56 | if (gpio_get_value(data->pdata.chg) == 0) |
57 | val->intval = POWER_SUPPLY_STATUS_CHARGING; | 57 | val->intval = POWER_SUPPLY_STATUS_CHARGING; |
58 | else if (data->usb_in || data->ta_in) | 58 | else if (data->usb_in || data->ta_in) |
59 | val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; | 59 | val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; |
@@ -80,7 +80,7 @@ static int max8903_get_property(struct power_supply *psy, | |||
80 | static irqreturn_t max8903_dcin(int irq, void *_data) | 80 | static irqreturn_t max8903_dcin(int irq, void *_data) |
81 | { | 81 | { |
82 | struct max8903_data *data = _data; | 82 | struct max8903_data *data = _data; |
83 | struct max8903_pdata *pdata = data->pdata; | 83 | struct max8903_pdata *pdata = &data->pdata; |
84 | bool ta_in; | 84 | bool ta_in; |
85 | enum power_supply_type old_type; | 85 | enum power_supply_type old_type; |
86 | 86 | ||
@@ -121,7 +121,7 @@ static irqreturn_t max8903_dcin(int irq, void *_data) | |||
121 | static irqreturn_t max8903_usbin(int irq, void *_data) | 121 | static irqreturn_t max8903_usbin(int irq, void *_data) |
122 | { | 122 | { |
123 | struct max8903_data *data = _data; | 123 | struct max8903_data *data = _data; |
124 | struct max8903_pdata *pdata = data->pdata; | 124 | struct max8903_pdata *pdata = &data->pdata; |
125 | bool usb_in; | 125 | bool usb_in; |
126 | enum power_supply_type old_type; | 126 | enum power_supply_type old_type; |
127 | 127 | ||
@@ -160,7 +160,7 @@ static irqreturn_t max8903_usbin(int irq, void *_data) | |||
160 | static irqreturn_t max8903_fault(int irq, void *_data) | 160 | static irqreturn_t max8903_fault(int irq, void *_data) |
161 | { | 161 | { |
162 | struct max8903_data *data = _data; | 162 | struct max8903_data *data = _data; |
163 | struct max8903_pdata *pdata = data->pdata; | 163 | struct max8903_pdata *pdata = &data->pdata; |
164 | bool fault; | 164 | bool fault; |
165 | 165 | ||
166 | fault = gpio_get_value(pdata->flt) ? false : true; | 166 | fault = gpio_get_value(pdata->flt) ? false : true; |
@@ -193,7 +193,7 @@ static __devinit int max8903_probe(struct platform_device *pdev) | |||
193 | dev_err(dev, "Cannot allocate memory.\n"); | 193 | dev_err(dev, "Cannot allocate memory.\n"); |
194 | return -ENOMEM; | 194 | return -ENOMEM; |
195 | } | 195 | } |
196 | data->pdata = pdata; | 196 | memcpy(&data->pdata, pdata, sizeof(struct max8903_pdata)); |
197 | data->dev = dev; | 197 | data->dev = dev; |
198 | platform_set_drvdata(pdev, data); | 198 | platform_set_drvdata(pdev, data); |
199 | 199 | ||
@@ -349,7 +349,7 @@ static __devexit int max8903_remove(struct platform_device *pdev) | |||
349 | struct max8903_data *data = platform_get_drvdata(pdev); | 349 | struct max8903_data *data = platform_get_drvdata(pdev); |
350 | 350 | ||
351 | if (data) { | 351 | if (data) { |
352 | struct max8903_pdata *pdata = data->pdata; | 352 | struct max8903_pdata *pdata = &data->pdata; |
353 | 353 | ||
354 | if (pdata->flt) | 354 | if (pdata->flt) |
355 | free_irq(gpio_to_irq(pdata->flt), data); | 355 | free_irq(gpio_to_irq(pdata->flt), data); |