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: 12203767 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 9C28AC433ED 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 6E46B61164 for ; Wed, 14 Apr 2021 20:34:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244811AbhDNUe0 (ORCPT ); Wed, 14 Apr 2021 16:34:26 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:50455 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243948AbhDNUeY (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-0007Qg-Sf for linux-spi@vger.kernel.org; Wed, 14 Apr 2021 20:34:01 +0000 Received: by mail-ej1-f70.google.com with SMTP id re9-20020a170906d8c9b029037ca22d6744so217042ejb.0 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=cCOv+F/TCrliYJrJ14mesLnwRWbRNNxsLQrpJc0K8H4bVMIsVQ/8gQvVSwwcgVVKwb bF2vZnMtlVq1umj1H2s9NqKiHXOSJCuh2IcgOqPvZf1xZECgRmGlmd8S9nxGSM98DjrM GbI1FX5cQsjeRdB1UUJqbTxzuqmAeoUb4DHlg71JJ//SaV762Lu9JTlEfox/crbMkjjR 8dJd5ANIFmO0vnjb7FomeGdTjrXf/aMofWUYn/vOz9W6sF17tvV+O1g/BP9XMMf3qSim 1cgifcig8+xSkgei3m2zKB+lnCryZtk7f0oQ0KX5NIOuZ+VEnfueCNqoYQ9jp1sfo1J/ SwLA== X-Gm-Message-State: AOAM531U74Revh59zZDlY92YO3OE6A095IVfz1UbbIQk1MyrjMZ7nKXu AOCHZj9xviL0VJWthrgc2XqActFxd1onwqWkbR0nvPr9oyPkluc8DelGhLbRYzXrOaUFn8AGjB5 9ce7sQ4eSVm6UBG8G2K/FmxSYfmMq2jF5UNH4tw== X-Received: by 2002:a05:6402:5189:: with SMTP id q9mr72099edd.168.1618432441436; 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-spi@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: 12203769 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 D65AAC433ED for ; Wed, 14 Apr 2021 20:34:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BB51561164 for ; Wed, 14 Apr 2021 20:34:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244864AbhDNUe1 (ORCPT ); Wed, 14 Apr 2021 16:34:27 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:50459 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244433AbhDNUeZ (ORCPT ); Wed, 14 Apr 2021 16:34:25 -0400 Received: from mail-ej1-f71.google.com ([209.85.218.71]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lWmD4-0007RE-R4 for linux-spi@vger.kernel.org; Wed, 14 Apr 2021 20:34:02 +0000 Received: by mail-ej1-f71.google.com with SMTP id lf6-20020a1709071746b029037cee5e31c4so217139ejc.13 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=uVtmZ9JnG0LXbwRX+dOoRQXELaFSEkOT5QuInCbfOWW8OcWnCVquo2AbvhjxsemvLv YlmIyDVkm8Hjf9EiTl4UrrBrwhZxDh0LGJCFZF6Jci9b2q14ElIuRrw8f0SKoxA12IIQ FJAQmu2ygMITQInOe+Yttv3pJK12nW+KUs+wRQPL1tYoQ2+uitgXb8NPIczxHf65SAkP NA5SE5Y38j6QbR5csGCTmQ8LxLO6DxVRJc8vp99mLfZnpLerRB1Iq7GlqCUmqYhenvIC RztuSDoF/CSnvUMPWzDpWM1yMfjtJ17W20yGWjBd//L/OSooZCdmnZdL9Hw/cOKTCMX2 IuCA== X-Gm-Message-State: AOAM532/c9YDdPmKD6NGiELOy3KK2YuhX153/wNgo38ak2KQwVl24Mva jhblhkGmVqzRMEuixBbueGzyf7sD1Yp5MrvioT066iMOCmfLRLiXIPW0zsbLowV/kD/lAj0slpH td8D8RjoZjkSOUttfxfqcBlXCbtXh0sFHezWzaA== X-Received: by 2002:a05:6402:34d5:: with SMTP id w21mr87967edc.14.1618432442540; 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-spi@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: 12203771 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 B6637C433B4 for ; Wed, 14 Apr 2021 20:34:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9FAC161164 for ; Wed, 14 Apr 2021 20:34:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244433AbhDNUe3 (ORCPT ); Wed, 14 Apr 2021 16:34:29 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:50471 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244538AbhDNUe0 (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 1lWmD6-0007Rp-1K for linux-spi@vger.kernel.org; Wed, 14 Apr 2021 20:34:04 +0000 Received: by mail-ej1-f72.google.com with SMTP id bx15-20020a170906a1cfb029037415131f28so219395ejb.18 for ; Wed, 14 Apr 2021 13:34:04 -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=bsx0em2pMgKFxWJIRIGOAuVeduwT5BeKH3lwQbqN4Ng0pNj1EpSHgMIkRRaHw34dFy HuBFgLHEfoQbxroD0XAMq56yeNYugqrsIXxvojVtBt2wdMuBXlZtQMWrAz1obPaTeg0N y1oi2Sy61iQuwTsRXO+47lKCNdc3qpUUw+7IAWYd5E2NwKG0ESLbPvTQYoYvH/KG1lGg I3HGtqLQhBWC3TtGxUJllorEyWXV1nPZu3mx4BeoLVGfaw6GBc0sODOYp6mADvnWsuXP YPvyx9yEdNzKP8eYzWPWGlC0YBWIJTn/vw6TuU7iywz6eEXXB6tSp/+ZtP5TTXTikQ4J qThQ== X-Gm-Message-State: AOAM531kLovjwY+S2SrEc5KjS0uaPr8qtoQOgEIYkundrU7jjbukG1/x yoUkPpDDgrCOh2by7fDXBOZbG60LijQCad+4g19Bll5WYYSCcoVVg+Gua19AUpG9cv16/gg15Kl 9dr4diiq0FTsz1XUZfHr6FPS7SI+jqyTD/a7zhw== X-Received: by 2002:a05:6402:3092:: with SMTP id de18mr77349edb.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-spi@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,