From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 482E1C6FA82 for ; Sun, 4 Sep 2022 16:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234758AbiIDQLt (ORCPT ); Sun, 4 Sep 2022 12:11:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229938AbiIDQLs (ORCPT ); Sun, 4 Sep 2022 12:11:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3665727CFB; Sun, 4 Sep 2022 09:11:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C70F460F97; Sun, 4 Sep 2022 16:11:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C511C433C1; Sun, 4 Sep 2022 16:11:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662307906; bh=jEC7BDHEzbus1QSyICot3fVdFcnRPpNPPhhmw+RRi6A=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=J84kGNaQ40uemrQsVotTmGyqGCtvwPT2F1d6xSxr42ONecG7o2KKE6E5QMl5RXs81 Q3M65yqa79MIHiBHGWJ8OcgstOwt5H2yaLanvFeMGNVQhQwmLLs3Zqv5mcqo3y7U53 K2g27CbgCCln9z8kL8ICf17OuhrdnvkiMC+5tAQgi3emwUDOP5tmJuY4gj8FSnMm63 HqjlxgY+UMRUxCxAtZKJTvpNdJEMs0j3QJ+R1BB1ewiMRHMbI8BS+IasyXSBef+Vyr 1uSW0oTu/Fh/mf/+DPAyfsjNzfacqlTt0tV28Paj82nVrnlGrX0WTCjCCyP8OLlm52 zwi2KOeW27zsQ== Date: Sun, 4 Sep 2022 16:37:38 +0100 From: Jonathan Cameron To: "Bolboaca, Ramona" Cc: Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , linux-iio , devicetree , Linux Kernel Mailing List Subject: Re: [PATCH v2 2/2] iio: adc: add max11205 adc driver Message-ID: <20220904163738.2bebf51f@jic23-huawei> In-Reply-To: References: <20220831133021.215625-1-ramona.bolboaca@analog.com> <20220831133021.215625-2-ramona.bolboaca@analog.com> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org > > > > > + if (!st->chip_info) > > > + st->chip_info = (const struct chip_info *)spi_get_device_id(spi)->driver_data; > > > + > > > + indio_dev->name = st->chip_info->name; > > > + indio_dev->modes = INDIO_DIRECT_MODE; > > > + indio_dev->channels = max11205_channels; > > > + indio_dev->num_channels = 1; > > > + indio_dev->info = &max11205_iio_info; > > > + > > > + st->vref = devm_regulator_get(&spi->dev, "vref"); > > > > devm_regulator_get_enable() ? > I found the patches which implement devm_regulator_get_enable. > However, I need to get the voltage of the regulator using > regulator_get_voltage(struct regulator *regulator) and if I use > devm_regulator_get_enable I do not have access to the regulator > pointer. What should I do in this case? Is there an API which works > like devm_regulator_get_enable but also gives access to the > regulator's pointer? Thank you for you review! Ah. You've run into a fun long running 'discussion'. There was great resistance to adding devm_regulator_get_enable() because it was felt that it was too easy to get the handling wrong and end up with underflowing reference counters etc. So the 'solution' was to make it less useful than it would otherwise have been by making sure it could not be combined with other accesses to the regulator. Upshot is you are correct that it cannot be applied in this case. Also relevant is that the patch in question is going through the regulator tree so won't be generally available to the rest of the kernel until next cycle. As such we'd have had to make such a change as a follow up patch if it were possible. Jonathan p.s. Wrap your replies at 80 chars as well as the code. Kernel developers have an annoying habit of reading their email in one small window even when they have very large monitors :) Also, where sensible crop unnecessary parts of the email to only include the bit you are responding to. Saves on lots of scrolling.. > Kind Regards, Ramona > Bolboaca