From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Sun, 24 Jan 2021 11:00:45 -0700 Subject: [PATCH 07/11] pinctrl: single: use function pointer for register access In-Reply-To: <409722224.998228.1611507052697@mail1.libero.it> References: <20210123182711.7177-1-dariobin@libero.it> <20210123182711.7177-8-dariobin@libero.it> <409722224.998228.1611507052697@mail1.libero.it> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Dario, On Sun, 24 Jan 2021 at 09:50, Dario Binacchi wrote: > > > Hi Simon, > > > Il 24/01/2021 03:03 Simon Glass ha scritto: > > > > > > Hi Dario, > > > > On Sat, 23 Jan 2021 at 11:27, Dario Binacchi wrote: > > > > > > The patch allows you to call the read/write functions set during probing > > > without having to check the type of access at runtime. It also adds > > > functions for 8-bit registers access. > > > > > > Signed-off-by: Dario Binacchi > > > --- > > > > > > drivers/pinctrl/pinctrl-single.c | 98 ++++++++++++++++++++++++-------- > > > 1 file changed, 73 insertions(+), 25 deletions(-) > > > > I'm not really keen on this. A switch() statement is not expensive and > > function pointers add indirection/confusion and use more space. > > I think however it is better to create two static functions for reading/writing > operations (with a switch() statement inside). So as not to replicate the code. > Do you agree? Yes that sounds good to me. Regards, Simon