Re: [PATCH 02/03] pinmux: Add TB10x pinmux driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 8, 2013 at 2:25 PM, Christian Ruppert
<christian.ruppert@xxxxxxxxxx> 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 <christian.ruppert@xxxxxxxxxx>
> Signed-off-by: Pierrick Hascoet <pierrick.hascoet@xxxxxxxxxx>

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-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux