From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754341AbbCLWob (ORCPT ); Thu, 12 Mar 2015 18:44:31 -0400 Received: from mail-gw3-out.broadcom.com ([216.31.210.64]:55034 "EHLO mail-gw3-out.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751009AbbCLWo2 (ORCPT ); Thu, 12 Mar 2015 18:44:28 -0400 X-IronPort-AV: E=Sophos;i="5.11,391,1422950400"; d="scan'208";a="59176972" Message-ID: <550216C3.8090807@broadcom.com> Date: Thu, 12 Mar 2015 15:44:19 -0700 From: Jonathan Richardson User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Joe Perches CC: Dmitry Torokhov , Anatol Pomazau , Scott Branden , Grant Likely , Rob Herring , Ray Jui , , , bcm-kernel-feedback-list , , Pawel Moll , Mark Rutland , "Ian Campbell" , Kumar Gala Subject: Re: [PATCH v4 1/2] Input: touchscreen-iproc: Add Broadcom iProc touchscreen driver References: <1426182312-6081-1-git-send-email-jonathar@broadcom.com> <1426182312-6081-2-git-send-email-jonathar@broadcom.com> <1426183169.2742.10.camel@perches.com> In-Reply-To: <1426183169.2742.10.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15-03-12 10:59 AM, Joe Perches wrote: > On Thu, 2015-03-12 at 10:45 -0700, Jonathan Richardson wrote: >> Add initial version of the Broadcom touchscreen driver. > > style trivia: > (any of which could be fixed/improved/ignored later) > >> diff --git a/drivers/input/touchscreen/bcm_iproc_tsc.c b/drivers/input/touchscreen/bcm_iproc_tsc.c > [] >> +static void ts_reg_dump(struct iproc_ts_priv *priv) >> +{ >> + struct device *dev = &priv->pdev->dev; >> + >> + dev_dbg(dev, "regCtl1 = 0x%08x\n", >> + readl(priv->regs + REGCTL1)); > > The output case here generally isn't very important so > sometimes it's better to use a macro like: > > #define dbg_reg(dev, priv, reg) \ > dev_dbg(dev, "%20s= 0x%08x\n", #reg, readl((priv)->regs + reg)) > >> + dev_dbg(dev, "regCtl2 = 0x%08x\n", >> + readl(priv->regs + REGCTL2)); > > so these become > dbg_reg(dev, priv, INTERRUPT_THRES); > dbg_reg(dev, priv, INTERRUPT_MASK); > > etc... > > This style can reduce typo and copy/paste defects. > >> + dev_dbg(dev, "interrupt_Thres = 0x%08x\n", >> + readl(priv->regs + INTERRUPT_THRES)); >> + dev_dbg(dev, "interrupt_Mask = 0x%08x\n", >> + readl(priv->regs + INTERRUPT_MASK)); >> + dev_dbg(dev, "interrupt_Status = 0x%08x\n", >> + readl(priv->regs + INTERRUPT_STATUS)); >> + dev_dbg(dev, "controller_Status = 0x%08x\n", >> + readl(priv->regs + CONTROLLER_STATUS)); >> + dev_dbg(dev, "FIFO_Data = 0x%08x\n", >> + readl(priv->regs + FIFO_DATA)); >> + dev_dbg(dev, "analog_Control = 0x%08x\n", >> + readl(priv->regs + ANALOG_CONTROL)); >> + dev_dbg(dev, "aux_Data = 0x%08x\n", >> + readl(priv->regs + AUX_DATA)); >> + dev_dbg(dev, "debounce_Cntr_Stat = 0x%08x\n", >> + readl(priv->regs + DEBOUNCE_CNTR_STAT)); >> + dev_dbg(dev, "scan_Cntr_Stat = 0x%08x\n", >> + readl(priv->regs + SCAN_CNTR_STAT)); >> + dev_dbg(dev, "rem_Cntr_Stat = 0x%08x\n", >> + readl(priv->regs + REM_CNTR_STAT)); >> + dev_dbg(dev, "settling_Timer_Stat = 0x%08x\n", >> + readl(priv->regs + SETTLING_TIMER_STAT)); >> + dev_dbg(dev, "spare_Reg = 0x%08x\n", >> + readl(priv->regs + SPARE_REG)); >> + dev_dbg(dev, "soft_Bypass_Control = 0x%08x\n", >> + readl(priv->regs + SOFT_BYPASS_CONTROL)); >> + dev_dbg(dev, "soft_Bypass_Data = 0x%08x\n", >> + readl(priv->regs + SOFT_BYPASS_DATA)); >> +} > > [] > >> +static int get_tsc_config(struct device_node *np, struct iproc_ts_priv *priv) >> +{ >> + u32 val; > [] >> + if (of_property_read_u32(np, "debounce_timeout", &val) >= 0) { >> + if (val < 0 || val > 255) { > > testing u32 < 0 isn't necessary. > > Maybe it'd be better to emit the out of range value too > >> + dev_err(dev, "debounce_timeout must be [0-255]\n"); > > dev_err(dev, "debounce_timeout (%u) must be [0-255]\n", val); > > Thanks. I'll make the suggested changes and send out a new patch. Jon From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonathan Richardson Subject: Re: [PATCH v4 1/2] Input: touchscreen-iproc: Add Broadcom iProc touchscreen driver Date: Thu, 12 Mar 2015 15:44:19 -0700 Message-ID: <550216C3.8090807@broadcom.com> References: <1426182312-6081-1-git-send-email-jonathar@broadcom.com> <1426182312-6081-2-git-send-email-jonathar@broadcom.com> <1426183169.2742.10.camel@perches.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1426183169.2742.10.camel-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Joe Perches Cc: Dmitry Torokhov , Anatol Pomazau , Scott Branden , Grant Likely , Rob Herring , Ray Jui , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, bcm-kernel-feedback-list , devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala List-Id: devicetree@vger.kernel.org On 15-03-12 10:59 AM, Joe Perches wrote: > On Thu, 2015-03-12 at 10:45 -0700, Jonathan Richardson wrote: >> Add initial version of the Broadcom touchscreen driver. > > style trivia: > (any of which could be fixed/improved/ignored later) > >> diff --git a/drivers/input/touchscreen/bcm_iproc_tsc.c b/drivers/input/touchscreen/bcm_iproc_tsc.c > [] >> +static void ts_reg_dump(struct iproc_ts_priv *priv) >> +{ >> + struct device *dev = &priv->pdev->dev; >> + >> + dev_dbg(dev, "regCtl1 = 0x%08x\n", >> + readl(priv->regs + REGCTL1)); > > The output case here generally isn't very important so > sometimes it's better to use a macro like: > > #define dbg_reg(dev, priv, reg) \ > dev_dbg(dev, "%20s= 0x%08x\n", #reg, readl((priv)->regs + reg)) > >> + dev_dbg(dev, "regCtl2 = 0x%08x\n", >> + readl(priv->regs + REGCTL2)); > > so these become > dbg_reg(dev, priv, INTERRUPT_THRES); > dbg_reg(dev, priv, INTERRUPT_MASK); > > etc... > > This style can reduce typo and copy/paste defects. > >> + dev_dbg(dev, "interrupt_Thres = 0x%08x\n", >> + readl(priv->regs + INTERRUPT_THRES)); >> + dev_dbg(dev, "interrupt_Mask = 0x%08x\n", >> + readl(priv->regs + INTERRUPT_MASK)); >> + dev_dbg(dev, "interrupt_Status = 0x%08x\n", >> + readl(priv->regs + INTERRUPT_STATUS)); >> + dev_dbg(dev, "controller_Status = 0x%08x\n", >> + readl(priv->regs + CONTROLLER_STATUS)); >> + dev_dbg(dev, "FIFO_Data = 0x%08x\n", >> + readl(priv->regs + FIFO_DATA)); >> + dev_dbg(dev, "analog_Control = 0x%08x\n", >> + readl(priv->regs + ANALOG_CONTROL)); >> + dev_dbg(dev, "aux_Data = 0x%08x\n", >> + readl(priv->regs + AUX_DATA)); >> + dev_dbg(dev, "debounce_Cntr_Stat = 0x%08x\n", >> + readl(priv->regs + DEBOUNCE_CNTR_STAT)); >> + dev_dbg(dev, "scan_Cntr_Stat = 0x%08x\n", >> + readl(priv->regs + SCAN_CNTR_STAT)); >> + dev_dbg(dev, "rem_Cntr_Stat = 0x%08x\n", >> + readl(priv->regs + REM_CNTR_STAT)); >> + dev_dbg(dev, "settling_Timer_Stat = 0x%08x\n", >> + readl(priv->regs + SETTLING_TIMER_STAT)); >> + dev_dbg(dev, "spare_Reg = 0x%08x\n", >> + readl(priv->regs + SPARE_REG)); >> + dev_dbg(dev, "soft_Bypass_Control = 0x%08x\n", >> + readl(priv->regs + SOFT_BYPASS_CONTROL)); >> + dev_dbg(dev, "soft_Bypass_Data = 0x%08x\n", >> + readl(priv->regs + SOFT_BYPASS_DATA)); >> +} > > [] > >> +static int get_tsc_config(struct device_node *np, struct iproc_ts_priv *priv) >> +{ >> + u32 val; > [] >> + if (of_property_read_u32(np, "debounce_timeout", &val) >= 0) { >> + if (val < 0 || val > 255) { > > testing u32 < 0 isn't necessary. > > Maybe it'd be better to emit the out of range value too > >> + dev_err(dev, "debounce_timeout must be [0-255]\n"); > > dev_err(dev, "debounce_timeout (%u) must be [0-255]\n", val); > > Thanks. I'll make the suggested changes and send out a new patch. Jon -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html