Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752016AbbGOCN3 (ORCPT ); Tue, 14 Jul 2015 22:13:29 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48200 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751541AbbGOCN2 (ORCPT ); Tue, 14 Jul 2015 22:13:28 -0400 Date: Tue, 14 Jul 2015 19:13:27 -0700 From: Greg KH To: Fabio Falzoi Cc: thomas.petazzoni@free-electrons.com, noralf@tronnes.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 04/10] Staging: fbtft: Use a helper function to set write_register op Message-ID: <20150715021327.GB4788@kroah.com> References: <1435646597-7612-1-git-send-email-fabio.falzoi84@gmail.com> <1435646597-7612-5-git-send-email-fabio.falzoi84@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1435646597-7612-5-git-send-email-fabio.falzoi84@gmail.com> User-Agent: Mutt/1.5.23+102 (2ca89bed6448) (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2198 Lines: 74 On Tue, Jun 30, 2015 at 08:43:11AM +0200, Fabio Falzoi wrote: > Use a helper function to set the correct write_register function, based > on the width of the registers. > > Signed-off-by: Fabio Falzoi > --- > drivers/staging/fbtft/flexfb.c | 36 ++++++++++++++++++++++-------------- > 1 file changed, 22 insertions(+), 14 deletions(-) > > diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c > index 25b394d..dae092a 100644 > --- a/drivers/staging/fbtft/flexfb.c > +++ b/drivers/staging/fbtft/flexfb.c > @@ -363,6 +363,25 @@ static int flexfb_chip_init(const struct device *dev) > return -EINVAL; > } > > +static int flexfb_set_regwrite_func(const struct device *dev, > + struct fbtft_par *par) > +{ > + switch (regwidth) { > + case 8: > + par->fbtftops.write_register = fbtft_write_reg8_bus8; > + break; > + case 16: > + par->fbtftops.write_register = fbtft_write_reg16_bus8; > + break; > + default: > + dev_err(dev, "argument 'regwidth': %d is not supported.\n", > + regwidth); > + return -EINVAL; > + } > + > + return 0; > +} > + > static int flexfb_probe_common(struct spi_device *sdev, > struct platform_device *pdev) > { > @@ -413,20 +432,9 @@ static int flexfb_probe_common(struct spi_device *sdev, > par->init_sequence = initp; > par->fbtftops.init_display = fbtft_init_display; > > - /* registerwrite functions */ > - switch (regwidth) { > - case 8: > - par->fbtftops.write_register = fbtft_write_reg8_bus8; > - break; > - case 16: > - par->fbtftops.write_register = fbtft_write_reg16_bus8; > - break; > - default: > - dev_err(dev, > - "argument 'regwidth': %d is not supported.\n", > - regwidth); > - return -EINVAL; > - } > + ret = flexfb_set_regwrite_func(dev, par); > + if (ret) > + goto out_release; > > /* bus functions */ > if (sdev) { Why? You aren't calling this function anywhere else, so why move it? thanks, greg k-h -- 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/