Re: [PATCH v6 2/2] iio: humidity: Add support for ENS210

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 05 Aug 2024 09:12:53 +0100
Joshua Felmeden <jfelmeden@xxxxxxxxxxxxxxxxxxxx> wrote:

> Add support for ENS210/ENS210A/ENS211/ENS212/ENS213A/ENS215.
> 
> The ENS21x is a family of temperature and relative humidity sensors with
> accuracies tailored to the needs of specific applications.
> 
> Signed-off-by: Joshua Felmeden <jfelmeden@xxxxxxxxxxxxxxxxxxxx>

Hi Joshua,

Sorry for delay on this one, it was next on the list when I ran
out of time before going on a short vacation.

Anyhow, just some minor whitespace stuff so I'll tweak that
whilst applying.

Applied to the togreg branch of iio.git and pushed out as testing
for 0-day etc to poke at it and see if we missed anything.

Also a minor thing with scoped_guard().
Compilers can't figure out that there is not path out of that so
we get an unmarked fallthrough warning.

In file included from ./include/linux/irqflags.h:17,
                 from ./arch/x86/include/asm/special_insns.h:10,
                 from ./arch/x86/include/asm/processor.h:25,
                 from ./include/linux/sched.h:13,
                 from ./include/linux/delay.h:23,
                 from drivers/iio/humidity/ens210.c:18:
drivers/iio/humidity/ens210.c: In function ‘ens210_read_raw’:
./include/linux/cleanup.h:172:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
  172 |         for (CLASS(_name, scope)(args),                                 \
      |         ^~~
drivers/iio/humidity/ens210.c:153:17: note: in expansion of macro ‘scoped_guard’
  153 |                 scoped_guard(mutex, &data->lock) {
      |                 ^~~~~~~~~~~~
drivers/iio/humidity/ens210.c:160:9: note: here
  160 |         case IIO_CHAN_INFO_SCALE:
      |         ^~~~
  CHECK   drivers/iio/humidity/ens210.c
  MODPOST Module.symvers

Annoyingly even an unreachable() doesn't work for this particular situation.

 CC [M]  drivers/iio/humidity/ens210.o
drivers/iio/humidity/ens210.o: warning: objtool: ens210_read_raw+0x52: can't find jump dest instruction at .text+0x36c

So for now I've added

diff --git a/drivers/iio/humidity/ens210.c b/drivers/iio/humidity/ens210.c
index bc5dedb46b83..e9167574203a 100644
--- a/drivers/iio/humidity/ens210.c
+++ b/drivers/iio/humidity/ens210.c
@@ -157,6 +157,7 @@ static int ens210_read_raw(struct iio_dev *indio_dev,
                                return ret;
                        return IIO_VAL_INT;
                }
+               return -EINVAL; /* compiler warning workaround */
        case IIO_CHAN_INFO_SCALE:
                if (channel->type == IIO_TEMP) {
                        *val = 15;

Thanks,

Jonathan

> diff --git a/drivers/iio/humidity/ens210.c b/drivers/iio/humidity/ens210.c
> new file mode 100644
> index 000000000000..719fdac817cf
> --- /dev/null
> +++ b/drivers/iio/humidity/ens210.c

> +
> +static int ens210_probe(struct i2c_client *client)
> +{
> +	struct ens210_data *data;
> +	struct iio_dev *indio_dev;
> +	uint16_t part_id;
> +	int ret;
> +
> +	if (!i2c_check_functionality(client->adapter,
> +				     I2C_FUNC_SMBUS_WRITE_BYTE_DATA |
> +					     I2C_FUNC_SMBUS_WRITE_BYTE |
> +					     I2C_FUNC_SMBUS_READ_I2C_BLOCK)) {
Non standard alignment. I'll fix up.

> +		return dev_err_probe(&client->dev, -EOPNOTSUPP,
> +			"adapter does not support some i2c transactions\n");
> +	}






[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux