Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp2200174rwb; Sun, 4 Sep 2022 10:20:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR5ZB9B++SWGjRbKjdnHsXvuV3V5GEW31F+FVdn/ElT28EvlLpeU2FulYZgnOBOeTOC0dzOw X-Received: by 2002:a17:907:c28:b0:73d:beb7:b9c2 with SMTP id ga40-20020a1709070c2800b0073dbeb7b9c2mr33297061ejc.336.1662312038763; Sun, 04 Sep 2022 10:20:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662312038; cv=none; d=google.com; s=arc-20160816; b=yOWb1cqkLXaozoYWOoWY71wx9bWQzMgLYnmmhYSHKDiw/geNlzRh9klyJ5EbR6a/Ed BluLmUs+DUp49AsMezWQ7PWb3XEeM1/MdOpxB5XgM3Wr+wcx7eoegAEUMtehRJ6e5uJo mUiTYbDCxrS6a2KsPgLqgNi1Ks0mw0ZNGRYILnyec2YLAU8Tue3+uUsPGJdCg+dqoulN H8In3KjbvN5A+23Ea8JfGsNjd9ulzCtxBRufC4lM0rwTRIJ/dOFn1PSPYe6amGLh5RoO CWFqN+pVbd4w7//7e3rkkpQg3YFqrb1/AXLdYguklRfBU2fQKKSMeX3uX9jDXoQxXwlW lsqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=lA6PmjerjVWDm0hkqS/3D5s3J9htFo1sU4n5+/dImmQ=; b=jFd2G+2i3W7d+QrNnPY7ukgc2GYDlY+hjxSpP8wcyNIQocIBzBrDIHDzwhaazUYu3i AH56g8edwPSI2EOovUCsMsAQHQ2FCVWhOXODJ/JfTNiloMe6wTJJxYdgiK7V3m62i80X ZRfMGKz7YKGbs4UfJrbKXZY0JsLi9yRqU5Id3cLDFG87CktNq26BPE6kj49zQqcv/P8I 1nTdD2X7jv0CjzkLdiuzHw5waLmhcXFSa6AbR9o10+LUuOGF2szh68gV1pnVjUADsdvZ seWR68h9aC4lx9yGevls2SUl4usIsZVle9tjAd80eZ0pvSXrzv9v9NPdD5AN5se96Hok ADxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=J84kGNaQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c17-20020a05640227d100b00446b59c130asi6541010ede.192.2022.09.04.10.20.10; Sun, 04 Sep 2022 10:20:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=J84kGNaQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230176AbiIDQLu (ORCPT + 99 others); Sun, 4 Sep 2022 12:11:50 -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 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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