From patchwork Fri Apr 13 10:24:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 133349 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp572898ljb; Fri, 13 Apr 2018 03:24:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx49PN23m2wYDSwnFbjslD+h2TrOS4xpFv6Cp0KqOcIn4BJIBppm4Hr5Lab0hLe3q2r2xoWU9 X-Received: by 2002:a17:902:44c:: with SMTP id 70-v6mr4667001ple.354.1523615069268; Fri, 13 Apr 2018 03:24:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523615069; cv=none; d=google.com; s=arc-20160816; b=yN7qzWnmIVGkMFb05GXEidPFbx8vVYW3TVLeFcVrX24SBdrrBSHjQRiEmsRbVUcXgS sNxiO3OsOG6Gwh7PQmlNbODwQNo8xVGYlEB237i1YkFzpEB9mnxFtmnEAqcFxvkg84i8 4kYDlCL5erdSfQRVIN06hHXxYHAUc8rmkhIX0vBmAK5ycQ8nxsCosEl4g082lQoDH8M+ BynVyAqkf5U6fksX4efYx5sg4hljy/kGtB/sANbButaNNdg0U/cTwHedMPIDD+n+4o7k urwAaSqXd8rqFBepIORAKVXeY107jZXl/nNmAK6BDKIYN6TNPqWrwnOF3etRIIS3JDq/ Izyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=xW7mMSl0CNCzRb2AVzDjLQthmNSFjVUfhDjtd1tAO38=; b=SshulalX58oNI3FRqxHaPeu4W452PSiNAaB4HLBU7wiWlqBOdV8Nugh9XZsgnL1iXR 17iii37iFl7kWy5XPky4XeQc3d5JKzajdPT1FKyedX5yTWLSes1v1hsqTCUOkhkFuAhe y5TV+wgvlYRJOHcnzGeUJsePkBn3GBw7e+0PuSz0sLArdN/qdqG1d/nO/VcO6wiss+Oj bgX7dDG8H/imP6Tu4whgOTqOw5fOC26uVEGCawuHA0rYlNJO7GOfG6WChVIlo+gyrfbJ KOxkiuUG/JqTyxPT/uWaRpZVhBtxu2MWbiIwYiIQlKaW76hYnWny/9w0+6Lbe6srUCN8 ArXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=XL0JSUsL; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 44-v6si5101266pla.376.2018.04.13.03.24.29; Fri, 13 Apr 2018 03:24:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=XL0JSUsL; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753076AbeDMKY2 (ORCPT + 5 others); Fri, 13 Apr 2018 06:24:28 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:33796 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750960AbeDMKY1 (ORCPT ); Fri, 13 Apr 2018 06:24:27 -0400 Received: by mail-lf0-f65.google.com with SMTP id r7-v6so4767612lfr.1 for ; Fri, 13 Apr 2018 03:24:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=sI4KHeJmJJitIJprqm3skr6oFmAjI0sQMaj0NB/vNz4=; b=XL0JSUsL5p4eHi4ygivCZ+H3RnSRKVIzR1pnWlhXUpT1GQ32tGYo5suiZY8RLRQGPe go5/dDza7D5ulXf49lENNBTOoZLS6aI2ScbjYp01/K7scrsH9Bvo3tfTo+CGYinpdWUd 238axNdzMy1DSJTudCUfa5oJN63Xy2BUhNAOE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=sI4KHeJmJJitIJprqm3skr6oFmAjI0sQMaj0NB/vNz4=; b=Ai+rIfL/6VirV5NjFkZxluBR2qjq0/KmvKC0kylaNcFCi42Pffe6jkECl9wf7yB9bA 58Rkt8e1+U278pq/bJl/qyfhngNw0Sij9z1nlq/QiZfr+d1JbfNLyz7ZYuc52M+p8lYD bGsRtPa/YTOFOh7ZWtWtnIdoVSmdLZ9zlBV/m6CGZGrNu64lMufIiUqSPhQRBfbeQidd MiL/Fxxyoo/N5lglCnDMcbOataReaAar5xH3Fj1bqEnxKT9yNB3QmznWm9p2qNZxDgtv E1leCsMaEWryPyIKJqpYoobLTqzbo0GQOrYSZgTRgqordVCi4iXIxfoJ950U7ziIXie+ I8Iw== X-Gm-Message-State: ALQs6tBcepkQvm2xSZjdcsy0ndkJ5//xwdLkpoz9vl7QkKSBkjkU0GNy N5ZEdbiEWEjvs64mQHGfdEWWKKozgIE= X-Received: by 2002:a19:1754:: with SMTP id n81-v6mr6912435lfi.113.1523615066125; Fri, 13 Apr 2018 03:24:26 -0700 (PDT) Received: from genomnajs.payandsurf.com ([192.36.80.8]) by smtp.gmail.com with ESMTPSA id c4sm915360lja.97.2018.04.13.03.24.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Apr 2018 03:24:25 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Linus Walleij , Keguang Zhang , Jiaxun Yang , Huacai Chen , linux-mips@linux-mips.org Subject: [PATCH 1/3] gpio: loongson: Use right include Date: Fri, 13 Apr 2018 12:24:19 +0200 Message-Id: <20180413102421.23939-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The driver includes which is wrong, rely on and remove to call to gpio_set_value() in favor of calling the internal function. Move functions around to avoid forward declarations. Cc: Keguang Zhang Cc: Jiaxun Yang Cc: Huacai Chen Cc: linux-mips@linux-mips.org Signed-off-by: Linus Walleij --- drivers/gpio/gpio-loongson.c | 66 ++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 33 deletions(-) -- 2.14.3 -- 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 --git a/drivers/gpio/gpio-loongson.c b/drivers/gpio/gpio-loongson.c index 92c4fe7b2677..973d82a29442 100644 --- a/drivers/gpio/gpio-loongson.c +++ b/drivers/gpio/gpio-loongson.c @@ -17,9 +17,9 @@ #include #include #include +#include #include #include -#include #define STLS2F_N_GPIO 4 #define STLS3A_N_GPIO 16 @@ -34,38 +34,6 @@ static DEFINE_SPINLOCK(gpio_lock); -static int loongson_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) -{ - u32 temp; - u32 mask; - - spin_lock(&gpio_lock); - mask = 1 << gpio; - temp = LOONGSON_GPIOIE; - temp |= mask; - LOONGSON_GPIOIE = temp; - spin_unlock(&gpio_lock); - - return 0; -} - -static int loongson_gpio_direction_output(struct gpio_chip *chip, - unsigned gpio, int level) -{ - u32 temp; - u32 mask; - - gpio_set_value(gpio, level); - spin_lock(&gpio_lock); - mask = 1 << gpio; - temp = LOONGSON_GPIOIE; - temp &= (~mask); - LOONGSON_GPIOIE = temp; - spin_unlock(&gpio_lock); - - return 0; -} - static int loongson_gpio_get_value(struct gpio_chip *chip, unsigned gpio) { u32 val; @@ -97,6 +65,38 @@ static void loongson_gpio_set_value(struct gpio_chip *chip, spin_unlock(&gpio_lock); } +static int loongson_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) +{ + u32 temp; + u32 mask; + + spin_lock(&gpio_lock); + mask = 1 << gpio; + temp = LOONGSON_GPIOIE; + temp |= mask; + LOONGSON_GPIOIE = temp; + spin_unlock(&gpio_lock); + + return 0; +} + +static int loongson_gpio_direction_output(struct gpio_chip *chip, + unsigned gpio, int level) +{ + u32 temp; + u32 mask; + + loongson_gpio_set_value(chip, gpio, level); + spin_lock(&gpio_lock); + mask = 1 << gpio; + temp = LOONGSON_GPIOIE; + temp &= (~mask); + LOONGSON_GPIOIE = temp; + spin_unlock(&gpio_lock); + + return 0; +} + static struct gpio_chip loongson_chip = { .label = "Loongson-gpio-chip", .direction_input = loongson_gpio_direction_input,