[no subject]

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

 



> Also int_config sounds non-related to interrupt, however it's about interrupt
> pin, right? perhaps name it differently here?
> 
> E.g.,
> 
> 	interrupt_pin_config
> 
> ?
> 

This sounds good yes!

> > +{
> > +	struct bmp280_data *data = iio_priv(indio_dev);
> > +	struct device *dev = data->dev;
> > +	struct fwnode_handle *fwnode;
> > +	u32 irq_type;
> > +	int ret, irq;
> > +
> > +	irq = fwnode_irq_get(dev_fwnode(dev), 0);
> > +	if (irq < 0)
> > +		return dev_err_probe(dev, irq, "No interrupt found.\n");
> > +
> > +	irq_type = irq_get_trigger_type(irq);
> > +	switch (irq_type) {
> > +	case IRQF_TRIGGER_RISING:
> > +		data->trig_active_high = true;
> > +		break;
> > +	case IRQF_TRIGGER_FALLING:
> > +		data->trig_active_high = false;
> > +		break;
> > +	default:
> > +		return dev_err_probe(dev, -EINVAL, "Invalid interrupt type specified.\n");
> > +	}
> > +
> > +	data->trig_open_drain =
> > +		fwnode_property_read_bool(fwnode, "int-open-drain");
> 
> 
> Where do you initialise fwnode?
> 

Ok, I need to retest this with the device-tree.

> > +	ret = int_config(data);
> > +	if (ret)
> > +		return ret;
> > +
> > +	data->trig = devm_iio_trigger_alloc(data->dev, "%s-dev%d",
> > +					    indio_dev->name,
> > +					    iio_device_id(indio_dev));
> > +	if (!data->trig)
> > +		return -ENOMEM;
> > +
> > +	data->trig->ops = trigger_ops;
> > +	iio_trigger_set_drvdata(data->trig, data);
> > +
> > +	ret = devm_request_threaded_irq(data->dev, irq, NULL,
> > +					irq_thread_handler, IRQF_ONESHOT,
> > +					indio_dev->name, indio_dev);
> > +	if (ret)
> > +		return dev_err_probe(dev, ret, "request irq failed.\n");
> 
> IRQ
> 

ACK.

> > +	ret = devm_iio_trigger_register(data->dev, data->trig);
> > +	if (ret)
> > +		return dev_err_probe(dev, ret, "iio trigger register failed.\n");
> > +
> > +	indio_dev->trig = iio_trigger_get(data->trig);
> > +
> > +	return 0;
> > +}
> 
> ...
> 
> > +static int bmp580_data_rdy_trigger_set_state(struct iio_trigger *trig,
> > +					     bool state)
> > +{
> > +	struct bmp280_data *data = iio_trigger_get_drvdata(trig);
> > +	int ret;
> > +
> > +	guard(mutex)(&data->lock);
> > +
> > +	ret = regmap_update_bits(data->regmap, BMP580_REG_INT_CONFIG,
> > +				 BMP580_INT_CONFIG_INT_EN,
> > +				 FIELD_PREP(BMP580_INT_CONFIG_INT_EN, !!state));
> > +	if (ret)
> > +		dev_err(data->dev,
> > +			"Could not %s interrupt.\n", str_enable_disable(state));
> > +	return ret;
> 
> Somewhere above (or in another patch) you used the style with 'return 0;' at
> the end. Please, check the resulting code for the consistency and choose one
> style for all.
> 

ACK.

> > +}
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 




[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