Re: [PATCH v1 2/2] regulator: max77857: Add ADI MAX77857/MAX77831 Regulator Support

From: Mark Brown
Date: Tue Jun 13 2023 - 10:22:46 EST


On Tue, Jun 13, 2023 at 11:05:50AM +0300, Okan Sahin wrote:

> +struct regmap_config max77857_regmap_config = {
> + .reg_bits = 8,
> + .val_bits = 8,
> + .cache_type = REGCACHE_RBTREE,

Please use the more modern REGCACHE_MAPLE for new devices.

> +static irqreturn_t max77857_irq_handler(int irq, void *data)
> +{
> + struct regulator_dev *rdev = data;
> + enum max77857_id id = (enum max77857_id)rdev_get_drvdata(rdev);
> + struct device *dev = &rdev->dev;
> + unsigned long flags = 0;
> + unsigned int status;
> + int ret;
> +
> + switch (id) {
> + case ID_MAX77831:
> + case ID_MAX77857:
> + ret = regmap_read(rdev->regmap, MAX77857_REG_INT_SRC, &status);
> + break;
> + default:
> + return IRQ_HANDLED;
> + }

We just completely ignore the interrupt if it's not one of the supported
devices, that seems wrong - it looks likee those devices don't have the
support for interrupts at all and so should never get here? If the
interrupt does go off then this is likely to lead to problems. I think
it'd be better if the driver just didn't request the interrupt for
devices that it doesn't support interrupts for, if there's no interrupt
support in the hardware for those it could also complain if one is
specified though that's optional.

> + if (ret) {
> + dev_err(dev, "cannot read status\n");
> + return IRQ_HANDLED;
> + }

IRQ_NONE.

Attachment: signature.asc
Description: PGP signature