On 2017-05-05 11:40, Mika Westerberg wrote: > On Fri, May 05, 2017 at 08:31:32AM +0200, Jan Kiszka wrote: >> +static int adc108s102_probe(struct spi_device *spi) >> +{ >> + struct adc108s102_state *st; >> + struct iio_dev *indio_dev; >> + int ret; >> + >> + indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); >> + if (!indio_dev) >> + return -ENOMEM; >> + >> + st = iio_priv(indio_dev); >> + >> + if (ACPI_COMPANION(&spi->dev)) { >> + st->reg = NULL; >> + ret = device_property_read_u32(&spi->dev, "va-millivolt", >> + &st->va_millivolt); > > Please try to avoid things like this for now. You can just hard code the > voltage now and we can think how to solve this in ACPI if there will be > an actual user needing anything else than the voltage you are using on > your board. OK, so I will set a static 5V in case of ACPI. Fine as well. > >> + if (ret < 0) { >> + dev_err(&spi->dev, >> + "Missing va-millivolt device property\n"); >> + return -ENODEV; >> + } >> + } else { >> + st->reg = devm_regulator_get(&spi->dev, "vref"); >> + if (IS_ERR(st->reg)) >> + return PTR_ERR(st->reg); > > This should be an optional regulator and in case of ACPI you just don't > have it. It's mandatory for this DT case, so I will not change that. Thanks, Jan > >> + >> + ret = regulator_enable(st->reg); >> + if (ret < 0) { >> + dev_err(&spi->dev, "Cannot enable vref regulator\n"); >> + return ret; >> + } >> + } -- Siemens AG, Corporate Technology, CT RDA ITP SES-DE Corporate Competence Center Embedded Linux -- 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