linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Back porting bmg160 driver to 3.10.9 kernel
@ 2015-05-22 18:31 Oliver King-Smith
  2015-05-23  8:50 ` Lars-Peter Clausen
  0 siblings, 1 reply; 4+ messages in thread
From: Oliver King-Smith @ 2015-05-22 18:31 UTC (permalink / raw)
  To: linux-iio, Rich.Surprenant

I am trying to back port the bmg160 driver to the 3.10.9 kernel to work on an Android 4.4.x device.

The API for in ii_info has changed quite a bit between the 3.18 and the 3.10 kernel.  So this function won’t compile

static int bmg160_read_event(struct iio_dev *indio_dev,
                             const struct iio_chan_spec *chan,
                             enum iio_event_type type,
                             enum iio_event_direction dir,
                             enum iio_event_info info,
                             int *val, int *val2)
{
        struct bmg160_data *data = iio_priv(indio_dev);

        *val2 = 0;
        switch (info) {
        case IIO_EV_INFO_VALUE:
                *val = data->slope_thres & BMG160_SLOPE_THRES_MASK;
                break;
        default:
                return -EINVAL;
        }

        return IIO_VAL_INT;
}

The 3.10 prototype for this function is
        int (*read_event_value)(struct iio_dev *indio_dev,
                                u64 event_code,
                                int *val);

My question is what does IIO_EV_INFO_VALUE map to in the old event_code in the 3.10.9 kernel

Oliver


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Back porting bmg160 driver to 3.10.9 kernel
  2015-05-22 18:31 Back porting bmg160 driver to 3.10.9 kernel Oliver King-Smith
@ 2015-05-23  8:50 ` Lars-Peter Clausen
  2015-05-23 20:10   ` Oliver King-Smith
  0 siblings, 1 reply; 4+ messages in thread
From: Lars-Peter Clausen @ 2015-05-23  8:50 UTC (permalink / raw)
  To: Oliver King-Smith, linux-iio, Rich.Surprenant

On 05/22/2015 08:31 PM, Oliver King-Smith wrote:
> I am trying to back port the bmg160 driver to the 3.10.9 kernel to work on an Android 4.4.x device.
>
> The API for in ii_info has changed quite a bit between the 3.18 and the 3.10 kernel.  So this function won’t compile
>
> static int bmg160_read_event(struct iio_dev *indio_dev,
>                               const struct iio_chan_spec *chan,
>                               enum iio_event_type type,
>                               enum iio_event_direction dir,
>                               enum iio_event_info info,
>                               int *val, int *val2)
> {
>          struct bmg160_data *data = iio_priv(indio_dev);
>
>          *val2 = 0;
>          switch (info) {
>          case IIO_EV_INFO_VALUE:
>                  *val = data->slope_thres & BMG160_SLOPE_THRES_MASK;
>                  break;
>          default:
>                  return -EINVAL;
>          }
>
>          return IIO_VAL_INT;
> }
>
> The 3.10 prototype for this function is
>          int (*read_event_value)(struct iio_dev *indio_dev,
>                                  u64 event_code,
>                                  int *val);
>
> My question is what does IIO_EV_INFO_VALUE map to in the old event_code in the 3.10.9 kernel

Nothing. With the old API events could only have values and no other attributes.

- Lars


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Back porting bmg160 driver to 3.10.9 kernel
  2015-05-23  8:50 ` Lars-Peter Clausen
@ 2015-05-23 20:10   ` Oliver King-Smith
  2015-05-24 20:38     ` Lars-Peter Clausen
  0 siblings, 1 reply; 4+ messages in thread
From: Oliver King-Smith @ 2015-05-23 20:10 UTC (permalink / raw)
  To: Lars-Peter Clausen, linux-iio; +Cc: Rich.Surprenant


> On May 23, 2015, at 1:50 AM, Lars-Peter Clausen <lars@metafoo.de> wrote:
> 
> On 05/22/2015 08:31 PM, Oliver King-Smith wrote:
>> I am trying to back port the bmg160 driver to the 3.10.9 kernel to work on an Android 4.4.x device.
>> 
>> The API for in ii_info has changed quite a bit between the 3.18 and the 3.10 kernel.  So this function won’t compile
>> 
>> static int bmg160_read_event(struct iio_dev *indio_dev,
>>                              const struct iio_chan_spec *chan,
>>                              enum iio_event_type type,
>>                              enum iio_event_direction dir,
>>                              enum iio_event_info info,
>>                              int *val, int *val2)
>> {
>>         struct bmg160_data *data = iio_priv(indio_dev);
>> 
>>         *val2 = 0;
>>         switch (info) {
>>         case IIO_EV_INFO_VALUE:
>>                 *val = data->slope_thres & BMG160_SLOPE_THRES_MASK;
>>                 break;
>>         default:
>>                 return -EINVAL;
>>         }
>> 
>>         return IIO_VAL_INT;
>> }
>> 
>> The 3.10 prototype for this function is
>>         int (*read_event_value)(struct iio_dev *indio_dev,
>>                                 u64 event_code,
>>                                 int *val);
>> 
>> My question is what does IIO_EV_INFO_VALUE map to in the old event_code in the 3.10.9 kernel
> 
> Nothing. With the old API events could only have values and no other attributes.
I may be miss interpreting this, but my read is I should just ignore the event_code and set val to
                *val = data->slope_thres & BMG160_SLOPE_THRES_MASK;

Does that seem reasonable?
> 
> - Lars
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Back porting bmg160 driver to 3.10.9 kernel
  2015-05-23 20:10   ` Oliver King-Smith
@ 2015-05-24 20:38     ` Lars-Peter Clausen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars-Peter Clausen @ 2015-05-24 20:38 UTC (permalink / raw)
  To: Oliver King-Smith, linux-iio; +Cc: Rich.Surprenant

On 05/23/2015 10:10 PM, Oliver King-Smith wrote:
> 
>> On May 23, 2015, at 1:50 AM, Lars-Peter Clausen <lars@metafoo.de> 
>> wrote:
>> 
>> On 05/22/2015 08:31 PM, Oliver King-Smith wrote:
>>> I am trying to back port the bmg160 driver to the 3.10.9 kernel to 
>>> work on an Android 4.4.x device.
>>> 
>>> The API for in ii_info has changed quite a bit between the 3.18 and 
>>> the 3.10 kernel.  So this function won’t compile
>>> 
>>> static int bmg160_read_event(struct iio_dev *indio_dev, const struct 
>>> iio_chan_spec *chan, enum iio_event_type type, enum 
>>> iio_event_direction dir, enum iio_event_info info, int *val, int 
>>> *val2) { struct bmg160_data *data = iio_priv(indio_dev);
>>> 
>>> *val2 = 0; switch (info) { case IIO_EV_INFO_VALUE: *val = 
>>> data->slope_thres & BMG160_SLOPE_THRES_MASK; break; default: return 
>>> -EINVAL; }
>>> 
>>> return IIO_VAL_INT; }
>>> 
>>> The 3.10 prototype for this function is int
>>> (*read_event_value)(struct iio_dev *indio_dev, u64 event_code, int
>>> *val);
>>> 
>>> My question is what does IIO_EV_INFO_VALUE map to in the old 
>>> event_code in the 3.10.9 kernel
>> 
>> Nothing. With the old API events could only have values and no other 
>> attributes.
> I may be miss interpreting this, but my read is I should just ignore the 
> event_code and set val to *val = data->slope_thres & 
> BMG160_SLOPE_THRES_MASK;
> 
> Does that seem reasonable?

Yes.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-24 20:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-22 18:31 Back porting bmg160 driver to 3.10.9 kernel Oliver King-Smith
2015-05-23  8:50 ` Lars-Peter Clausen
2015-05-23 20:10   ` Oliver King-Smith
2015-05-24 20:38     ` Lars-Peter Clausen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).