Commit 464f29a2 authored by MyungJoo Ham's avatar MyungJoo Ham Committed by Anton Vorontsov

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: default avatarMyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarAnton Vorontsov <cbouatmailru@gmail.com>
parent bb4ce970
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <linux/power/max8903_charger.h> #include <linux/power/max8903_charger.h>
struct max8903_data { struct max8903_data {
struct max8903_pdata *pdata; struct max8903_pdata pdata;
struct device *dev; struct device *dev;
struct power_supply psy; struct power_supply psy;
bool fault; bool fault;
...@@ -52,8 +52,8 @@ static int max8903_get_property(struct power_supply *psy, ...@@ -52,8 +52,8 @@ static int max8903_get_property(struct power_supply *psy,
switch (psp) { switch (psp) {
case POWER_SUPPLY_PROP_STATUS: case POWER_SUPPLY_PROP_STATUS:
val->intval = POWER_SUPPLY_STATUS_UNKNOWN; val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
if (data->pdata->chg) { if (data->pdata.chg) {
if (gpio_get_value(data->pdata->chg) == 0) if (gpio_get_value(data->pdata.chg) == 0)
val->intval = POWER_SUPPLY_STATUS_CHARGING; val->intval = POWER_SUPPLY_STATUS_CHARGING;
else if (data->usb_in || data->ta_in) else if (data->usb_in || data->ta_in)
val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
...@@ -80,7 +80,7 @@ static int max8903_get_property(struct power_supply *psy, ...@@ -80,7 +80,7 @@ static int max8903_get_property(struct power_supply *psy,
static irqreturn_t max8903_dcin(int irq, void *_data) static irqreturn_t max8903_dcin(int irq, void *_data)
{ {
struct max8903_data *data = _data; struct max8903_data *data = _data;
struct max8903_pdata *pdata = data->pdata; struct max8903_pdata *pdata = &data->pdata;
bool ta_in; bool ta_in;
enum power_supply_type old_type; enum power_supply_type old_type;
...@@ -121,7 +121,7 @@ static irqreturn_t max8903_dcin(int irq, void *_data) ...@@ -121,7 +121,7 @@ static irqreturn_t max8903_dcin(int irq, void *_data)
static irqreturn_t max8903_usbin(int irq, void *_data) static irqreturn_t max8903_usbin(int irq, void *_data)
{ {
struct max8903_data *data = _data; struct max8903_data *data = _data;
struct max8903_pdata *pdata = data->pdata; struct max8903_pdata *pdata = &data->pdata;
bool usb_in; bool usb_in;
enum power_supply_type old_type; enum power_supply_type old_type;
...@@ -160,7 +160,7 @@ static irqreturn_t max8903_usbin(int irq, void *_data) ...@@ -160,7 +160,7 @@ static irqreturn_t max8903_usbin(int irq, void *_data)
static irqreturn_t max8903_fault(int irq, void *_data) static irqreturn_t max8903_fault(int irq, void *_data)
{ {
struct max8903_data *data = _data; struct max8903_data *data = _data;
struct max8903_pdata *pdata = data->pdata; struct max8903_pdata *pdata = &data->pdata;
bool fault; bool fault;
fault = gpio_get_value(pdata->flt) ? false : true; fault = gpio_get_value(pdata->flt) ? false : true;
...@@ -193,7 +193,7 @@ static __devinit int max8903_probe(struct platform_device *pdev) ...@@ -193,7 +193,7 @@ static __devinit int max8903_probe(struct platform_device *pdev)
dev_err(dev, "Cannot allocate memory.\n"); dev_err(dev, "Cannot allocate memory.\n");
return -ENOMEM; return -ENOMEM;
} }
data->pdata = pdata; memcpy(&data->pdata, pdata, sizeof(struct max8903_pdata));
data->dev = dev; data->dev = dev;
platform_set_drvdata(pdev, data); platform_set_drvdata(pdev, data);
...@@ -349,7 +349,7 @@ static __devexit int max8903_remove(struct platform_device *pdev) ...@@ -349,7 +349,7 @@ static __devexit int max8903_remove(struct platform_device *pdev)
struct max8903_data *data = platform_get_drvdata(pdev); struct max8903_data *data = platform_get_drvdata(pdev);
if (data) { if (data) {
struct max8903_pdata *pdata = data->pdata; struct max8903_pdata *pdata = &data->pdata;
if (pdata->flt) if (pdata->flt)
free_irq(gpio_to_irq(pdata->flt), data); free_irq(gpio_to_irq(pdata->flt), data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment