Re: [PATCH v3] iio: add adjd_s311 I2C digital color sensor driver

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

 



Hello,

thank you for reviewing!

> >> +	ret = i2c_smbus_write_word_data(data->client,
> >> +		ADJD_S311_INT_REG(chan->address), int_time);
> >> +	if (ret < 0)
> >> +		return ret;
> >> +
> >> +	return ret ? ret : len;
> > 
> > ret will always be zero here.

right, I think that's a leftover from code calling 
i2c_smbus_read_block_data()

> > I wouldn't return ret here since this is the interrupt handler and I'm not
> > quite sure how the core reacts if it gets a value which is not a
> > irqreturn_t, especially considering that irqreturn_t is basically unsigned.
> > You also have to call iio_trigger_notify_done before leaving the function
> > 
> 
> Looks like you are not alone with this,  I've just wrote a cocci patch which
> finds paths which return form the trigger handler without calling
> iio_trigger_notify_done and it triggers on quite a few other drivers as well.

I know, but no wonder; there is zero documentation and even the sample in 
iio_simple_dummy_buffer.c looks odd:

static irqreturn_t iio_simple_dummy_trigger_h(int irq, void *p)
{
	struct iio_poll_func *pf = p;
...
	data = kmalloc(indio_dev->scan_bytes, GFP_KERNEL);
	if (data == NULL)
		return -ENOMEM;

I am abusing you as my patch correctness oracle to learn things, sorry :)

regards, p.

-- 

Peter Meerwald
+43-664-2444418 (mobile)
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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