From patchwork Fri Oct 2 23:21:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 7319741 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EAA6A9F1B9 for ; Fri, 2 Oct 2015 23:21:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E2DBC2086D for ; Fri, 2 Oct 2015 23:21:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 95F0D20850 for ; Fri, 2 Oct 2015 23:21:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750998AbbJBXVU (ORCPT ); Fri, 2 Oct 2015 19:21:20 -0400 Received: from mail-lb0-f179.google.com ([209.85.217.179]:34676 "EHLO mail-lb0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750709AbbJBXVT (ORCPT ); Fri, 2 Oct 2015 19:21:19 -0400 Received: by lbbmp1 with SMTP id mp1so34020934lbb.1 for ; Fri, 02 Oct 2015 16:21:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=NPg/B+dg0HI0aN2/iHvPpeA6kQmgYMclE2FLpsdcSSI=; b=CmlVpL6c1MKSEc4dTpWzDW2q21QgrH1jnNmD8NtZSSW8FNvuoDbzAPS9J1EY+3usLK 5uw2kciXQClhJNtzPL5+jo+DEPs9cQ+ccTeHzXk1OOFGI+N+JNv4pZxgoGMyog784zIo ggxq2JXXIU4z8w2tUspqIKIgWaYdpohdkPdQy5ZvU7PXrIeCfMXtQaFre7xovwN7Ztu+ KP4H68n2THaNrh8cAQHq4jGa9s3sMvqWq14XV1UzBtahzFeKAHNZrdp8/T/eCdToJoRH +mDzzZXtN2lmO+mFnzKIJU6+LUXOSO8mEDiamFRTXzVtcSIqTLu3EztUBmscgFRycChx Lf0A== X-Gm-Message-State: ALoCoQnoPTbLXQ8zN43l0DiMelbnB99Ah75lf53/413WN74MEi4ViuDbQzVfvmLnSge2b5WyKnlg X-Received: by 10.112.64.228 with SMTP id r4mr6910505lbs.80.1443828077287; Fri, 02 Oct 2015 16:21:17 -0700 (PDT) Received: from wasted.cogentembedded.com (ppp83-237-252-142.pppoe.mtu-net.ru. [83.237.252.142]) by smtp.gmail.com with ESMTPSA id d187sm1929837lfd.3.2015.10.02.16.21.15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Oct 2015 16:21:16 -0700 (PDT) From: Sergei Shtylyov To: linus.walleij@linaro.org, linux-sh@vger.kernel.org, laurent.pinchart@ideasonboard.com, linux-gpio@vger.kernel.org Subject: [PATCH v3] pinctrl: sh-pfc: r8a779[01]: move 'union vin_data' to shared header file Date: Sat, 03 Oct 2015 02:21:15 +0300 Message-ID: <5498069.3NrXYzuRL0@wasted.cogentembedded.com> Organization: Cogent Embedded Inc. User-Agent: KMail/4.14.9 (Linux/4.1.7-100.fc21.x86_64; KDE/4.14.9; x86_64; ; ) In-Reply-To: <13219129.kD4pZSmcAP@wasted.cogentembedded.com> References: <13219129.kD4pZSmcAP@wasted.cogentembedded.com> MIME-Version: 1.0 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP R8A7790/1 PFC drivers use almost identical 'union vin_data' and completely identical VIN_DATA_PIN_GROUP() macro; we thus can move them into the shared header file... Suggested-by: Geert Uytterhoeven Signed-off-by: Sergei Shtylyov Acked-by: Geert Uytterhoeven Acked-by: Laurent Pinchart --- The patch is against the 'devel' branch of Linus W.'s 'linux-pinctrl.git' repo. Changes in version 3: - added a comment to the common header file; - added Laurent's ACK. Changes in version 2: - removed leftover empty line from the R8A7790 driver; - added Geert's ACK. drivers/pinctrl/sh-pfc/pfc-r8a7790.c | 19 ------------------- drivers/pinctrl/sh-pfc/pfc-r8a7791.c | 18 ------------------ drivers/pinctrl/sh-pfc/sh_pfc.h | 23 +++++++++++++++++++++++ 3 files changed, 23 insertions(+), 37 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-pinctrl/drivers/pinctrl/sh-pfc/pfc-r8a7790.c =================================================================== --- linux-pinctrl.orig/drivers/pinctrl/sh-pfc/pfc-r8a7790.c +++ linux-pinctrl/drivers/pinctrl/sh-pfc/pfc-r8a7790.c @@ -3624,25 +3624,6 @@ static const unsigned int usb2_pins[] = static const unsigned int usb2_mux[] = { USB2_PWEN_MARK, USB2_OVC_MARK, }; - -union vin_data { - unsigned int data24[24]; - unsigned int data20[20]; - unsigned int data16[16]; - unsigned int data12[12]; - unsigned int data10[10]; - unsigned int data8[8]; - unsigned int data4[4]; -}; - -#define VIN_DATA_PIN_GROUP(n, s) \ - { \ - .name = #n#s, \ - .pins = n##_pins.data##s, \ - .mux = n##_mux.data##s, \ - .nr_pins = ARRAY_SIZE(n##_pins.data##s), \ - } - /* - VIN0 ------------------------------------------------------------------- */ static const union vin_data vin0_data_pins = { .data24 = { Index: linux-pinctrl/drivers/pinctrl/sh-pfc/pfc-r8a7791.c =================================================================== --- linux-pinctrl.orig/drivers/pinctrl/sh-pfc/pfc-r8a7791.c +++ linux-pinctrl/drivers/pinctrl/sh-pfc/pfc-r8a7791.c @@ -3986,24 +3986,6 @@ static const unsigned int usb1_mux[] = { USB1_PWEN_MARK, USB1_OVC_MARK, }; - -union vin_data { - unsigned int data24[24]; - unsigned int data20[20]; - unsigned int data16[16]; - unsigned int data12[12]; - unsigned int data10[10]; - unsigned int data8[8]; -}; - -#define VIN_DATA_PIN_GROUP(n, s) \ - { \ - .name = #n#s, \ - .pins = n##_pins.data##s, \ - .mux = n##_mux.data##s, \ - .nr_pins = ARRAY_SIZE(n##_pins.data##s), \ - } - /* - VIN0 ------------------------------------------------------------------- */ static const union vin_data vin0_data_pins = { .data24 = { Index: linux-pinctrl/drivers/pinctrl/sh-pfc/sh_pfc.h =================================================================== --- linux-pinctrl.orig/drivers/pinctrl/sh-pfc/sh_pfc.h +++ linux-pinctrl/drivers/pinctrl/sh-pfc/sh_pfc.h @@ -52,6 +52,29 @@ struct sh_pfc_pin_group { unsigned int nr_pins; }; +/* + * Using union vin_data saves memory occupied by the VIN data pins. + * VIN_DATA_PIN_GROUP() is a macro used to describe the VIN pin groups + * in this case. + */ +#define VIN_DATA_PIN_GROUP(n, s) \ + { \ + .name = #n#s, \ + .pins = n##_pins.data##s, \ + .mux = n##_mux.data##s, \ + .nr_pins = ARRAY_SIZE(n##_pins.data##s), \ + } + +union vin_data { + unsigned int data24[24]; + unsigned int data20[20]; + unsigned int data16[16]; + unsigned int data12[12]; + unsigned int data10[10]; + unsigned int data8[8]; + unsigned int data4[4]; +}; + #define SH_PFC_FUNCTION(n) \ { \ .name = #n, \