From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Warren Subject: Re: [PATCH v4 03/10] pwm: Add device tree support Date: Mon, 19 Mar 2012 20:12:51 -0600 Message-ID: <4F67E7A3.3090603@wwwdotorg.org> References: <1331740593-10807-1-git-send-email-thierry.reding@avionic-design.de> <1331740593-10807-4-git-send-email-thierry.reding@avionic-design.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1331740593-10807-4-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org> Sender: linux-tegra-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Thierry Reding Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Sascha Hauer , Arnd Bergmann , Matthias Kaehlcke , Kurt Van Dijck , Rob Herring , Grant Likely , Colin Cross , Olof Johansson , Richard Purdie , Mark Brown , Mitch Bradley , Mike Frysinger , Eric Miao , Lars-Peter Clausen , Ryan Mallon List-Id: linux-tegra@vger.kernel.org On 03/14/2012 09:56 AM, Thierry Reding wrote: > This patch adds helpers to support device tree bindings for the generic > PWM API. Device tree binding documentation for PWM controllers is also > provided. ... > +static struct pwm_device *of_pwm_simple_xlate(struct pwm_chip *pc, > + const struct of_phandle_args *args) ... > + if (args->args_count < pc->of_pwm_n_cells) > + return ERR_PTR(-EINVAL); I think you can drop that error-check given the code quoted below? (and if not, shouldn't it be != not >= ?) > +struct pwm_device *of_pwm_request(struct device_node *np, > + const char *propname, int index) ... > + if (args.args_count != pc->of_pwm_n_cells) { > + pr_debug("%s: wrong #pwm-cells for %s\n", np->full_name, > + args.np->full_name); > + pwm = ERR_PTR(-EINVAL); > + goto put; > + } > + > + pwm = pc->of_xlate(pc, &args);