lkml.org 
[lkml]   [2011]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCHv4 1/6] input/cma3000_d0x: Support devices without pdata
    Hello Grant

    >> ---
    >
    > 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.

    >
    >> +
    >>  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-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2011-10-25 09:41    [W:0.039 / U:95.556 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site