Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754276AbdLGOwW (ORCPT ); Thu, 7 Dec 2017 09:52:22 -0500 Received: from mail-qt0-f196.google.com ([209.85.216.196]:42419 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753926AbdLGOwT (ORCPT ); Thu, 7 Dec 2017 09:52:19 -0500 X-Google-Smtp-Source: AGs4zMZQ2uJqKI50s+s1iIQ/egPHO1TBojYrPg4DprCRNHXSzXm3KX+C2fcy/3xOVg5CWZISySDazOzDGjY9/jMWYZE= MIME-Version: 1.0 In-Reply-To: <20171207144358.3351-2-dev@g0hl1n.net> References: <20171207144358.3351-1-dev@g0hl1n.net> <20171207144358.3351-2-dev@g0hl1n.net> From: Geert Uytterhoeven Date: Thu, 7 Dec 2017 15:52:17 +0100 X-Google-Sender-Auth: cxxSTWIb6lWYSyD0AfhO3uxvHmo Message-ID: Subject: Re: [PATCH net-next v4 1/4] phylib: Add device reset delay support To: Richard Leitner Cc: Rob Herring , Mark Rutland , Fugang Duan , Andrew Lunn , Florian Fainelli , Frank Rowand , "David S. Miller" , Geert Uytterhoeven , Sergei Shtylyov , Baruch Siach , David Wu , lukma@denx.de, "netdev@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Richard Leitner Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1343 Lines: 45 Hi Richard, On Thu, Dec 7, 2017 at 3:43 PM, Richard Leitner wrote: > --- a/drivers/net/phy/mdio_device.c > +++ b/drivers/net/phy/mdio_device.c > @@ -24,6 +24,7 @@ > #include > #include > #include > +#include > > void mdio_device_free(struct mdio_device *mdiodev) > { > @@ -118,8 +119,16 @@ EXPORT_SYMBOL(mdio_device_remove); > > void mdio_device_reset(struct mdio_device *mdiodev, int value) > { > - if (mdiodev->reset) > - gpiod_set_value(mdiodev->reset, value); > + unsigned int d; > + > + if (!mdiodev->reset) > + return; > + > + gpiod_set_value(mdiodev->reset, value); > + > + d = value ? mdiodev->reset_delay : mdiodev->reset_post_delay; > + if (d) > + usleep_range(d, d + min_t(unsigned int, d / 10, 100)); Oops, I meant "max_t", not "min_t", else the upper limit can be "d + 0", which is not what we want. Sorry, my fault. 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