Skip to content

Commit

Permalink
Input: use dev_get_platdata()
Browse files Browse the repository at this point in the history
Use the wrapper function for retrieving the platform data instead
of accessing dev->platform_data directly. This is a cosmetic change
to make the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
Jingoo Han authored and Dmitry Torokhov committed Dec 6, 2013
1 parent 54f05e9 commit c838cb3
Show file tree
Hide file tree
Showing 51 changed files with 79 additions and 67 deletions.
2 changes: 1 addition & 1 deletion drivers/input/keyboard/adp5520-keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static int adp5520_keys_notifier(struct notifier_block *nb,

static int adp5520_keys_probe(struct platform_device *pdev)
{
struct adp5520_keys_platform_data *pdata = pdev->dev.platform_data;
struct adp5520_keys_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct input_dev *input;
struct adp5520_keys *dev;
int ret, i;
Expand Down
10 changes: 6 additions & 4 deletions drivers/input/keyboard/adp5588-keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static int adp5588_build_gpiomap(struct adp5588_kpad *kpad,
static int adp5588_gpio_add(struct adp5588_kpad *kpad)
{
struct device *dev = &kpad->client->dev;
const struct adp5588_kpad_platform_data *pdata = dev->platform_data;
const struct adp5588_kpad_platform_data *pdata = dev_get_platdata(dev);
const struct adp5588_gpio_platform_data *gpio_data = pdata->gpio_data;
int i, error;

Expand Down Expand Up @@ -227,7 +227,7 @@ static int adp5588_gpio_add(struct adp5588_kpad *kpad)
static void adp5588_gpio_remove(struct adp5588_kpad *kpad)
{
struct device *dev = &kpad->client->dev;
const struct adp5588_kpad_platform_data *pdata = dev->platform_data;
const struct adp5588_kpad_platform_data *pdata = dev_get_platdata(dev);
const struct adp5588_gpio_platform_data *gpio_data = pdata->gpio_data;
int error;

Expand Down Expand Up @@ -321,7 +321,8 @@ static irqreturn_t adp5588_irq(int irq, void *handle)

static int adp5588_setup(struct i2c_client *client)
{
const struct adp5588_kpad_platform_data *pdata = client->dev.platform_data;
const struct adp5588_kpad_platform_data *pdata =
dev_get_platdata(&client->dev);
const struct adp5588_gpio_platform_data *gpio_data = pdata->gpio_data;
int i, ret;
unsigned char evt_mode1 = 0, evt_mode2 = 0, evt_mode3 = 0;
Expand Down Expand Up @@ -424,7 +425,8 @@ static int adp5588_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct adp5588_kpad *kpad;
const struct adp5588_kpad_platform_data *pdata = client->dev.platform_data;
const struct adp5588_kpad_platform_data *pdata =
dev_get_platdata(&client->dev);
struct input_dev *input;
unsigned int revid;
int ret, i;
Expand Down
8 changes: 4 additions & 4 deletions drivers/input/keyboard/adp5589-keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ static int adp5589_build_gpiomap(struct adp5589_kpad *kpad,
static int adp5589_gpio_add(struct adp5589_kpad *kpad)
{
struct device *dev = &kpad->client->dev;
const struct adp5589_kpad_platform_data *pdata = dev->platform_data;
const struct adp5589_kpad_platform_data *pdata = dev_get_platdata(dev);
const struct adp5589_gpio_platform_data *gpio_data = pdata->gpio_data;
int i, error;

Expand Down Expand Up @@ -553,7 +553,7 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad)
static void adp5589_gpio_remove(struct adp5589_kpad *kpad)
{
struct device *dev = &kpad->client->dev;
const struct adp5589_kpad_platform_data *pdata = dev->platform_data;
const struct adp5589_kpad_platform_data *pdata = dev_get_platdata(dev);
const struct adp5589_gpio_platform_data *gpio_data = pdata->gpio_data;
int error;

Expand Down Expand Up @@ -658,7 +658,7 @@ static int adp5589_setup(struct adp5589_kpad *kpad)
{
struct i2c_client *client = kpad->client;
const struct adp5589_kpad_platform_data *pdata =
client->dev.platform_data;
dev_get_platdata(&client->dev);
u8 (*reg) (u8) = kpad->var->reg;
unsigned char evt_mode1 = 0, evt_mode2 = 0, evt_mode3 = 0;
unsigned char pull_mask = 0;
Expand Down Expand Up @@ -864,7 +864,7 @@ static int adp5589_probe(struct i2c_client *client,
{
struct adp5589_kpad *kpad;
const struct adp5589_kpad_platform_data *pdata =
client->dev.platform_data;
dev_get_platdata(&client->dev);
struct input_dev *input;
unsigned int revid;
int ret, i;
Expand Down
4 changes: 2 additions & 2 deletions drivers/input/keyboard/bf54x-keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ static irqreturn_t bfin_kpad_isr(int irq, void *dev_id)
static int bfin_kpad_probe(struct platform_device *pdev)
{
struct bf54x_kpad *bf54x_kpad;
struct bfin_kpad_platform_data *pdata = pdev->dev.platform_data;
struct bfin_kpad_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct input_dev *input;
int i, error;

Expand Down Expand Up @@ -332,7 +332,7 @@ static int bfin_kpad_probe(struct platform_device *pdev)

static int bfin_kpad_remove(struct platform_device *pdev)
{
struct bfin_kpad_platform_data *pdata = pdev->dev.platform_data;
struct bfin_kpad_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev);

del_timer_sync(&bf54x_kpad->timer);
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/keyboard/davinci_keyscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ static int __init davinci_ks_probe(struct platform_device *pdev)
struct input_dev *key_dev;
struct resource *res, *mem;
struct device *dev = &pdev->dev;
struct davinci_ks_platform_data *pdata = pdev->dev.platform_data;
struct davinci_ks_platform_data *pdata = dev_get_platdata(&pdev->dev);
int error, i;

if (pdata->device_enable) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/keyboard/ep93xx_keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ static int ep93xx_keypad_probe(struct platform_device *pdev)
if (!keypad)
return -ENOMEM;

keypad->pdata = pdev->dev.platform_data;
keypad->pdata = dev_get_platdata(&pdev->dev);
if (!keypad->pdata) {
err = -EINVAL;
goto failed_free;
Expand Down
3 changes: 2 additions & 1 deletion drivers/input/keyboard/imx_keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,8 @@ MODULE_DEVICE_TABLE(of, imx_keypad_of_match);

static int imx_keypad_probe(struct platform_device *pdev)
{
const struct matrix_keymap_data *keymap_data = pdev->dev.platform_data;
const struct matrix_keymap_data *keymap_data =
dev_get_platdata(&pdev->dev);
struct imx_keypad *keypad;
struct input_dev *input_dev;
struct resource *res;
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/keyboard/lm8323.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ static DEVICE_ATTR(disable_kp, 0644, lm8323_show_disable, lm8323_set_disable);
static int lm8323_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct lm8323_platform_data *pdata = client->dev.platform_data;
struct lm8323_platform_data *pdata = dev_get_platdata(&client->dev);
struct input_dev *idev;
struct lm8323_chip *lm;
int pwm;
Expand Down
3 changes: 2 additions & 1 deletion drivers/input/keyboard/lm8333.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ static irqreturn_t lm8333_irq_thread(int irq, void *data)
static int lm8333_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
const struct lm8333_platform_data *pdata = client->dev.platform_data;
const struct lm8333_platform_data *pdata =
dev_get_platdata(&client->dev);
struct lm8333 *lm8333;
struct input_dev *input;
int err, active_time;
Expand Down
3 changes: 2 additions & 1 deletion drivers/input/keyboard/max7359_keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ static void max7359_initialize(struct i2c_client *client)
static int max7359_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
const struct matrix_keymap_data *keymap_data = client->dev.platform_data;
const struct matrix_keymap_data *keymap_data =
dev_get_platdata(&client->dev);
struct max7359_keypad *keypad;
struct input_dev *input_dev;
int ret;
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/keyboard/mcs_touchkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ static int mcs_touchkey_probe(struct i2c_client *client,
int error;
int i;

pdata = client->dev.platform_data;
pdata = dev_get_platdata(&client->dev);
if (!pdata) {
dev_err(&client->dev, "no platform data defined\n");
return -EINVAL;
Expand Down
3 changes: 2 additions & 1 deletion drivers/input/keyboard/mpr121_touchkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ static int mpr121_phys_init(const struct mpr121_platform_data *pdata,
static int mpr_touchkey_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
const struct mpr121_platform_data *pdata = client->dev.platform_data;
const struct mpr121_platform_data *pdata =
dev_get_platdata(&client->dev);
struct mpr121_touchkey *mpr121;
struct input_dev *input_dev;
int error;
Expand Down
3 changes: 2 additions & 1 deletion drivers/input/keyboard/nomadik-ske-keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ static irqreturn_t ske_keypad_irq(int irq, void *dev_id)

static int __init ske_keypad_probe(struct platform_device *pdev)
{
const struct ske_keypad_platform_data *plat = pdev->dev.platform_data;
const struct ske_keypad_platform_data *plat =
dev_get_platdata(&pdev->dev);
struct ske_keypad *keypad;
struct input_dev *input;
struct resource *res;
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/keyboard/omap-keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ static int omap_kp_probe(struct platform_device *pdev)
{
struct omap_kp *omap_kp;
struct input_dev *input_dev;
struct omap_kp_platform_data *pdata = pdev->dev.platform_data;
struct omap_kp_platform_data *pdata = dev_get_platdata(&pdev->dev);
int i, col_idx, row_idx, ret;
unsigned int row_shift, keycodemax;

Expand Down
3 changes: 2 additions & 1 deletion drivers/input/keyboard/pxa930_rotary.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ static void pxa930_rotary_close(struct input_dev *dev)

static int pxa930_rotary_probe(struct platform_device *pdev)
{
struct pxa930_rotary_platform_data *pdata = pdev->dev.platform_data;
struct pxa930_rotary_platform_data *pdata =
dev_get_platdata(&pdev->dev);
struct pxa930_rotary *r;
struct input_dev *input_dev;
struct resource *res;
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/keyboard/samsung-keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ static int samsung_keypad_probe(struct platform_device *pdev)
if (pdev->dev.of_node)
pdata = samsung_keypad_parse_dt(&pdev->dev);
else
pdata = pdev->dev.platform_data;
pdata = dev_get_platdata(&pdev->dev);
if (!pdata) {
dev_err(&pdev->dev, "no platform data defined\n");
return -EINVAL;
Expand Down
4 changes: 2 additions & 2 deletions drivers/input/keyboard/sh_keysc.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ static int sh_keysc_probe(struct platform_device *pdev)
int i;
int irq, error;

if (!pdev->dev.platform_data) {
if (!dev_get_platdata(&pdev->dev)) {
dev_err(&pdev->dev, "no platform data defined\n");
error = -EINVAL;
goto err0;
Expand All @@ -198,7 +198,7 @@ static int sh_keysc_probe(struct platform_device *pdev)
}

platform_set_drvdata(pdev, priv);
memcpy(&priv->pdata, pdev->dev.platform_data, sizeof(priv->pdata));
memcpy(&priv->pdata, dev_get_platdata(&pdev->dev), sizeof(priv->pdata));
pdata = &priv->pdata;

priv->iomem_base = ioremap_nocache(res->start, resource_size(res));
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/keyboard/tca6416-keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ static int tca6416_keypad_probe(struct i2c_client *client,
return -ENODEV;
}

pdata = client->dev.platform_data;
pdata = dev_get_platdata(&client->dev);
if (!pdata) {
dev_dbg(&client->dev, "no platform data\n");
return -EINVAL;
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/keyboard/tnetv107x-keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ static int keypad_probe(struct platform_device *pdev)
int error = 0, sz, row_shift;
u32 rev = 0;

pdata = pdev->dev.platform_data;
pdata = dev_get_platdata(&pdev->dev);
if (!pdata) {
dev_err(dev, "cannot find device data\n");
return -EINVAL;
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/keyboard/twl4030_keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ static int twl4030_kp_program(struct twl4030_keypad *kp)
*/
static int twl4030_kp_probe(struct platform_device *pdev)
{
struct twl4030_keypad_data *pdata = pdev->dev.platform_data;
struct twl4030_keypad_data *pdata = dev_get_platdata(&pdev->dev);
const struct matrix_keymap_data *keymap_data;
struct twl4030_keypad *kp;
struct input_dev *input;
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/keyboard/w90p910_keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ static void w90p910_keypad_close(struct input_dev *dev)
static int w90p910_keypad_probe(struct platform_device *pdev)
{
const struct w90p910_keypad_platform_data *pdata =
pdev->dev.platform_data;
dev_get_platdata(&pdev->dev);
const struct matrix_keymap_data *keymap_data;
struct w90p910_keypad *keypad;
struct input_dev *input_dev;
Expand Down
4 changes: 2 additions & 2 deletions drivers/input/misc/ad714x.c
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq,
int error;
struct input_dev *input[MAX_DEVICE_NUM];

struct ad714x_platform_data *plat_data = dev->platform_data;
struct ad714x_platform_data *plat_data = dev_get_platdata(dev);
struct ad714x_chip *ad714x;
void *drv_mem;
unsigned long irqflags;
Expand All @@ -986,7 +986,7 @@ struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq,
goto err_out;
}

if (dev->platform_data == NULL) {
if (dev_get_platdata(dev) == NULL) {
dev_err(dev, "platform data for ad714x doesn't exist\n");
error = -EINVAL;
goto err_out;
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/misc/adxl34x.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,

ac->fifo_delay = fifo_delay_default;

pdata = dev->platform_data;
pdata = dev_get_platdata(dev);
if (!pdata) {
dev_dbg(dev,
"No platform data: Using default initialization\n");
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/misc/bfin_rotary.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static irqreturn_t bfin_rotary_isr(int irq, void *dev_id)

static int bfin_rotary_probe(struct platform_device *pdev)
{
struct bfin_rotary_platform_data *pdata = pdev->dev.platform_data;
struct bfin_rotary_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct bfin_rot *rotary;
struct input_dev *input;
int error;
Expand Down
3 changes: 2 additions & 1 deletion drivers/input/misc/bma150.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,8 @@ static int bma150_register_polled_device(struct bma150_data *bma150)
static int bma150_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
const struct bma150_platform_data *pdata = client->dev.platform_data;
const struct bma150_platform_data *pdata =
dev_get_platdata(&client->dev);
const struct bma150_cfg *cfg;
struct bma150_data *bma150;
int chip_id;
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/misc/cma3000_d0x.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ EXPORT_SYMBOL(cma3000_resume);
struct cma3000_accl_data *cma3000_init(struct device *dev, int irq,
const struct cma3000_bus_ops *bops)
{
const struct cma3000_platform_data *pdata = dev->platform_data;
const struct cma3000_platform_data *pdata = dev_get_platdata(dev);
struct cma3000_accl_data *data;
struct input_dev *input_dev;
int rev;
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/misc/gp2ap002a00f.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ static int gp2a_initialize(struct gp2a_data *dt)
static int gp2a_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
const struct gp2a_platform_data *pdata = client->dev.platform_data;
const struct gp2a_platform_data *pdata = dev_get_platdata(&client->dev);
struct gp2a_data *dt;
int error;

Expand Down
3 changes: 2 additions & 1 deletion drivers/input/misc/gpio_tilt_polled.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ static void gpio_tilt_polled_close(struct input_polled_dev *dev)

static int gpio_tilt_polled_probe(struct platform_device *pdev)
{
const struct gpio_tilt_platform_data *pdata = pdev->dev.platform_data;
const struct gpio_tilt_platform_data *pdata =
dev_get_platdata(&pdev->dev);
struct device *dev = &pdev->dev;
struct gpio_tilt_polled_dev *tdev;
struct input_polled_dev *poll_dev;
Expand Down
3 changes: 2 additions & 1 deletion drivers/input/misc/kxtj9.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,8 @@ static int kxtj9_verify(struct kxtj9_data *tj9)
static int kxtj9_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
const struct kxtj9_platform_data *pdata = client->dev.platform_data;
const struct kxtj9_platform_data *pdata =
dev_get_platdata(&client->dev);
struct kxtj9_data *tj9;
int err;

Expand Down
2 changes: 1 addition & 1 deletion drivers/input/misc/pwm-beeper.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static int pwm_beeper_event(struct input_dev *input,

static int pwm_beeper_probe(struct platform_device *pdev)
{
unsigned long pwm_id = (unsigned long)pdev->dev.platform_data;
unsigned long pwm_id = (unsigned long)dev_get_platdata(&pdev->dev);
struct pwm_beeper *beeper;
int error;

Expand Down
2 changes: 1 addition & 1 deletion drivers/input/misc/twl4030-vibra.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ static bool twl4030_vibra_check_coexist(struct twl4030_vibra_data *pdata,

static int twl4030_vibra_probe(struct platform_device *pdev)
{
struct twl4030_vibra_data *pdata = pdev->dev.platform_data;
struct twl4030_vibra_data *pdata = dev_get_platdata(&pdev->dev);
struct device_node *twl4030_core_node = pdev->dev.parent->of_node;
struct vibra_info *info;
int ret;
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/mouse/gpio_mouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static void gpio_mouse_scan(struct input_polled_dev *dev)

static int gpio_mouse_probe(struct platform_device *pdev)
{
struct gpio_mouse_platform_data *pdata = pdev->dev.platform_data;
struct gpio_mouse_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct input_polled_dev *input_poll;
struct input_dev *input;
int pin, i;
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/mouse/pxa930_trkball.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ static int pxa930_trkball_probe(struct platform_device *pdev)
if (!trkball)
return -ENOMEM;

trkball->pdata = pdev->dev.platform_data;
trkball->pdata = dev_get_platdata(&pdev->dev);
if (!trkball->pdata) {
dev_err(&pdev->dev, "no platform data defined\n");
error = -EINVAL;
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/touchscreen/88pm860x-ts.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ static int pm860x_touch_dt_init(struct platform_device *pdev,
static int pm860x_touch_probe(struct platform_device *pdev)
{
struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent);
struct pm860x_touch_pdata *pdata = pdev->dev.platform_data;
struct pm860x_touch_pdata *pdata = dev_get_platdata(&pdev->dev);
struct pm860x_touch *touch;
struct i2c_client *i2c = (chip->id == CHIP_PM8607) ? chip->client \
: chip->companion;
Expand Down
Loading

0 comments on commit c838cb3

Please sign in to comment.