From patchwork Wed Apr 14 20:33:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 421433 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E06CC433B4 for ; Wed, 14 Apr 2021 20:34:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 597C961177 for ; Wed, 14 Apr 2021 20:34:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244721AbhDNUe0 (ORCPT ); Wed, 14 Apr 2021 16:34:26 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:50452 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243809AbhDNUeY (ORCPT ); Wed, 14 Apr 2021 16:34:24 -0400 Received: from mail-ej1-f70.google.com ([209.85.218.70]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lWmD3-0007Qc-MV for linux-samsung-soc@vger.kernel.org; Wed, 14 Apr 2021 20:34:01 +0000 Received: by mail-ej1-f70.google.com with SMTP id c18-20020a17090603d2b029037c77ad778eso217701eja.1 for ; Wed, 14 Apr 2021 13:34:01 -0700 (PDT) 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:mime-version :content-transfer-encoding; bh=x2hO5DXMeLJZo3Sq4pJYNG0FO8H5GrNmCBQcI+p7buM=; b=a2LjFkghuwmUPKd6maMUl1AYsLnemKpNm3r1RRVM36JtK48zlaxBWH6P2dBdVxAXUE KhluGEb5XiJA0K8VWU4OW1c2Vh18+8kjU7+s6tmMul2BQ76yEvCKyBLywt2DA5HSghUs MYf5Dd3Jc7s6+4RAd2mwcqQEsL12HFwDxO25uvsOKtchQeFSrCW8DIKlLM5KZogT+xAZ OZjFPH4ONL8eMpw7yHzjs9gTSf7mRU0KJ9/Cl1J+znI0K+p/ynJSEbZUOWj+yCKLLkYS FRTTEKlFLfBGhShFHyb2rTlbM8LT+LZDXd1kiQsKD7TJsGooPh8/5kyD5zHBmK/wOlQC YY7Q== X-Gm-Message-State: AOAM531BIqKEDEUf1qEdH0cx92KaOocnNYPTXGYcVYIXMIdc3fjeV0QS fRDeADNBimSTuBD+z7BuEDSb0Ht5dtvbTocTLKNtuqb/5mepaPww9oU0cwYkibEdMUotstfcOUb gWmLHUbl3qLmdPzeDy7563Dn2rXCahl5r2DeOBTE2ZOMmByEp X-Received: by 2002:a05:6402:5189:: with SMTP id q9mr72096edd.168.1618432441434; Wed, 14 Apr 2021 13:34:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8Z5ptlAYigxFNCd5S/xT8AwrP3ue/ADlxR9AJcWKfkq3TLq+hwkPI3X1JJfIFB9MPghvAVg== X-Received: by 2002:a05:6402:5189:: with SMTP id q9mr72086edd.168.1618432441295; Wed, 14 Apr 2021 13:34:01 -0700 (PDT) Received: from localhost.localdomain (xdsl-188-155-192-147.adslplus.ch. [188.155.192.147]) by smtp.gmail.com with ESMTPSA id q6sm372209ejt.51.2021.04.14.13.34.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Apr 2021 13:34:00 -0700 (PDT) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Andi Shyti , Mark Brown , linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki Subject: [PATCH 1/3] spi: s3c64xx: simplify getting of_device_id match data Date: Wed, 14 Apr 2021 22:33:41 +0200 Message-Id: <20210414203343.203119-1-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Use of_device_get_match_data() to make the code slightly smaller and to remove the of_device_id table forward declaration. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Sylwester Nawrocki --- drivers/spi/spi-s3c64xx.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index dfa7c91e13aa..c6d7641ea342 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -1048,17 +1049,12 @@ static struct s3c64xx_spi_info *s3c64xx_spi_parse_dt(struct device *dev) } #endif -static const struct of_device_id s3c64xx_spi_dt_match[]; - static inline struct s3c64xx_spi_port_config *s3c64xx_spi_get_port_config( struct platform_device *pdev) { #ifdef CONFIG_OF - if (pdev->dev.of_node) { - const struct of_device_id *match; - match = of_match_node(s3c64xx_spi_dt_match, pdev->dev.of_node); - return (struct s3c64xx_spi_port_config *)match->data; - } + if (pdev->dev.of_node) + return (struct s3c64xx_spi_port_config *)of_device_get_match_data(&pdev->dev); #endif return (struct s3c64xx_spi_port_config *) platform_get_device_id(pdev)->driver_data; From patchwork Wed Apr 14 20:33:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 422105 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D13B4C43460 for ; Wed, 14 Apr 2021 20:34:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A0EE96008E for ; Wed, 14 Apr 2021 20:34:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243809AbhDNUe1 (ORCPT ); Wed, 14 Apr 2021 16:34:27 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:50458 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244242AbhDNUeZ (ORCPT ); Wed, 14 Apr 2021 16:34:25 -0400 Received: from mail-ed1-f69.google.com ([209.85.208.69]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lWmD4-0007R9-PO for linux-samsung-soc@vger.kernel.org; Wed, 14 Apr 2021 20:34:02 +0000 Received: by mail-ed1-f69.google.com with SMTP id r4-20020a0564022344b0290382ce72b7f9so3935226eda.19 for ; Wed, 14 Apr 2021 13:34:02 -0700 (PDT) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=6iWJ3bgZpUCfwGeaD2iQV5boaIsrvYIQwgNIcJKkeRc=; b=bj8JuV9Lckfaghcwn8IQIxrVSrGAKBzscxCyLGHHt0OTRB/y8HCSzydB9KCw8eIm89 Rxy5s2GR6OpIpBAslmxl1iVJcsam+TobHVQ+wjpQsIjp4d/nBZbfJ14w+OUCt64K2iD0 6/npQtB6VlD+Xxd59CzSmDGjZhvgtYrJpuOcqT/JzaUmZ/lmbZX0q3MdOB0czaMsvvCj 75IqtRd5aBY3iCLEIvZyXdbXBjbeqZH2U5/vy7x78PlcJiUUD2eeRZsrzgJi4FN4S79K a8tUy7U6mUn16+DvP+WW2uIoJtGTzwJS6gzGtzAumprdIv60JK4BAF8Cr7b1JKcWJTJd FiGQ== X-Gm-Message-State: AOAM530N1MFkrFGniOrs7027dzTCgDkf22lBXWIy8gZdlkLeVtUgQ0DX UGv0uHxsSibczHZbtlvvaS8oo8KFZEqmrMRoz3rgwvWyvDoXVZdbalKPOyHQZKnhnHUeZKSZl8+ 8klISFR1iOdBWrmfZ8b8asjB3m+xcWko8jIALIcrCeDeF0oHj X-Received: by 2002:a05:6402:34d5:: with SMTP id w21mr87966edc.14.1618432442539; Wed, 14 Apr 2021 13:34:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgIg2g0mP+FUvTRFflQtwAfKDR1XJ2BSwJmU+aJUp/4sLcSAVyFpDY3szKBQWx2xkzpd2sKg== X-Received: by 2002:a05:6402:34d5:: with SMTP id w21mr87946edc.14.1618432442372; Wed, 14 Apr 2021 13:34:02 -0700 (PDT) Received: from localhost.localdomain (xdsl-188-155-192-147.adslplus.ch. [188.155.192.147]) by smtp.gmail.com with ESMTPSA id q6sm372209ejt.51.2021.04.14.13.34.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Apr 2021 13:34:02 -0700 (PDT) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Andi Shyti , Mark Brown , linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki Subject: [PATCH 2/3] spi: s3c64xx: correct kerneldoc of s3c64xx_spi_port_config Date: Wed, 14 Apr 2021 22:33:42 +0200 Message-Id: <20210414203343.203119-2-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210414203343.203119-1-krzysztof.kozlowski@canonical.com> References: <20210414203343.203119-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Correct the name of s3c64xx_spi_port_config structure in kerneldoc: drivers/spi/spi-s3c64xx.c:154: warning: expecting prototype for struct s3c64xx_spi_info. Prototype was for struct s3c64xx_spi_port_config instead Signed-off-by: Krzysztof Kozlowski Reviewed-by: Sylwester Nawrocki --- drivers/spi/spi-s3c64xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index c6d7641ea342..eac3c300f806 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -128,7 +128,7 @@ struct s3c64xx_spi_dma_data { }; /** - * struct s3c64xx_spi_info - SPI Controller hardware info + * struct s3c64xx_spi_port_config - SPI Controller hardware info * @fifo_lvl_mask: Bit-mask for {TX|RX}_FIFO_LVL bits in SPI_STATUS register. * @rx_lvl_offset: Bit offset of RX_FIFO_LVL bits in SPI_STATUS regiter. * @tx_st_done: Bit offset of TX_DONE bit in SPI_STATUS regiter. From patchwork Wed Apr 14 20:33:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 421432 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EE57C43460 for ; Wed, 14 Apr 2021 20:34:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0567261177 for ; Wed, 14 Apr 2021 20:34:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244900AbhDNUe3 (ORCPT ); Wed, 14 Apr 2021 16:34:29 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:50469 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244806AbhDNUe0 (ORCPT ); Wed, 14 Apr 2021 16:34:26 -0400 Received: from mail-ej1-f72.google.com ([209.85.218.72]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lWmD5-0007Rl-VY for linux-samsung-soc@vger.kernel.org; Wed, 14 Apr 2021 20:34:04 +0000 Received: by mail-ej1-f72.google.com with SMTP id r17-20020a1709069591b029037cf6a4a56dso219436ejx.12 for ; Wed, 14 Apr 2021 13:34:03 -0700 (PDT) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=EnsBrJR/4Jhy/GeQbcflnHQbmvQg6xzGpkQctWEUZLc=; b=H8zSljEE7p4uLpg7ufmCpPFaJYKsjJJpPwsvDQEAtoX4SXOzXgKcP/ERPoBQ6yKdo8 /5m5fwNrxq+Qshp5pf4QKw9xoo9UxbEKsDpgZiuCLnUZ2brJREGGWWNW3+gyOnr+BSyr UkIthguINku+9fkiGKdku4vSKa4cMxnullmOI7PxS4R01p05hT3515xd9VB8CpsGPISH YiygWmuJ2HQqg36lP5Q/5rqcL8a54Wo49/XI8TYkqgpg8XKqQNgUS0GzYejTVznkjtgK F1pCDrMvk2p5oReG9SKsF41tGqZIU0lWJJdoEM8sb5mdWi+Ol0nGn22Q4ynw5cW3N5gD iYGw== X-Gm-Message-State: AOAM531rkw07WNSNSWGHmCCiNIKpeFlaBGQiH9iJl5Ugt6RyXyPCPpfb pj+sD9zQ5rp3h28xUmYQ6N8moZMMFH0tEeA1IAxZtDAVjak9lYnpLgn6OXa4VizumZsHmD3o86W dTYvQf7p7zIbpTk2TRXlJS4JTVKziYk4pcnZ6IxqsumXdzJRu X-Received: by 2002:a05:6402:3092:: with SMTP id de18mr77344edb.96.1618432443691; Wed, 14 Apr 2021 13:34:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4ge9Wh6Dy2ti9MnagPxtY+Lp7PT4OXoKWYxYA7ocEK2jErwNRrZdhQ86yjzHKPsL2D62BKQ== X-Received: by 2002:a05:6402:3092:: with SMTP id de18mr77329edb.96.1618432443522; Wed, 14 Apr 2021 13:34:03 -0700 (PDT) Received: from localhost.localdomain (xdsl-188-155-192-147.adslplus.ch. [188.155.192.147]) by smtp.gmail.com with ESMTPSA id q6sm372209ejt.51.2021.04.14.13.34.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Apr 2021 13:34:03 -0700 (PDT) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Andi Shyti , Mark Brown , linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki Subject: [PATCH 3/3] spi: s3c64xx: constify driver/match data Date: Wed, 14 Apr 2021 22:33:43 +0200 Message-Id: <20210414203343.203119-3-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210414203343.203119-1-krzysztof.kozlowski@canonical.com> References: <20210414203343.203119-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org The match data (struct s3c64xx_spi_port_config) stored in of_device_id and platform_device_id tables is not modified by the driver and can be handled entirely in a const-way to increase the code safety. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Sylwester Nawrocki --- drivers/spi/spi-s3c64xx.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index eac3c300f806..8755cd85e83c 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -190,7 +190,7 @@ struct s3c64xx_spi_driver_data { unsigned cur_speed; struct s3c64xx_spi_dma_data rx_dma; struct s3c64xx_spi_dma_data tx_dma; - struct s3c64xx_spi_port_config *port_conf; + const struct s3c64xx_spi_port_config *port_conf; unsigned int port_id; }; @@ -1049,15 +1049,14 @@ static struct s3c64xx_spi_info *s3c64xx_spi_parse_dt(struct device *dev) } #endif -static inline struct s3c64xx_spi_port_config *s3c64xx_spi_get_port_config( +static inline const struct s3c64xx_spi_port_config *s3c64xx_spi_get_port_config( struct platform_device *pdev) { #ifdef CONFIG_OF if (pdev->dev.of_node) - return (struct s3c64xx_spi_port_config *)of_device_get_match_data(&pdev->dev); + return of_device_get_match_data(&pdev->dev); #endif - return (struct s3c64xx_spi_port_config *) - platform_get_device_id(pdev)->driver_data; + return (const struct s3c64xx_spi_port_config *)platform_get_device_id(pdev)->driver_data; } static int s3c64xx_spi_probe(struct platform_device *pdev) @@ -1395,27 +1394,27 @@ static const struct dev_pm_ops s3c64xx_spi_pm = { s3c64xx_spi_runtime_resume, NULL) }; -static struct s3c64xx_spi_port_config s3c2443_spi_port_config = { +static const struct s3c64xx_spi_port_config s3c2443_spi_port_config = { .fifo_lvl_mask = { 0x7f }, .rx_lvl_offset = 13, .tx_st_done = 21, .high_speed = true, }; -static struct s3c64xx_spi_port_config s3c6410_spi_port_config = { +static const struct s3c64xx_spi_port_config s3c6410_spi_port_config = { .fifo_lvl_mask = { 0x7f, 0x7F }, .rx_lvl_offset = 13, .tx_st_done = 21, }; -static struct s3c64xx_spi_port_config s5pv210_spi_port_config = { +static const struct s3c64xx_spi_port_config s5pv210_spi_port_config = { .fifo_lvl_mask = { 0x1ff, 0x7F }, .rx_lvl_offset = 15, .tx_st_done = 25, .high_speed = true, }; -static struct s3c64xx_spi_port_config exynos4_spi_port_config = { +static const struct s3c64xx_spi_port_config exynos4_spi_port_config = { .fifo_lvl_mask = { 0x1ff, 0x7F, 0x7F }, .rx_lvl_offset = 15, .tx_st_done = 25, @@ -1424,7 +1423,7 @@ static struct s3c64xx_spi_port_config exynos4_spi_port_config = { .quirks = S3C64XX_SPI_QUIRK_CS_AUTO, }; -static struct s3c64xx_spi_port_config exynos7_spi_port_config = { +static const struct s3c64xx_spi_port_config exynos7_spi_port_config = { .fifo_lvl_mask = { 0x1ff, 0x7F, 0x7F, 0x7F, 0x7F, 0x1ff}, .rx_lvl_offset = 15, .tx_st_done = 25, @@ -1433,7 +1432,7 @@ static struct s3c64xx_spi_port_config exynos7_spi_port_config = { .quirks = S3C64XX_SPI_QUIRK_CS_AUTO, }; -static struct s3c64xx_spi_port_config exynos5433_spi_port_config = { +static const struct s3c64xx_spi_port_config exynos5433_spi_port_config = { .fifo_lvl_mask = { 0x1ff, 0x7f, 0x7f, 0x7f, 0x7f, 0x1ff}, .rx_lvl_offset = 15, .tx_st_done = 25,