Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756099AbeAJN3z (ORCPT + 1 other); Wed, 10 Jan 2018 08:29:55 -0500 Received: from mail-qk0-f195.google.com ([209.85.220.195]:37292 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751195AbeAJN3x (ORCPT ); Wed, 10 Jan 2018 08:29:53 -0500 X-Google-Smtp-Source: ACJfBosBGmk+myzU7Dc9FNPY7ao7lBGRO6fnguDU4ZvHac4jA2DJmxshCKLpZbOoz9yHvdrFajEa3M9B/K1JiSQBaYs= MIME-Version: 1.0 In-Reply-To: References: <1515521301-4375-1-git-send-email-geert+renesas@glider.be> From: Geert Uytterhoeven Date: Wed, 10 Jan 2018 14:29:51 +0100 X-Google-Sender-Auth: 0GyD4148oYsg5wwqwBUdo4dPDHo Message-ID: Subject: Re: [PATCH] gpio: Add missing open drain/source handling to gpiod_set_value_cansleep() To: Linus Walleij Cc: Geert Uytterhoeven , Wolfram Sang , =?UTF-8?B?SmFuIEt1bmRyw6F0?= , =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , linux-gpio@vger.kernel.org, Linux I2C , Linux-Renesas , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Hi Linus, On Wed, Jan 10, 2018 at 2:17 PM, Linus Walleij wrote: > On Tue, Jan 9, 2018 at 7:08 PM, Geert Uytterhoeven > wrote: > >> Since commit f11a04464ae57e8d ("i2c: gpio: Enable working over slow >> can_sleep GPIOs"), probing the i2c RTC connected to an i2c-gpio bus on >> r8a7740/armadillo fails with: >> >> rtc-s35390a 0-0030: error resetting chip >> rtc-s35390a: probe of 0-0030 failed with error -5 >> >> More debug code reveals: >> >> i2c i2c-0: master_xfer[0] R, addr=0x30, len=1 >> i2c i2c-0: NAK from device addr 0x30 msg #0 >> s35390a_get_reg: ret = -6 >> >> Commit 02e479808b5d62f8 ("gpio: Alter semantics of *raw* operations to >> actually be raw") moved open drain/source handling from >> gpiod_set_raw_value_commit() to gpiod_set_value(), but forgot to take >> into account that gpiod_set_value_cansleep() also needs this handling. >> The i2c protocol mandates that i2c signals are open drain, hence i2c >> communication fails. >> >> Fix this by adding the missing handling to gpiod_set_value_cansleep(), >> using a new common helper __gpiod_set_value_nocheck(). >> >> Fixes: 02e479808b5d62f8 ("gpio: Alter semantics of *raw* operations to actually be raw") >> Signed-off-by: Geert Uytterhoeven >> --- >> The bad gpio commit is in v4.15-rc1 and later. >> The i2c commit exposing this is not yet upstream, but in i2c/for-next. > > Whoops! > > It appears Meltdown and Spectre saves my ass because now I have > time to get this upstream before v4.15... > > Applied for fixes with the following tweaks: I removed the __prefix (I don't > like them) and added kerneldoc. Looks good to me (also in git). Thanks! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds