From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751898AbdBAJbQ (ORCPT ); Wed, 1 Feb 2017 04:31:16 -0500 Received: from ns.pmeerw.net ([84.19.176.92]:43861 "EHLO pmeerw.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751482AbdBAJbO (ORCPT ); Wed, 1 Feb 2017 04:31:14 -0500 Date: Wed, 1 Feb 2017 10:31:12 +0100 (CET) From: Peter Meerwald-Stadler To: Peter Rosin cc: linux-kernel@vger.kernel.org, Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Alison Schofield , Gregor Boirie , Sanchayan Maity , Ken Lin , linux-iio@vger.kernel.org Subject: Re: [PATCH 1/2] iio: pressure: mpl3115: do not rely on structure field ordering In-Reply-To: Message-ID: References: <1485936567-3367-1-git-send-email-peda@axentia.se> <1485936567-3367-2-git-send-email-peda@axentia.se> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > >> Fixes a regression triggered by a change in the layout of > >> struct iio_chan_spec, but the real bug is in the driver which assumed > >> a specific structure layout in the first place. > > what do you mean by 'driver which assumed a specific structure'? > > Look again, the two bits are not OR:ed together as implied by the > indentation. There is a comma between them, which put the ..._SCALE > bit in the next field. That next field was .info_mask_shared_by_type > before the patch adding the available attribute that triggered the > regression and .info_mask_separate_available after it. wow, now that you say it :) since I wrote these drivers I can assure you that this is just a typo, use of the 'specific structure' is a coincident maybe adding your explanation regarding not ORing to the patch description would be a good idea I was confused by the change from .info_mask_separate to .info_mask_shared_by_type a fix could have just changed - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), BIT(IIO_CHAN_INFO_SCALE), + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), as originally intended > Cheers, > peda > > > thanks, p. > > > >> diff --git a/drivers/iio/pressure/mpl3115.c b/drivers/iio/pressure/mpl3115.c > >> index cc3f84139157..525644a7442d 100644 > >> --- a/drivers/iio/pressure/mpl3115.c > >> +++ b/drivers/iio/pressure/mpl3115.c > >> @@ -190,7 +190,7 @@ static const struct iio_chan_spec mpl3115_channels[] = { > >> { > >> .type = IIO_PRESSURE, > >> .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), > >> - BIT(IIO_CHAN_INFO_SCALE), > >> + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), > >> .scan_index = 0, > >> .scan_type = { > >> .sign = 'u', > >> @@ -203,7 +203,7 @@ static const struct iio_chan_spec mpl3115_channels[] = { > >> { > >> .type = IIO_TEMP, > >> .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), > >> - BIT(IIO_CHAN_INFO_SCALE), > >> + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), > >> .scan_index = 1, > >> .scan_type = { > >> .sign = 's', > >> > > > -- Peter Meerwald-Stadler +43-664-2444418 (mobile)