Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754803AbbGFMCs (ORCPT ); Mon, 6 Jul 2015 08:02:48 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:33815 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754211AbbGFMCp (ORCPT ); Mon, 6 Jul 2015 08:02:45 -0400 Message-ID: <559A6E5D.9040202@linaro.org> Date: Mon, 06 Jul 2015 17:32:37 +0530 From: Vaibhav Hiremath User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Tony Lindgren CC: linux-arm-kernel@lists.infradead.org, robh+dt@kernel.org, lee.jones@linaro.org, linus.walleij@linaro.org, will.deacon@arm.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org Subject: Re: [RFC PATCH] pinctrl-single: Use of pinctrl-single for external device over I2C References: <1435855992-10312-1-git-send-email-vaibhav.hiremath@linaro.org> <20150706063532.GB10705@atomide.com> In-Reply-To: <20150706063532.GB10705@atomide.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2741 Lines: 94 On Monday 06 July 2015 12:05 PM, Tony Lindgren wrote: > * Vaibhav Hiremath [150702 09:58]: >> --- a/drivers/pinctrl/pinctrl-single.c >> +++ b/drivers/pinctrl/pinctrl-single.c >> >> -static unsigned __maybe_unused pcs_readb(void __iomem *reg) >> +static unsigned pcs_read(struct regmap *map, unsigned int reg) >> { >> - return readb(reg); >> -} >> + unsigned int val; >> >> -static unsigned __maybe_unused pcs_readw(void __iomem *reg) >> -{ >> - return readw(reg); >> -} >> - >> -static unsigned __maybe_unused pcs_readl(void __iomem *reg) >> -{ >> - return readl(reg); >> -} >> - >> -static void __maybe_unused pcs_writeb(unsigned val, void __iomem *reg) >> -{ >> - writeb(val, reg); >> -} >> + regmap_read(map, reg, &val); > > Sorry this won't work. Most platforms don't need regmap here, and I > certainly don't want to use regmap for toggling pins for runtime > PM because of the extra overhead. > That's exactly my question was in my first email. It's ok. What is your openion on overall code changes for regmap support ? Any other feedback or suggestions? > It seems you need to stash the regmap pointer to struct pcs_device > and just the function pointers. As this driver is ioremapping the > region, we certainly want to keep things using void __iomem * too. > You can cast that to whatever regmap needs in the wrapper functions > for regmap. Note that the extra overhead there won't matter as we > are using regmap mostly for devices over I2C and so on. > The issue I have here with the signature of read/write fn static unsigned __maybe_unused pcs_read(void __iomem *reg) static void __maybe_unused pcs_writeX(unsigned val, void __iomem *reg) For regmap, I need 2 arguments, 1. Pointer to regmap 2. Offset to register So I will have to change the signature to static unsigned __maybe_unused pcs_read(void __iomem *reg, unsigned int offset) static void __maybe_unused pcs_write(void __iomem *reg, unsigned val, unsigned int offset) And, On the same direction, will having separate functions for regmap. static unsigned pcs_read_regmap(void __iomem *reg, unsigned int offset) { unsigned int val; regmap_read((struct regmap *)reg, offset, &val); } static void pcs_write_regmap(void __iomem *reg, unsigned val, unsigned int offset) { regmap_write((struct regmap *)reg, offset, val); } This functions will be initialized to pcs_device->read/write. I will have to do some more changes, specially around pcs_interrupt usage. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/