Thread (5 messages) 5 messages, 2 authors, 2011-11-02

Re: [PATCHv4 1/6] input/cma3000_d0x: Support devices without pdata

From: Ricardo Ribalda Delgado <hidden>
Date: 2011-10-25 07:39:01
Also in: lkml

Hello Grant
quoted
---
Drop this line, git cuts everything below a '---' line from the commit text.
Done, thanks
This binding needs documentation before it can be merged.
Documentation/input/cma3000_d0x.txt is the right place ?
No of_device_id match table to match against compatible values?
I think it is not needed, the device will be matched against the
driver cma3000_d0x_spi.c and AFAIK on the spi/i2c devices you dont
need the device_id match. But you know much more about this :).  Can
you point me to a example where a spi driver uses of_device-id match.
quoted
+
 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;
+     struct cma3000_platform_data *pdata;
      struct cma3000_accl_data *data;
      struct input_dev *input_dev;
      int rev;
      int error;

-     if (!pdata) {
-             dev_err(dev, "platform data not found\n");
-             error = -EINVAL;
-             goto err_out;
-     }
-
-
      /* if no IRQ return error */
      if (irq == 0) {
              error = -EINVAL;
@@ -309,10 +357,26 @@ struct cma3000_accl_data *cma3000_init(struct device *dev, int irq,
              goto err_free_mem;
      }

+     /*Init platform data*/
+     if (dev->platform_data != NULL) {
+             memcpy(&data->pdata, dev->platform_data, sizeof(data->pdata));
+     } else {
+             memcpy(&data->pdata, &cma3000_default_pdata,
+                             sizeof(data->pdata));
+             #ifdef CONFIG_OF
+             if (dev->of_node != NULL)
+                     cma3000_get_pdata_of(dev, data);
+              else
+                     dev_info(dev, "platform data not found, using default\n");
+             #else
+             dev_info(dev, "platform data not found, using default\n");
+             #endif
+     }
+     pdata = &data->pdata;
+
      data->dev = dev;
      data->input_dev = input_dev;
      data->bus_ops = bops;
-     data->pdata = pdata;
      data->irq = irq;
      mutex_init(&data->mutex);

--
1.7.7


-- 
Ricardo Ribalda
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help