diff mbox

[RFT,v2,3/3] gpio: mpc8xxx: Slightly update the code for better readability

Message ID 1456125894.27297.2.camel@ingics.com
State New
Headers show

Commit Message

Axel Lin Feb. 22, 2016, 7:24 a.m. UTC
Setting gc->direction_output to gc->direction_output looks strange.
I think this change makes the intention more clear.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/gpio/gpio-mpc8xxx.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Liu Gang March 2, 2016, 7:32 a.m. UTC | #1
On 2/22/2016 3:25 PM, Axel Lin wrote:
> Setting gc->direction_output to gc->direction_output looks strange.
> I think this change makes the intention more clear.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>  drivers/gpio/gpio-mpc8xxx.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
> index bc042ad6..425501c 100644
> --- a/drivers/gpio/gpio-mpc8xxx.c
> +++ b/drivers/gpio/gpio-mpc8xxx.c
> @@ -339,8 +339,11 @@ static int mpc8xxx_probe(struct platform_device *pdev)
>  	 */
>  	mpc8xxx_irq_chip.irq_set_type = devtype->irq_set_type;
>  
> -	gc->direction_output = devtype->gpio_dir_out ?: gc->direction_output;
> -	gc->get = devtype->gpio_get ?: gc->get;
> +	if (devtype->gpio_dir_out)
> +		gc->direction_output = devtype->gpio_dir_out;
> +	if (devtype->gpio_get)
> +		gc->get = devtype->gpio_get;
> +
>  	gc->to_irq = mpc8xxx_gpio_to_irq;
>  
>  	ret = gpiochip_add_data(gc, mpc8xxx_gc);
Ok, maybe it's more clear.

Liu Gang
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij March 9, 2016, 3:44 a.m. UTC | #2
On Mon, Feb 22, 2016 at 2:24 PM, Axel Lin <axel.lin@ingics.com> wrote:

> Setting gc->direction_output to gc->direction_output looks strange.
> I think this change makes the intention more clear.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

Patch applied.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
index bc042ad6..425501c 100644
--- a/drivers/gpio/gpio-mpc8xxx.c
+++ b/drivers/gpio/gpio-mpc8xxx.c
@@ -339,8 +339,11 @@  static int mpc8xxx_probe(struct platform_device *pdev)
 	 */
 	mpc8xxx_irq_chip.irq_set_type = devtype->irq_set_type;
 
-	gc->direction_output = devtype->gpio_dir_out ?: gc->direction_output;
-	gc->get = devtype->gpio_get ?: gc->get;
+	if (devtype->gpio_dir_out)
+		gc->direction_output = devtype->gpio_dir_out;
+	if (devtype->gpio_get)
+		gc->get = devtype->gpio_get;
+
 	gc->to_irq = mpc8xxx_gpio_to_irq;
 
 	ret = gpiochip_add_data(gc, mpc8xxx_gc);