Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1397061pxj; Fri, 21 May 2021 13:14:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdIKR7VuZz/BBLl4ywmqLEqtSn90jZ3ZR/Szn0ZDDKmZyEbcqJ1d/e0fVzq1x/+F3nmByE X-Received: by 2002:a17:906:5914:: with SMTP id h20mr12213960ejq.252.1621628042213; Fri, 21 May 2021 13:14:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621628042; cv=none; d=google.com; s=arc-20160816; b=t5sxqPAwbZZWNhHpOSaow2WAC5v3RQdVgyBbXo3zwgDYPW2ifYUqoO3Mh9BAc05Z33 9+0WVKsyG1uFFyiQiRhaFmp+Bhj3O5f0Qj/VwGnEIRA7CSs667bQTx2vf5Si66adwieu tXJjlHqeNPQJfStknjGPB4NnlJwUIVsHjYygMeHKjsTs7c2BNk2BGzzy8qqNK5Q0sHyS woOqikNNET/TX6Du5xRTmG5ggvWh7Jd1LffrvnAzKW9jjfln7kOYfp1Up0P+Va7477+e mW9Myt832iAaGMqR1gXpQOVW3SPogK/Gu/rrz/cA3WFCostwepvIAJt0A3lJQhzLJ0+/ hdKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :dkim-signature; bh=it9Lh4qTlHTGIG1OLO3qNDZWs9VfXzGs2bZWUH5AgQo=; b=P3jrNIRGD9r6MerhKhB9H8d9rm335Sj/s0t7xvsiivkKRrJ2X47n2GMNgTNs8qFjia RUIBGiJ9CUJ/2nSIJTWcwiHrrePjZ9/Exc9Jj+MzYrCsra4YsOBaWtUkU5ihU/Ju4Wh0 H80057P1h+khOnzGgOck/+aS/bRQb4ikOsVFDHIpl/FHziJH8IXiW90W4FGqDsN4ofL8 vyc033GbdZ4irN4aNpkY+RSPJXePQLjoZMzPszaiEw92R0Q/ngBJ0tWuAbQaq39EUKuL f8tkHlW94XQTno30la+qsD8jR/CBiZeRkdjh8+Ydb4/fmK3lv1SpB+vQot4Tnmi3H2WE jZfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=SFkJistX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id le4si5935106ejc.650.2021.05.21.13.13.39; Fri, 21 May 2021 13:14:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=SFkJistX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232631AbhEUKr6 (ORCPT + 99 others); Fri, 21 May 2021 06:47:58 -0400 Received: from ssl.serverraum.org ([176.9.125.105]:52331 "EHLO ssl.serverraum.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232694AbhEUKr4 (ORCPT ); Fri, 21 May 2021 06:47:56 -0400 Received: from ssl.serverraum.org (web.serverraum.org [172.16.0.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 58F492224A; Fri, 21 May 2021 12:46:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1621593989; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=it9Lh4qTlHTGIG1OLO3qNDZWs9VfXzGs2bZWUH5AgQo=; b=SFkJistXQkn9Z58NhlcLjUhQmBnfbng/LoGIWWamCHGsu1Y6eIclIFbhQ9QblEznSmJFSL YsKSDPhwkD6h3/awcJ8rKjQUzckImCxl3SwY+gkfKVt8RcOrvrmXEdC1Byi38OFezAz2Fs Cyu/zaeO/lvZE6M/IOLcR+5x2CKJPl4= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 21 May 2021 12:46:29 +0200 From: Michael Walle To: "Vaittinen, Matti" Cc: andy.shevchenko@gmail.com, linux-power , linux-gpio@vger.kernel.org, bgolaszewski@baylibre.com, linux-kernel@vger.kernel.org, linus.walleij@linaro.org Subject: Re: [PATCH v2 1/3] gpio: regmap: Support few IC specific operations In-Reply-To: References: <6e319c22b41747e3911c7a5cad877134cabc9231.1621577204.git.matti.vaittinen@fi.rohmeurope.com> <8c048bda0ace591d7e91c07ed9155338@walle.cc> User-Agent: Roundcube Webmail/1.4.11 Message-ID: <26eb6b95805840dca05e0135e0555b42@walle.cc> X-Sender: michael@walle.cc Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 2021-05-21 12:25, schrieb Vaittinen, Matti: > On Fri, 2021-05-21 at 12:19 +0200, Michael Walle wrote: >> Am 2021-05-21 12:09, schrieb Andy Shevchenko: >> > On Fri, May 21, 2021 at 12:53 PM Matti Vaittinen >> > wrote: >> > > Changelog v2: (based on suggestions by Michael Walle) >> > > - drop gpio_regmap_set_drvdata() >> > >> > But why do we have gpio_regmap_get_drvdata() and why is it >> > different >> > now to the new member handling? >> >> Eg. the reg_mask_xlate() callback is just passed a "struct >> gpio_regmap*". >> If someone needs to access private data there, >> gpio_regmap_get_drvdata() >> is used. At least that was its intention. > > I would help the IC driver here too and just directly provide the > drvdata pointer as argument. I don't see much value in providing the > regmap_gpio pointer as IC driver can not dereference it. What is it with the "it's useless if one cannot dereference it"? You're also passing "struct regmap *" which you cannot dereference. It's an opaque pointer you need to pass to gpio_regmap to call a function there. What is the problem with letting gpio_regmap derefence its internal data structure and return the value for you? Adding the drvdata to reg_mask_xlate() highlights my former concern; you need to keep chaning the users to add another parameter. What if xlate() needs the regmap, too? Then you need to change it again. Granted this is a silly example, but you should get my point. It is by far more easy to just add another new gpio_regmap_*(struct gpio_regmap *) function and you don't have to change existing users. Also what if gpio_regmap provides some useful helper function in the future, it will likely need its internal data struct. -michael