Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753787AbZKITCP (ORCPT ); Mon, 9 Nov 2009 14:02:15 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753670AbZKITCO (ORCPT ); Mon, 9 Nov 2009 14:02:14 -0500 Received: from caffeine.csclub.uwaterloo.ca ([129.97.134.17]:37582 "EHLO caffeine.csclub.uwaterloo.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753627AbZKITCO (ORCPT ); Mon, 9 Nov 2009 14:02:14 -0500 Date: Mon, 9 Nov 2009 19:02:19 +0000 To: linux-kernel@vger.kernel.org Cc: Len Sorensen , netdev@vger.kernel.org, Paulius Zaleckas , Laurent Pinchart Subject: Fix gpio-mdio driver to work for gpio's that return something other than 0 and 1. Message-ID: <20091109190219.GB15159@caffeine.csclub.uwaterloo.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) From: lsorense@csclub.uwaterloo.ca (Lennart Sorensen) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1050 Lines: 27 The gpio-mdio driver seems to assume GPIOs return 0 and 1, although that doesn't seem to be the case. I see return values of 0 and 0x1000000 for the GPIO I happen to be using. A simple application of !! solves that though. Tested on a RuggedCom RX5000 (mpc8360e based). Signed-off-by: Lennart Sorensen diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c index 8659d34..7e76f0c 100644 --- a/drivers/net/phy/mdio-gpio.c +++ b/drivers/net/phy/mdio-gpio.c @@ -55,7 +55,7 @@ static int mdio_get(struct mdiobb_ctrl *ctrl) struct mdio_gpio_info *bitbang = container_of(ctrl, struct mdio_gpio_info, ctrl); - return gpio_get_value(bitbang->mdio); + return !!gpio_get_value(bitbang->mdio); } static void mdio_set(struct mdiobb_ctrl *ctrl, int what) -- 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/