Commit 57691a1e authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: ads7846 - make sure we do not change platform data

Let's declare platform data a const pointer so that we don't accitentally
change it. Also fetch it with dev_get_platdata().
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 67bf12ca
...@@ -961,9 +961,9 @@ static int ads7846_resume(struct device *dev) ...@@ -961,9 +961,9 @@ static int ads7846_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(ads7846_pm, ads7846_suspend, ads7846_resume); static SIMPLE_DEV_PM_OPS(ads7846_pm, ads7846_suspend, ads7846_resume);
static int ads7846_setup_pendown(struct spi_device *spi, static int ads7846_setup_pendown(struct spi_device *spi,
struct ads7846 *ts) struct ads7846 *ts,
const struct ads7846_platform_data *pdata)
{ {
struct ads7846_platform_data *pdata = spi->dev.platform_data;
int err; int err;
/* /*
...@@ -1003,7 +1003,7 @@ static int ads7846_setup_pendown(struct spi_device *spi, ...@@ -1003,7 +1003,7 @@ static int ads7846_setup_pendown(struct spi_device *spi,
* use formula #2 for pressure, not #3. * use formula #2 for pressure, not #3.
*/ */
static void ads7846_setup_spi_msg(struct ads7846 *ts, static void ads7846_setup_spi_msg(struct ads7846 *ts,
const struct ads7846_platform_data *pdata) const struct ads7846_platform_data *pdata)
{ {
struct spi_message *m = &ts->msg[0]; struct spi_message *m = &ts->msg[0];
struct spi_transfer *x = ts->xfer; struct spi_transfer *x = ts->xfer;
...@@ -1203,10 +1203,10 @@ static void ads7846_setup_spi_msg(struct ads7846 *ts, ...@@ -1203,10 +1203,10 @@ static void ads7846_setup_spi_msg(struct ads7846 *ts,
static int ads7846_probe(struct spi_device *spi) static int ads7846_probe(struct spi_device *spi)
{ {
const struct ads7846_platform_data *pdata = dev_get_platdata(&spi->dev);
struct ads7846 *ts; struct ads7846 *ts;
struct ads7846_packet *packet; struct ads7846_packet *packet;
struct input_dev *input_dev; struct input_dev *input_dev;
struct ads7846_platform_data *pdata = spi->dev.platform_data;
unsigned long irq_flags; unsigned long irq_flags;
int err; int err;
...@@ -1281,7 +1281,7 @@ static int ads7846_probe(struct spi_device *spi) ...@@ -1281,7 +1281,7 @@ static int ads7846_probe(struct spi_device *spi)
ts->filter = ads7846_no_filter; ts->filter = ads7846_no_filter;
} }
err = ads7846_setup_pendown(spi, ts); err = ads7846_setup_pendown(spi, ts, pdata);
if (err) if (err)
goto err_cleanup_filter; goto err_cleanup_filter;
......
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