Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753752Ab3JIMau (ORCPT ); Wed, 9 Oct 2013 08:30:50 -0400 Received: from mail-ie0-f172.google.com ([209.85.223.172]:38013 "EHLO mail-ie0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751380Ab3JIMas (ORCPT ); Wed, 9 Oct 2013 08:30:48 -0400 MIME-Version: 1.0 In-Reply-To: <1381235122-23730-2-git-send-email-christian.ruppert@abilis.com> References: <20131008122145.GA21985@ab42.lan> <1381235122-23730-2-git-send-email-christian.ruppert@abilis.com> Date: Wed, 9 Oct 2013 14:30:46 +0200 Message-ID: Subject: Re: [PATCH 02/03] pinmux: Add TB10x pinmux driver From: Linus Walleij To: Christian Ruppert Cc: Stephen Warren , Patrice CHOTARD , "linux-kernel@vger.kernel.org" , Grant Likely , Rob Herring , Rob Landley , Sascha Leuenberger , Pierrick Hascoet , "linux-doc@vger.kernel.org" , Alexandre Courbot , "devicetree@vger.kernel.org" Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2178 Lines: 67 On Tue, Oct 8, 2013 at 2:25 PM, Christian Ruppert wrote: > The pinmux driver of the Abilis Systems TB10x platform based on ARC700 CPUs. > Used to control the pinmux and is a prerequisite for the GPIO driver. > > Signed-off-by: Christian Ruppert > Signed-off-by: Pierrick Hascoet Overall this is looking pretty nice! > +static int tb10x_dt_node_to_map(struct pinctrl_dev *pctl, > + struct device_node *np_config, > + struct pinctrl_map **map, unsigned *num_maps) > +{ > + struct pinctrl_map *m; > + const char *string; > + > + if (of_property_read_string(np_config, "abilis,function", &string)) { > + pr_err("%s: No abilis,function property in device tree.\n", > + np_config->full_name); > + return -EINVAL; > + } > + > + m = kzalloc(sizeof(struct pinctrl_map), GFP_KERNEL); > + if (!m) > + return -ENOMEM; Could you make use of: #include "pinctrl-utils.h" pinctrl_utils_reserve_map() pinctrl_utils_add_map_mux() pinctrl_utils_dt_free_map() ? > +static int tb10x_gpio_request_enable(struct pinctrl_dev *pctl, > + struct pinctrl_gpio_range *range, > + unsigned pin) > +{ > + struct tb10x_pinctrl *state = pinctrl_dev_get_drvdata(pctl); > + int muxport = -1; > + int muxmode = -1; > + int i; > + > + mutex_lock(&state->mutex); > + > + /* Figure out to which port the requested GPIO belongs and how to > + * configure that port. > + * This loop also checks for pin conflicts between GPIOs and other > + * functions. > + */ /* * I really like all comments with a blank * line at the top and bottom like this. */ Yours, Linus Walleij -- 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/