aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2012-08-01 01:08:49 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2012-08-22 01:29:51 -0400
commitce9195378299ff2f3d703937de46bdd338e780eb (patch)
treeb80eaee93c49bd706019e545a09f3d67d804d3cd /drivers/input
parent429a34d7477bb7071d37dd98b89f000ee6f0193b (diff)
Input: rotary-encoder - constify platform data pointers
Drivers should not be changing platform data attached to the device because they do not own it. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/misc/rotary_encoder.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c
index e261ad4e6c61..ea51265d4e04 100644
--- a/drivers/input/misc/rotary_encoder.c
+++ b/drivers/input/misc/rotary_encoder.c
@@ -29,7 +29,7 @@
29 29
30struct rotary_encoder { 30struct rotary_encoder {
31 struct input_dev *input; 31 struct input_dev *input;
32 struct rotary_encoder_platform_data *pdata; 32 const struct rotary_encoder_platform_data *pdata;
33 33
34 unsigned int axis; 34 unsigned int axis;
35 unsigned int pos; 35 unsigned int pos;
@@ -43,7 +43,7 @@ struct rotary_encoder {
43 char last_stable; 43 char last_stable;
44}; 44};
45 45
46static int rotary_encoder_get_state(struct rotary_encoder_platform_data *pdata) 46static int rotary_encoder_get_state(const struct rotary_encoder_platform_data *pdata)
47{ 47{
48 int a = !!gpio_get_value(pdata->gpio_a); 48 int a = !!gpio_get_value(pdata->gpio_a);
49 int b = !!gpio_get_value(pdata->gpio_b); 49 int b = !!gpio_get_value(pdata->gpio_b);
@@ -56,7 +56,7 @@ static int rotary_encoder_get_state(struct rotary_encoder_platform_data *pdata)
56 56
57static void rotary_encoder_report_event(struct rotary_encoder *encoder) 57static void rotary_encoder_report_event(struct rotary_encoder *encoder)
58{ 58{
59 struct rotary_encoder_platform_data *pdata = encoder->pdata; 59 const struct rotary_encoder_platform_data *pdata = encoder->pdata;
60 60
61 if (pdata->relative_axis) { 61 if (pdata->relative_axis) {
62 input_report_rel(encoder->input, 62 input_report_rel(encoder->input,
@@ -142,10 +142,10 @@ static irqreturn_t rotary_encoder_half_period_irq(int irq, void *dev_id)
142 142
143static int __devinit rotary_encoder_probe(struct platform_device *pdev) 143static int __devinit rotary_encoder_probe(struct platform_device *pdev)
144{ 144{
145 struct rotary_encoder_platform_data *pdata = pdev->dev.platform_data; 145 struct device *dev = &pdev->dev;
146 const struct rotary_encoder_platform_data *pdata = dev_get_platdata(dev);
146 struct rotary_encoder *encoder; 147 struct rotary_encoder *encoder;
147 struct input_dev *input; 148 struct input_dev *input;
148 struct device *dev = &pdev->dev;
149 irq_handler_t handler; 149 irq_handler_t handler;
150 int err; 150 int err;
151 151
@@ -247,7 +247,7 @@ exit_free_mem:
247static int __devexit rotary_encoder_remove(struct platform_device *pdev) 247static int __devexit rotary_encoder_remove(struct platform_device *pdev)
248{ 248{
249 struct rotary_encoder *encoder = platform_get_drvdata(pdev); 249 struct rotary_encoder *encoder = platform_get_drvdata(pdev);
250 struct rotary_encoder_platform_data *pdata = pdev->dev.platform_data; 250 const struct rotary_encoder_platform_data *pdata = encoder->pdata;
251 251
252 free_irq(encoder->irq_a, encoder); 252 free_irq(encoder->irq_a, encoder);
253 free_irq(encoder->irq_b, encoder); 253 free_irq(encoder->irq_b, encoder);