From patchwork Tue Mar 8 08:09:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 549602 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73566C4332F for ; Tue, 8 Mar 2022 08:09:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344781AbiCHIKY (ORCPT ); Tue, 8 Mar 2022 03:10:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344787AbiCHIKX (ORCPT ); Tue, 8 Mar 2022 03:10:23 -0500 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E64923EAAE for ; Tue, 8 Mar 2022 00:09:26 -0800 (PST) Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id BADE03F625 for ; Tue, 8 Mar 2022 08:09:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1646726965; bh=Dwp/aQOBQEXJT+052j4TYlKoFTeM490hQz5ZQ8IolK4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GkgWIVEaTirXnRwDelGoi01Gli8aZ5HPIdhSzenB0f59kewQO0FMHflBvYoG//gAo yDENmjeEWX4eLP5MwCbt5quvQyrPwpCPkJsU2IGsXj5FKAFo54whQ73ydgVFuhlvCt 7OZJGz55aeswfySJmGAq0lp/TQlH6ldU2qZZeS3GE/lqQW6ON6KT0epjFt77QK1ruD qAqF37X/IdbBvD5jH6UjYjSWHyW+lBojRwKu2gjyasr2UFHQXrrQcI0cWPXzvFASEy nF7CgiG4k647O73imKRhoHhm46qs6nZrCIjnU644lMdfJOeqzfJmxAzGKbT/vaxnHJ YTGaQUqWnDpWA== Received: by mail-ej1-f70.google.com with SMTP id hx13-20020a170906846d00b006db02e1a307so3174761ejc.2 for ; Tue, 08 Mar 2022 00:09:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Dwp/aQOBQEXJT+052j4TYlKoFTeM490hQz5ZQ8IolK4=; b=CBiD1NLlIcidUMAdw/GqO8TPp4b8e4JnFclTzfuo8ZfiQFH65i1ERkaLQCd2eXpDwn Gwhysl9i359m5Rce0/6HrEZJ0B36A0EZdyMWsIikUvBbRsFPuG5oD1e8buFyfnmiriAG vTLz8OUipwRcmtDSdcneXA/n0hIS+T+pk9O9H+wPUe3lcuUSGaDGj2OICgsXjSKuWpHJ J42VlCINWduDr/TPfG2oeYkXZn85mjODvHzGUzeGyJIr9dejHeBX8pjvrOywfB7Y5p0h K9sjzDS6+BEQQBR1exlYrmM44do0DK051thc3+biCuiL6LfhREoLZzCcToZL3NOIG/LE lrag== X-Gm-Message-State: AOAM530UPdu7O1lwZN65C86Kymvl8BzFVZKVGxnxqNs0IqW7qvrM5CCn zcjS6QEdA+DLlWhnHPCyGi0DCK/O4Qy1VFDLPn+4RGHKq9VWXmMA41DHJIeC/ISdY7U2JswJ7K4 dCk1SNCk2k6aOJ/4mfFLapaUHKQgRGS8IvGLlNdSVDy+o9Mbi X-Received: by 2002:a17:907:8688:b0:6d2:c19:e1a0 with SMTP id qa8-20020a170907868800b006d20c19e1a0mr11801079ejc.249.1646726963590; Tue, 08 Mar 2022 00:09:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJwQGA9AtYeOF5o4ZCAtjuIHASbFdPaBaVMJaKdXkELr+T4yRLutynO8tWxKX7iXVrYNqK6kmw== X-Received: by 2002:a17:907:8688:b0:6d2:c19:e1a0 with SMTP id qa8-20020a170907868800b006d20c19e1a0mr11801059ejc.249.1646726963335; Tue, 08 Mar 2022 00:09:23 -0800 (PST) Received: from localhost.localdomain (xdsl-188-155-174-239.adslplus.ch. [188.155.174.239]) by smtp.gmail.com with ESMTPSA id t4-20020a056402524400b00415b90801edsm7385697edd.57.2022.03.08.00.09.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 00:09:22 -0800 (PST) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Alim Akhtar , Greg Kroah-Hartman , Jiri Slaby , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v3 1/8] tty: serial: samsung: embed s3c24xx_uart_info in parent structure Date: Tue, 8 Mar 2022 09:09:12 +0100 Message-Id: <20220308080919.152715-2-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220308080919.152715-1-krzysztof.kozlowski@canonical.com> References: <20220308080919.152715-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Embed "struct s3c24xx_uart_info" directly as a member of "struct s3c24xx_serial_drv_data" instead of keeping it as a pointer. This makes the code clearer (obvious ownership of "struct s3c24xx_serial_drv_data") and saves one pointer. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jiri Slaby Reviewed-by: Alim Akhtar Tested-by: Alim Akhtar --- drivers/tty/serial/samsung_tty.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c index d002a4e48ed9..aa5678d03704 100644 --- a/drivers/tty/serial/samsung_tty.c +++ b/drivers/tty/serial/samsung_tty.c @@ -85,7 +85,7 @@ struct s3c24xx_uart_info { }; struct s3c24xx_serial_drv_data { - struct s3c24xx_uart_info *info; + struct s3c24xx_uart_info info; struct s3c2410_uartcfg *def_cfg; unsigned int fifosize[CONFIG_SERIAL_SAMSUNG_UARTS]; }; @@ -2197,7 +2197,7 @@ static int s3c24xx_serial_probe(struct platform_device *pdev) } ourport->baudclk = ERR_PTR(-EINVAL); - ourport->info = ourport->drv_data->info; + ourport->info = &ourport->drv_data->info; ourport->cfg = (dev_get_platdata(&pdev->dev)) ? dev_get_platdata(&pdev->dev) : ourport->drv_data->def_cfg; @@ -2616,7 +2616,7 @@ static struct console s3c24xx_serial_console = { #ifdef CONFIG_CPU_S3C2410 static struct s3c24xx_serial_drv_data s3c2410_serial_drv_data = { - .info = &(struct s3c24xx_uart_info) { + .info = { .name = "Samsung S3C2410 UART", .type = TYPE_S3C24XX, .port_type = PORT_S3C2410, @@ -2644,7 +2644,7 @@ static struct s3c24xx_serial_drv_data s3c2410_serial_drv_data = { #ifdef CONFIG_CPU_S3C2412 static struct s3c24xx_serial_drv_data s3c2412_serial_drv_data = { - .info = &(struct s3c24xx_uart_info) { + .info = { .name = "Samsung S3C2412 UART", .type = TYPE_S3C24XX, .port_type = PORT_S3C2412, @@ -2674,7 +2674,7 @@ static struct s3c24xx_serial_drv_data s3c2412_serial_drv_data = { #if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2416) || \ defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2442) static struct s3c24xx_serial_drv_data s3c2440_serial_drv_data = { - .info = &(struct s3c24xx_uart_info) { + .info = { .name = "Samsung S3C2440 UART", .type = TYPE_S3C24XX, .port_type = PORT_S3C2440, @@ -2704,7 +2704,7 @@ static struct s3c24xx_serial_drv_data s3c2440_serial_drv_data = { #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) static struct s3c24xx_serial_drv_data s3c6400_serial_drv_data = { - .info = &(struct s3c24xx_uart_info) { + .info = { .name = "Samsung S3C6400 UART", .type = TYPE_S3C6400, .port_type = PORT_S3C6400, @@ -2733,7 +2733,7 @@ static struct s3c24xx_serial_drv_data s3c6400_serial_drv_data = { #ifdef CONFIG_CPU_S5PV210 static struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = { - .info = &(struct s3c24xx_uart_info) { + .info = { .name = "Samsung S5PV210 UART", .type = TYPE_S3C6400, .port_type = PORT_S3C6400, @@ -2762,7 +2762,7 @@ static struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = { #if defined(CONFIG_ARCH_EXYNOS) #define EXYNOS_COMMON_SERIAL_DRV_DATA() \ - .info = &(struct s3c24xx_uart_info) { \ + .info = { \ .name = "Samsung Exynos UART", \ .type = TYPE_S3C6400, \ .port_type = PORT_S3C6400, \ @@ -2811,7 +2811,7 @@ static struct s3c24xx_serial_drv_data exynos850_serial_drv_data = { #ifdef CONFIG_ARCH_APPLE static struct s3c24xx_serial_drv_data s5l_serial_drv_data = { - .info = &(struct s3c24xx_uart_info) { + .info = { .name = "Apple S5L UART", .type = TYPE_APPLE_S5L, .port_type = PORT_8250, From patchwork Tue Mar 8 08:09:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 550307 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 815A3C43217 for ; Tue, 8 Mar 2022 08:09:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344782AbiCHIKZ (ORCPT ); Tue, 8 Mar 2022 03:10:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344786AbiCHIKW (ORCPT ); Tue, 8 Mar 2022 03:10:22 -0500 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 582C53EAA9 for ; Tue, 8 Mar 2022 00:09:26 -0800 (PST) Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 22EF73F623 for ; Tue, 8 Mar 2022 08:09:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1646726965; bh=RaO5N5+xpc6qv0C5C+2+SP0aJMALLkB4br4l3fJLsRI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BdgUOyLggHdP9lzIgR65TSCLNFsbrhCJxfwBq9I+iSu1TljH75CFwmoH4zwRfHknE 91DaYOqkWzQca3UfMc0wgNFDbmUtNptGs9E1oy2Mo4XKcJCYrj+1whz7DoYnY/nybz XcUxP5cf9mwfKEGumdk9wbyV3/zCaFOCrjXGjWClNVgLMkvQXT4Is5W2bnYIEuWLmc jxCjPFnNElUfo/TH6fM8QltQ3UpXsdovC5Y7iIZvlB4Fx2LpmjQoKHNxq2aO7Nh2Jf r59g/PifU2Sy0KMemr7Docc8q2tTKfjvmecG79Npr14oZi4F+PeOHYwCzQQA4ENVzt 7zJFKdQVCQuUA== Received: by mail-ej1-f71.google.com with SMTP id i14-20020a17090639ce00b006dabe6a112fso4498072eje.13 for ; Tue, 08 Mar 2022 00:09:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RaO5N5+xpc6qv0C5C+2+SP0aJMALLkB4br4l3fJLsRI=; b=wkIArZhhE/IslVFt/LouynBi43rGqElxZvWTQ1nxR5VvIKhOKd+2uOGAyqEecobUmN H3rSkB+RUGcJdycxEMNh9A8wEM4cOm9csEdwwVGs4xcILbqOeqXDYIF8ej30t0KHXeRp 45sMrGiaiydprr/zetOSoWtHMdxU+vN38vL/N1OHFJNWliJ3x8Uyg7SqhBVxY/Wss4s9 p9eONhKfbXvfLIFKUlFfADHJQGB4NWjM0MiGyvvNrVXuNyKuj1YOuCJislgXqODnW+pR IQ//vVgJ94KnlyJL5wF6bB7n0aXnQlAi8m/O+Tnh0M3yNAq1cjgWS2pzJg0sK4F2Z69C eJDw== X-Gm-Message-State: AOAM532uF6oLlv+ouot8n9VqZs/4TMCh72rtEJEzQ2w+RbDxFcvKxv4N gTYZS9Hwd9jSo9Hl3mNmiCvOXTlg84O+HTN4u7MMWcFOlzdr63aoqQbKf+ppLUymezl01BNlD4/ gw0QBhW5gZR8WMiDLWfQEfGJUV/ib5jOmQvTMWwIeXrOcgIpv X-Received: by 2002:a17:906:7d83:b0:6ce:fee:9256 with SMTP id v3-20020a1709067d8300b006ce0fee9256mr12751420ejo.647.1646726964792; Tue, 08 Mar 2022 00:09:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6SJAGGC/ezAoZpSp4TpDtyzbSfuJ1xdN0lOAmzmlE3wQWBFRDDMvLFPw6x2SrFrtTdkAZ4g== X-Received: by 2002:a17:906:7d83:b0:6ce:fee:9256 with SMTP id v3-20020a1709067d8300b006ce0fee9256mr12751408ejo.647.1646726964615; Tue, 08 Mar 2022 00:09:24 -0800 (PST) Received: from localhost.localdomain (xdsl-188-155-174-239.adslplus.ch. [188.155.174.239]) by smtp.gmail.com with ESMTPSA id t4-20020a056402524400b00415b90801edsm7385697edd.57.2022.03.08.00.09.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 00:09:23 -0800 (PST) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Alim Akhtar , Greg Kroah-Hartman , Jiri Slaby , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v3 2/8] tty: serial: samsung: embed s3c2410_uartcfg in parent structure Date: Tue, 8 Mar 2022 09:09:13 +0100 Message-Id: <20220308080919.152715-3-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220308080919.152715-1-krzysztof.kozlowski@canonical.com> References: <20220308080919.152715-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Embed "struct s3c2410_uartcfg" directly as a member of "struct s3c24xx_serial_drv_data" instead of keeping it as a pointer. This makes the code clearer (obvious ownership of "s3c2410_uartcfg s3c24xx_serial_drv_data") and saves one pointer. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jiri Slaby Reviewed-by: Alim Akhtar Tested-by: Alim Akhtar --- drivers/tty/serial/samsung_tty.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c index aa5678d03704..a9a75b5b9705 100644 --- a/drivers/tty/serial/samsung_tty.c +++ b/drivers/tty/serial/samsung_tty.c @@ -86,7 +86,7 @@ struct s3c24xx_uart_info { struct s3c24xx_serial_drv_data { struct s3c24xx_uart_info info; - struct s3c2410_uartcfg *def_cfg; + struct s3c2410_uartcfg def_cfg; unsigned int fifosize[CONFIG_SERIAL_SAMSUNG_UARTS]; }; @@ -2200,7 +2200,7 @@ static int s3c24xx_serial_probe(struct platform_device *pdev) ourport->info = &ourport->drv_data->info; ourport->cfg = (dev_get_platdata(&pdev->dev)) ? dev_get_platdata(&pdev->dev) : - ourport->drv_data->def_cfg; + &ourport->drv_data->def_cfg; switch (ourport->info->type) { case TYPE_S3C24XX: @@ -2632,7 +2632,7 @@ static struct s3c24xx_serial_drv_data s3c2410_serial_drv_data = { .clksel_mask = S3C2410_UCON_CLKMASK, .clksel_shift = S3C2410_UCON_CLKSHIFT, }, - .def_cfg = &(struct s3c2410_uartcfg) { + .def_cfg = { .ucon = S3C2410_UCON_DEFAULT, .ufcon = S3C2410_UFCON_DEFAULT, }, @@ -2661,7 +2661,7 @@ static struct s3c24xx_serial_drv_data s3c2412_serial_drv_data = { .clksel_mask = S3C2412_UCON_CLKMASK, .clksel_shift = S3C2412_UCON_CLKSHIFT, }, - .def_cfg = &(struct s3c2410_uartcfg) { + .def_cfg = { .ucon = S3C2410_UCON_DEFAULT, .ufcon = S3C2410_UFCON_DEFAULT, }, @@ -2692,7 +2692,7 @@ static struct s3c24xx_serial_drv_data s3c2440_serial_drv_data = { .clksel_shift = S3C2412_UCON_CLKSHIFT, .ucon_mask = S3C2440_UCON0_DIVMASK, }, - .def_cfg = &(struct s3c2410_uartcfg) { + .def_cfg = { .ucon = S3C2410_UCON_DEFAULT, .ufcon = S3C2410_UFCON_DEFAULT, }, @@ -2721,7 +2721,7 @@ static struct s3c24xx_serial_drv_data s3c6400_serial_drv_data = { .clksel_mask = S3C6400_UCON_CLKMASK, .clksel_shift = S3C6400_UCON_CLKSHIFT, }, - .def_cfg = &(struct s3c2410_uartcfg) { + .def_cfg = { .ucon = S3C2410_UCON_DEFAULT, .ufcon = S3C2410_UFCON_DEFAULT, }, @@ -2749,7 +2749,7 @@ static struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = { .clksel_mask = S5PV210_UCON_CLKMASK, .clksel_shift = S5PV210_UCON_CLKSHIFT, }, - .def_cfg = &(struct s3c2410_uartcfg) { + .def_cfg = { .ucon = S5PV210_UCON_DEFAULT, .ufcon = S5PV210_UFCON_DEFAULT, }, @@ -2778,7 +2778,7 @@ static struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = { .clksel_mask = 0, \ .clksel_shift = 0, \ }, \ - .def_cfg = &(struct s3c2410_uartcfg) { \ + .def_cfg = { \ .ucon = S5PV210_UCON_DEFAULT, \ .ufcon = S5PV210_UFCON_DEFAULT, \ .has_fracval = 1, \ @@ -2827,7 +2827,7 @@ static struct s3c24xx_serial_drv_data s5l_serial_drv_data = { .clksel_mask = 0, .clksel_shift = 0, }, - .def_cfg = &(struct s3c2410_uartcfg) { + .def_cfg = { .ucon = APPLE_S5L_UCON_DEFAULT, .ufcon = S3C2410_UFCON_DEFAULT, }, From patchwork Tue Mar 8 08:09:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 549601 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3658CC4321E for ; Tue, 8 Mar 2022 08:09:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344758AbiCHIK0 (ORCPT ); Tue, 8 Mar 2022 03:10:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344763AbiCHIKY (ORCPT ); Tue, 8 Mar 2022 03:10:24 -0500 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FC4C3E0D2 for ; Tue, 8 Mar 2022 00:09:28 -0800 (PST) Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 2023A3F62A for ; Tue, 8 Mar 2022 08:09:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1646726967; bh=JiKqSLqC9cz+DomuU4Hx2hld8wGUXAiXEgnja8m8/QA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qzy/0jMcFKkiyIMBaRsMnDlK80QqGFhkG5okvxsHwVU7zS+ry8KP5SVoW279J8+eI TlwUhhYq7rCEvWLnV11AmIWulN7GatZz8+NV7atHS64bF17f40y++mdLPKj2es875y PGJwNw/3060PHr3xnaT/+ek/j+ImdkKT9FmDqc0jx43ehXzVulvJXalBtJwYS7rOuh E5ZG2l803VglgfLNPsxzfOL1x+l3t99M7g0iJQc6egsfSKiSV5R4Lv8Dx/J0gDZ9PK bYXAfS78kwtOCC611FJGPYUT0fGEBgrpe4ksXfiAgik9D6B7mMdlWNuLq+BTs3xBDN kEiUMzR5ubemQ== Received: by mail-ej1-f71.google.com with SMTP id lf15-20020a170906ae4f00b006da86a43346so7106723ejb.14 for ; Tue, 08 Mar 2022 00:09:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JiKqSLqC9cz+DomuU4Hx2hld8wGUXAiXEgnja8m8/QA=; b=ssg4G7P8lMt+iFB6dWHa2dECEa/zgPWXEpJ9mhZ8A2CzUkf3jVmoZbmjhnl5nn6IuL 2uT+6rgKTkcmYHUf2QXRyKiSgiCs8qbTscAqbS2hI9wbXhoL6urB/BSPDPIBV5Jpmzpu wYfqTa3WhNVjnTAqQqzoMStkLSV/ycII+UkNwlbzyEqDYi6aT3u+jSjGYQ+gSEWsV2XD ldxIvpje5cwaX4Ddeon+BeeG8fpGtgHAwPpJUnB6FuoeDM7b7gkhRIG3F/K2A+C+Ihga xJ699NBRGHMMmPyGb1I4OJdWVVGSvlKsufSKTe5eh7urh47Bc3O3/r250LZF4/XfBMVO zORQ== X-Gm-Message-State: AOAM531gOjd7gqMj0llgIZS6WmpmMOXEK71iHSkfgXtkoH3bpOihdAVr qkzyg3E08Lb0zj8/GEVJac0Q6d42hJCQQ+Miyy+emoUaI5hrScb5n97G9m9tOr3rjiyOHus1cKM kSIPPCPeEJnbC8ePRZE7tR8wx3XyhhYn1z/Gn7Ltfu5TspWpU X-Received: by 2002:a17:907:9691:b0:6d1:711d:9050 with SMTP id hd17-20020a170907969100b006d1711d9050mr12786613ejc.755.1646726966662; Tue, 08 Mar 2022 00:09:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJyP0hp7rDrHBkxpGSi42kG38akSsQnOk/uybyIcsE8rFLwZ5IzvABPItTpU0pBtDEzT1lGCMw== X-Received: by 2002:a17:907:9691:b0:6d1:711d:9050 with SMTP id hd17-20020a170907969100b006d1711d9050mr12786598ejc.755.1646726966458; Tue, 08 Mar 2022 00:09:26 -0800 (PST) Received: from localhost.localdomain (xdsl-188-155-174-239.adslplus.ch. [188.155.174.239]) by smtp.gmail.com with ESMTPSA id t4-20020a056402524400b00415b90801edsm7385697edd.57.2022.03.08.00.09.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 00:09:26 -0800 (PST) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Alim Akhtar , Greg Kroah-Hartman , Jiri Slaby , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v3 3/8] tty: serial: samsung: reduce number of casts Date: Tue, 8 Mar 2022 09:09:14 +0100 Message-Id: <20220308080919.152715-4-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220308080919.152715-1-krzysztof.kozlowski@canonical.com> References: <20220308080919.152715-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org The pointers to instances of "struct s3c24xx_serial_drv_data" are first cast to kernel_ulong_t and then either used directly (in "platform_device_id.driver_data") or cast again to void * (in "of_device_id.data"). One cast can be dropped, so at least for "of_device_id.data" case there will be no casts at all. This makes the code a bit simpler. Signed-off-by: Krzysztof Kozlowski --- drivers/tty/serial/samsung_tty.c | 72 ++++++++++++++++---------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c index a9a75b5b9705..66434eb58db8 100644 --- a/drivers/tty/serial/samsung_tty.c +++ b/drivers/tty/serial/samsung_tty.c @@ -2637,9 +2637,9 @@ static struct s3c24xx_serial_drv_data s3c2410_serial_drv_data = { .ufcon = S3C2410_UFCON_DEFAULT, }, }; -#define S3C2410_SERIAL_DRV_DATA ((kernel_ulong_t)&s3c2410_serial_drv_data) +#define S3C2410_SERIAL_DRV_DATA (&s3c2410_serial_drv_data) #else -#define S3C2410_SERIAL_DRV_DATA (kernel_ulong_t)NULL +#define S3C2410_SERIAL_DRV_DATA NULL #endif #ifdef CONFIG_CPU_S3C2412 @@ -2666,9 +2666,9 @@ static struct s3c24xx_serial_drv_data s3c2412_serial_drv_data = { .ufcon = S3C2410_UFCON_DEFAULT, }, }; -#define S3C2412_SERIAL_DRV_DATA ((kernel_ulong_t)&s3c2412_serial_drv_data) +#define S3C2412_SERIAL_DRV_DATA (&s3c2412_serial_drv_data) #else -#define S3C2412_SERIAL_DRV_DATA (kernel_ulong_t)NULL +#define S3C2412_SERIAL_DRV_DATA NULL #endif #if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2416) || \ @@ -2697,9 +2697,9 @@ static struct s3c24xx_serial_drv_data s3c2440_serial_drv_data = { .ufcon = S3C2410_UFCON_DEFAULT, }, }; -#define S3C2440_SERIAL_DRV_DATA ((kernel_ulong_t)&s3c2440_serial_drv_data) +#define S3C2440_SERIAL_DRV_DATA (&s3c2440_serial_drv_data) #else -#define S3C2440_SERIAL_DRV_DATA (kernel_ulong_t)NULL +#define S3C2440_SERIAL_DRV_DATA NULL #endif #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) @@ -2726,9 +2726,9 @@ static struct s3c24xx_serial_drv_data s3c6400_serial_drv_data = { .ufcon = S3C2410_UFCON_DEFAULT, }, }; -#define S3C6400_SERIAL_DRV_DATA ((kernel_ulong_t)&s3c6400_serial_drv_data) +#define S3C6400_SERIAL_DRV_DATA (&s3c6400_serial_drv_data) #else -#define S3C6400_SERIAL_DRV_DATA (kernel_ulong_t)NULL +#define S3C6400_SERIAL_DRV_DATA NULL #endif #ifdef CONFIG_CPU_S5PV210 @@ -2755,9 +2755,9 @@ static struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = { }, .fifosize = { 256, 64, 16, 16 }, }; -#define S5PV210_SERIAL_DRV_DATA ((kernel_ulong_t)&s5pv210_serial_drv_data) +#define S5PV210_SERIAL_DRV_DATA (&s5pv210_serial_drv_data) #else -#define S5PV210_SERIAL_DRV_DATA (kernel_ulong_t)NULL +#define S5PV210_SERIAL_DRV_DATA NULL #endif #if defined(CONFIG_ARCH_EXYNOS) @@ -2799,14 +2799,14 @@ static struct s3c24xx_serial_drv_data exynos850_serial_drv_data = { .fifosize = { 256, 64, 64, 64 }, }; -#define EXYNOS4210_SERIAL_DRV_DATA ((kernel_ulong_t)&exynos4210_serial_drv_data) -#define EXYNOS5433_SERIAL_DRV_DATA ((kernel_ulong_t)&exynos5433_serial_drv_data) -#define EXYNOS850_SERIAL_DRV_DATA ((kernel_ulong_t)&exynos850_serial_drv_data) +#define EXYNOS4210_SERIAL_DRV_DATA (&exynos4210_serial_drv_data) +#define EXYNOS5433_SERIAL_DRV_DATA (&exynos5433_serial_drv_data) +#define EXYNOS850_SERIAL_DRV_DATA (&exynos850_serial_drv_data) #else -#define EXYNOS4210_SERIAL_DRV_DATA ((kernel_ulong_t)NULL) -#define EXYNOS5433_SERIAL_DRV_DATA ((kernel_ulong_t)NULL) -#define EXYNOS850_SERIAL_DRV_DATA ((kernel_ulong_t)NULL) +#define EXYNOS4210_SERIAL_DRV_DATA NULL +#define EXYNOS5433_SERIAL_DRV_DATA NULL +#define EXYNOS850_SERIAL_DRV_DATA NULL #endif #ifdef CONFIG_ARCH_APPLE @@ -2832,39 +2832,39 @@ static struct s3c24xx_serial_drv_data s5l_serial_drv_data = { .ufcon = S3C2410_UFCON_DEFAULT, }, }; -#define S5L_SERIAL_DRV_DATA ((kernel_ulong_t)&s5l_serial_drv_data) +#define S5L_SERIAL_DRV_DATA (&s5l_serial_drv_data) #else -#define S5L_SERIAL_DRV_DATA ((kernel_ulong_t)NULL) +#define S5L_SERIAL_DRV_DATA NULL #endif static const struct platform_device_id s3c24xx_serial_driver_ids[] = { { .name = "s3c2410-uart", - .driver_data = S3C2410_SERIAL_DRV_DATA, + .driver_data = (kernel_ulong_t)S3C2410_SERIAL_DRV_DATA, }, { .name = "s3c2412-uart", - .driver_data = S3C2412_SERIAL_DRV_DATA, + .driver_data = (kernel_ulong_t)S3C2412_SERIAL_DRV_DATA, }, { .name = "s3c2440-uart", - .driver_data = S3C2440_SERIAL_DRV_DATA, + .driver_data = (kernel_ulong_t)S3C2440_SERIAL_DRV_DATA, }, { .name = "s3c6400-uart", - .driver_data = S3C6400_SERIAL_DRV_DATA, + .driver_data = (kernel_ulong_t)S3C6400_SERIAL_DRV_DATA, }, { .name = "s5pv210-uart", - .driver_data = S5PV210_SERIAL_DRV_DATA, + .driver_data = (kernel_ulong_t)S5PV210_SERIAL_DRV_DATA, }, { .name = "exynos4210-uart", - .driver_data = EXYNOS4210_SERIAL_DRV_DATA, + .driver_data = (kernel_ulong_t)EXYNOS4210_SERIAL_DRV_DATA, }, { .name = "exynos5433-uart", - .driver_data = EXYNOS5433_SERIAL_DRV_DATA, + .driver_data = (kernel_ulong_t)EXYNOS5433_SERIAL_DRV_DATA, }, { .name = "s5l-uart", - .driver_data = S5L_SERIAL_DRV_DATA, + .driver_data = (kernel_ulong_t)S5L_SERIAL_DRV_DATA, }, { .name = "exynos850-uart", - .driver_data = EXYNOS850_SERIAL_DRV_DATA, + .driver_data = (kernel_ulong_t)EXYNOS850_SERIAL_DRV_DATA, }, { }, }; @@ -2873,23 +2873,23 @@ MODULE_DEVICE_TABLE(platform, s3c24xx_serial_driver_ids); #ifdef CONFIG_OF static const struct of_device_id s3c24xx_uart_dt_match[] = { { .compatible = "samsung,s3c2410-uart", - .data = (void *)S3C2410_SERIAL_DRV_DATA }, + .data = S3C2410_SERIAL_DRV_DATA }, { .compatible = "samsung,s3c2412-uart", - .data = (void *)S3C2412_SERIAL_DRV_DATA }, + .data = S3C2412_SERIAL_DRV_DATA }, { .compatible = "samsung,s3c2440-uart", - .data = (void *)S3C2440_SERIAL_DRV_DATA }, + .data = S3C2440_SERIAL_DRV_DATA }, { .compatible = "samsung,s3c6400-uart", - .data = (void *)S3C6400_SERIAL_DRV_DATA }, + .data = S3C6400_SERIAL_DRV_DATA }, { .compatible = "samsung,s5pv210-uart", - .data = (void *)S5PV210_SERIAL_DRV_DATA }, + .data = S5PV210_SERIAL_DRV_DATA }, { .compatible = "samsung,exynos4210-uart", - .data = (void *)EXYNOS4210_SERIAL_DRV_DATA }, + .data = EXYNOS4210_SERIAL_DRV_DATA }, { .compatible = "samsung,exynos5433-uart", - .data = (void *)EXYNOS5433_SERIAL_DRV_DATA }, + .data = EXYNOS5433_SERIAL_DRV_DATA }, { .compatible = "apple,s5l-uart", - .data = (void *)S5L_SERIAL_DRV_DATA }, + .data = S5L_SERIAL_DRV_DATA }, { .compatible = "samsung,exynos850-uart", - .data = (void *)EXYNOS850_SERIAL_DRV_DATA }, + .data = EXYNOS850_SERIAL_DRV_DATA }, {}, }; MODULE_DEVICE_TABLE(of, s3c24xx_uart_dt_match); From patchwork Tue Mar 8 08:09:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 550306 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2CACC433EF for ; Tue, 8 Mar 2022 08:09:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344810AbiCHIKa (ORCPT ); Tue, 8 Mar 2022 03:10:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242517AbiCHIK0 (ORCPT ); Tue, 8 Mar 2022 03:10:26 -0500 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87FFE3E5F6 for ; Tue, 8 Mar 2022 00:09:29 -0800 (PST) Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 6EDE13F79D for ; Tue, 8 Mar 2022 08:09:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1646726968; bh=tfYTw7M8SGNblLSK+OTR7ft1x+niAVfIowhtu3q65AY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HXjJB6B9B6ejGdITG09qJCNIaaq/CcWIRiUKd5IwqDV5xmOgX6TbUBTKCt5PtWdUP /RoLR2JTax1E7McLkeWzlUzm5trNDQnZr79E7iCwXN9MDL+3aW+S0j9CyUjuEFVo7E Y+06/0+dEHC/IOaCftyrIdocS1jCmpSCxiiUM1zolPQyVGnKSD/z4sNya0mJCosypN 8fmlRzlUNcnB1EIc22zkB9TOgWuYNl21C//HKYkDEbbzSpmy9S66TGzubrRt4Zgrsc h+yuDNS7bk1bFv6o0NjwwJu9wbetchyRboMJW68xtW0e2RFngzUnzsi7NeeD98m9OW DeNZYSW92pwOQ== Received: by mail-ej1-f69.google.com with SMTP id q22-20020a1709064cd600b006db14922f93so2337234ejt.7 for ; Tue, 08 Mar 2022 00:09:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tfYTw7M8SGNblLSK+OTR7ft1x+niAVfIowhtu3q65AY=; b=XO6zqeRRn309nkuBg5ePxA4Do9Qcz0XR0X2Nw0O6NPAJScjts+LzotA8VPwJq0IbGk MkJmLjW7gUU8NflYNEldhcRDqzaCJoi4fgoGo515OShOXm4+U0opU40jvrbFaCzv7JJC GHVzr+oRSYE4/d2HWtPpK8KQTzABHlF+TSXd9tAeCBClpAOgctcI4S8X+sHAjxpdP8Hr 8KWkVj0w34wJYmZBCCLjlgk38rfJwHd0f55VDqgmHrftFxMxHb3RR4ta25oRjrWQ0zCa AD2BFcvIL9EEqNb5ioZZN+nQ3X8n8OBLRuE81hYwBkXXmcDkqBYnbOQ6xnIunqnbz1Pu jjtQ== X-Gm-Message-State: AOAM530t93v97KvvwydW8+v0kZQn8rV9dydrhWw7aikID6Gaz5Bsvtx/ pD6Im3LE90cT/JC0saHO3TvCoGIRKQ39MgwlCrbwqikulxW3PYQmRouBR8McjXDnQOYFNKfBpyF Sf+LFciUdF9GA9zaV//rtxDJIo2Th5QA58y9ffR12LiYCM3N/ X-Received: by 2002:a17:907:1b09:b0:6d8:faa8:4a06 with SMTP id mp9-20020a1709071b0900b006d8faa84a06mr12097011ejc.701.1646726967884; Tue, 08 Mar 2022 00:09:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJy4S5b8cDkgWsMD2VwX44UQxX1h1DDN2AljrAE6McGdTq0MBRrLMyFtooQYg29GydbisVK9qQ== X-Received: by 2002:a17:907:1b09:b0:6d8:faa8:4a06 with SMTP id mp9-20020a1709071b0900b006d8faa84a06mr12096985ejc.701.1646726967665; Tue, 08 Mar 2022 00:09:27 -0800 (PST) Received: from localhost.localdomain (xdsl-188-155-174-239.adslplus.ch. [188.155.174.239]) by smtp.gmail.com with ESMTPSA id t4-20020a056402524400b00415b90801edsm7385697edd.57.2022.03.08.00.09.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 00:09:26 -0800 (PST) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Alim Akhtar , Greg Kroah-Hartman , Jiri Slaby , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v3 4/8] tty: serial: samsung: constify s3c24xx_serial_drv_data Date: Tue, 8 Mar 2022 09:09:15 +0100 Message-Id: <20220308080919.152715-5-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220308080919.152715-1-krzysztof.kozlowski@canonical.com> References: <20220308080919.152715-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org The driver data (struct s3c24xx_serial_drv_data) is only used to initialize the driver properly and is not modified. Make it const. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Alim Akhtar Tested-by: Alim Akhtar --- drivers/tty/serial/samsung_tty.c | 58 ++++++++++++++++---------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c index 66434eb58db8..c4b13f2d6e26 100644 --- a/drivers/tty/serial/samsung_tty.c +++ b/drivers/tty/serial/samsung_tty.c @@ -136,14 +136,14 @@ struct s3c24xx_uart_port { unsigned int tx_mode; unsigned int rx_mode; - struct s3c24xx_uart_info *info; + const struct s3c24xx_uart_info *info; struct clk *clk; struct clk *baudclk; struct uart_port port; - struct s3c24xx_serial_drv_data *drv_data; + const struct s3c24xx_serial_drv_data *drv_data; /* reference to platform data */ - struct s3c2410_uartcfg *cfg; + const struct s3c2410_uartcfg *cfg; struct s3c24xx_uart_dma *dma; @@ -221,7 +221,7 @@ static inline void s3c24xx_clear_bit(struct uart_port *port, int idx, local_irq_restore(flags); } -static inline struct s3c24xx_uart_port *to_ourport(struct uart_port *port) +static inline struct s3c24xx_uart_port *to_ourport(const struct uart_port *port) { return container_of(port, struct s3c24xx_uart_port, port); } @@ -573,13 +573,13 @@ static void s3c24xx_serial_stop_rx(struct uart_port *port) } } -static inline struct s3c24xx_uart_info +static inline const struct s3c24xx_uart_info *s3c24xx_port_to_info(struct uart_port *port) { return to_ourport(port)->info; } -static inline struct s3c2410_uartcfg +static inline const struct s3c2410_uartcfg *s3c24xx_port_to_cfg(struct uart_port *port) { struct s3c24xx_uart_port *ourport; @@ -594,7 +594,7 @@ static inline struct s3c2410_uartcfg static int s3c24xx_serial_rx_fifocnt(struct s3c24xx_uart_port *ourport, unsigned long ufstat) { - struct s3c24xx_uart_info *info = ourport->info; + const struct s3c24xx_uart_info *info = ourport->info; if (ufstat & info->rx_fifofull) return ourport->port.fifosize; @@ -986,7 +986,7 @@ static irqreturn_t apple_serial_handle_irq(int irq, void *id) static unsigned int s3c24xx_serial_tx_empty(struct uart_port *port) { - struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); + const struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); unsigned long ufstat = rd_regl(port, S3C2410_UFSTAT); unsigned long ufcon = rd_regl(port, S3C2410_UFCON); @@ -1405,7 +1405,7 @@ static void s3c24xx_serial_pm(struct uart_port *port, unsigned int level, static inline int s3c24xx_serial_getsource(struct uart_port *port) { - struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); + const struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); unsigned int ucon; if (info->num_clks == 1) @@ -1419,7 +1419,7 @@ static inline int s3c24xx_serial_getsource(struct uart_port *port) static void s3c24xx_serial_setsource(struct uart_port *port, unsigned int clk_sel) { - struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); + const struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); unsigned int ucon; if (info->num_clks == 1) @@ -1438,7 +1438,7 @@ static unsigned int s3c24xx_serial_getclk(struct s3c24xx_uart_port *ourport, unsigned int req_baud, struct clk **best_clk, unsigned int *clk_num) { - struct s3c24xx_uart_info *info = ourport->info; + const struct s3c24xx_uart_info *info = ourport->info; struct clk *clk; unsigned long rate; unsigned int cnt, baud, quot, best_quot = 0; @@ -1522,7 +1522,7 @@ static void s3c24xx_serial_set_termios(struct uart_port *port, struct ktermios *termios, struct ktermios *old) { - struct s3c2410_uartcfg *cfg = s3c24xx_port_to_cfg(port); + const struct s3c2410_uartcfg *cfg = s3c24xx_port_to_cfg(port); struct s3c24xx_uart_port *ourport = to_ourport(port); struct clk *clk = ERR_PTR(-EINVAL); unsigned long flags; @@ -1691,7 +1691,7 @@ static const char *s3c24xx_serial_type(struct uart_port *port) static void s3c24xx_serial_config_port(struct uart_port *port, int flags) { - struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); + const struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); if (flags & UART_CONFIG_TYPE) port->type = info->port_type; @@ -1703,7 +1703,7 @@ static void s3c24xx_serial_config_port(struct uart_port *port, int flags) static int s3c24xx_serial_verify_port(struct uart_port *port, struct serial_struct *ser) { - struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); + const struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); if (ser->type != PORT_UNKNOWN && ser->type != info->port_type) return -EINVAL; @@ -1873,9 +1873,9 @@ s3c24xx_serial_ports[CONFIG_SERIAL_SAMSUNG_UARTS] = { */ static void s3c24xx_serial_resetport(struct uart_port *port, - struct s3c2410_uartcfg *cfg) + const struct s3c2410_uartcfg *cfg) { - struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); + const struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); unsigned long ucon = rd_regl(port, S3C2410_UCON); ucon &= (info->clksel_mask | info->ucon_mask); @@ -1979,7 +1979,7 @@ s3c24xx_serial_cpufreq_deregister(struct s3c24xx_uart_port *port) static int s3c24xx_serial_enable_baudclk(struct s3c24xx_uart_port *ourport) { struct device *dev = ourport->port.dev; - struct s3c24xx_uart_info *info = ourport->info; + const struct s3c24xx_uart_info *info = ourport->info; char clk_name[MAX_CLK_NAME_LENGTH]; unsigned int clk_sel; struct clk *clk; @@ -2021,7 +2021,7 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, struct platform_device *platdev) { struct uart_port *port = &ourport->port; - struct s3c2410_uartcfg *cfg = ourport->cfg; + const struct s3c2410_uartcfg *cfg = ourport->cfg; struct resource *res; int ret; @@ -2156,7 +2156,7 @@ static const struct of_device_id s3c24xx_uart_dt_match[]; static int probe_index; -static inline struct s3c24xx_serial_drv_data * +static inline const struct s3c24xx_serial_drv_data * s3c24xx_get_driver_data(struct platform_device *pdev) { #ifdef CONFIG_OF @@ -2419,7 +2419,7 @@ static struct uart_port *cons_uart; static int s3c24xx_serial_console_txrdy(struct uart_port *port, unsigned int ufcon) { - struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); + const struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); unsigned long ufstat, utrstat; if (ufcon & S3C2410_UFCON_FIFOMODE) { @@ -2615,7 +2615,7 @@ static struct console s3c24xx_serial_console = { #endif /* CONFIG_SERIAL_SAMSUNG_CONSOLE */ #ifdef CONFIG_CPU_S3C2410 -static struct s3c24xx_serial_drv_data s3c2410_serial_drv_data = { +static const struct s3c24xx_serial_drv_data s3c2410_serial_drv_data = { .info = { .name = "Samsung S3C2410 UART", .type = TYPE_S3C24XX, @@ -2643,7 +2643,7 @@ static struct s3c24xx_serial_drv_data s3c2410_serial_drv_data = { #endif #ifdef CONFIG_CPU_S3C2412 -static struct s3c24xx_serial_drv_data s3c2412_serial_drv_data = { +static const struct s3c24xx_serial_drv_data s3c2412_serial_drv_data = { .info = { .name = "Samsung S3C2412 UART", .type = TYPE_S3C24XX, @@ -2673,7 +2673,7 @@ static struct s3c24xx_serial_drv_data s3c2412_serial_drv_data = { #if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2416) || \ defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2442) -static struct s3c24xx_serial_drv_data s3c2440_serial_drv_data = { +static const struct s3c24xx_serial_drv_data s3c2440_serial_drv_data = { .info = { .name = "Samsung S3C2440 UART", .type = TYPE_S3C24XX, @@ -2703,7 +2703,7 @@ static struct s3c24xx_serial_drv_data s3c2440_serial_drv_data = { #endif #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) -static struct s3c24xx_serial_drv_data s3c6400_serial_drv_data = { +static const struct s3c24xx_serial_drv_data s3c6400_serial_drv_data = { .info = { .name = "Samsung S3C6400 UART", .type = TYPE_S3C6400, @@ -2732,7 +2732,7 @@ static struct s3c24xx_serial_drv_data s3c6400_serial_drv_data = { #endif #ifdef CONFIG_CPU_S5PV210 -static struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = { +static const struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = { .info = { .name = "Samsung S5PV210 UART", .type = TYPE_S3C6400, @@ -2784,17 +2784,17 @@ static struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = { .has_fracval = 1, \ } \ -static struct s3c24xx_serial_drv_data exynos4210_serial_drv_data = { +static const struct s3c24xx_serial_drv_data exynos4210_serial_drv_data = { EXYNOS_COMMON_SERIAL_DRV_DATA(), .fifosize = { 256, 64, 16, 16 }, }; -static struct s3c24xx_serial_drv_data exynos5433_serial_drv_data = { +static const struct s3c24xx_serial_drv_data exynos5433_serial_drv_data = { EXYNOS_COMMON_SERIAL_DRV_DATA(), .fifosize = { 64, 256, 16, 256 }, }; -static struct s3c24xx_serial_drv_data exynos850_serial_drv_data = { +static const struct s3c24xx_serial_drv_data exynos850_serial_drv_data = { EXYNOS_COMMON_SERIAL_DRV_DATA(), .fifosize = { 256, 64, 64, 64 }, }; @@ -2810,7 +2810,7 @@ static struct s3c24xx_serial_drv_data exynos850_serial_drv_data = { #endif #ifdef CONFIG_ARCH_APPLE -static struct s3c24xx_serial_drv_data s5l_serial_drv_data = { +static const struct s3c24xx_serial_drv_data s5l_serial_drv_data = { .info = { .name = "Apple S5L UART", .type = TYPE_APPLE_S5L, From patchwork Tue Mar 8 08:09:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 549600 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CD42C433FE for ; Tue, 8 Mar 2022 08:09:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344812AbiCHIKb (ORCPT ); Tue, 8 Mar 2022 03:10:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344763AbiCHIK0 (ORCPT ); Tue, 8 Mar 2022 03:10:26 -0500 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84FE43E0D2 for ; Tue, 8 Mar 2022 00:09:30 -0800 (PST) Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 56AC13F625 for ; Tue, 8 Mar 2022 08:09:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1646726969; bh=29Pf3ZsU5JJVOHBIO1WRfRouMVWJymQOmYuJyfmZYy4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LkfbNmA9Vjt18uCAYkD/pVLrecoVDZlQhW5ah475s/GQnogj6tnEjYQ6nHpDib1X3 R3473N8FT7FF25HiCF7EMiaMW6GYb2rCOMD99DeNX7sxtMEEGck8lzy7sT5Q3vpxBI XpwVT0ILex4z0miDeiAXMaognDhTvvCh6Za3ur3q8nAHkbimbx6oDPLOrHBm/uPr/A FAlsUBQA2n30Pq5et4NQzOgBQh3/2PWjbNK7MkxTLiLz3HpdqfNd4kkvD7NbRB7dl9 IbuMAczN6X4DYZi8g9FL42hBwyVVENMDDSSZby3uCMcI2qOufJ7M7nnCTPFuV9pVTh irARfJ5mM/3+Q== Received: by mail-ed1-f70.google.com with SMTP id l24-20020a056402231800b00410f19a3103so10133025eda.5 for ; Tue, 08 Mar 2022 00:09:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=29Pf3ZsU5JJVOHBIO1WRfRouMVWJymQOmYuJyfmZYy4=; b=WSru+BrIByQ13KHCNSrPcoNW/oJXLKLA1uh6UiAqaYAn0c3uFwmhK/jQcWpbXWAw7o +CaZjKZV3zGyyUBi7foNOY39HkRTz7ruFRjohtT1qBD9Xgz/WOsgzt/PvovL4pvY2QCC YJcCigk0wS+KWx+gr6VwYQGeGMqIuTMJNZi1d29ecZh2O/rPiCeD/htlXwuHamo5e23P 4PILjb0Tsh02wxlrDBmKbe9Zozdcl4/CkuOkLSdUJUkS49Qof3FiL/iSfkkerzZ7Z3Hq FUvTC0AR0q05+dbppa3cy1SCYblnJcJjgjJuh3P0lOD2/29tS4C41N9b4BLNC9Paej4R 43TQ== X-Gm-Message-State: AOAM53235Cx2zVcGIXVYkmNv9O9tMnTQWslSdPsUI+iJXzR8Axe94Eqv ur4yiKBkioz4rtS7p0DBdl7hIJiiDGn4aPW72DD3mJ0pWLCTvL1qbMfKjv24dqfcfOLMV/wh+Pb rv+o3cZx3nJ/kg6CZ1k90Vgc5qA4FlqnqlfcfMo1rTQ8TMJPR X-Received: by 2002:a17:906:9bd7:b0:6d6:e920:8d04 with SMTP id de23-20020a1709069bd700b006d6e9208d04mr12389909ejc.547.1646726969063; Tue, 08 Mar 2022 00:09:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJzCDpyzVeafJO+tBKmLNUmXCUwu/pvO8ES0IOzwYdYS55Y3KidkwCIqb81SC/LBMvb5FhouCg== X-Received: by 2002:a17:906:9bd7:b0:6d6:e920:8d04 with SMTP id de23-20020a1709069bd700b006d6e9208d04mr12389895ejc.547.1646726968858; Tue, 08 Mar 2022 00:09:28 -0800 (PST) Received: from localhost.localdomain (xdsl-188-155-174-239.adslplus.ch. [188.155.174.239]) by smtp.gmail.com with ESMTPSA id t4-20020a056402524400b00415b90801edsm7385697edd.57.2022.03.08.00.09.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 00:09:28 -0800 (PST) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Alim Akhtar , Greg Kroah-Hartman , Jiri Slaby , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v3 5/8] tty: serial: samsung: constify UART name Date: Tue, 8 Mar 2022 09:09:16 +0100 Message-Id: <20220308080919.152715-6-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220308080919.152715-1-krzysztof.kozlowski@canonical.com> References: <20220308080919.152715-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org The UART name from driver data holds only string literals. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jiri Slaby Reviewed-by: Alim Akhtar Tested-by: Alim Akhtar --- drivers/tty/serial/samsung_tty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c index c4b13f2d6e26..7025306f76b7 100644 --- a/drivers/tty/serial/samsung_tty.c +++ b/drivers/tty/serial/samsung_tty.c @@ -63,7 +63,7 @@ enum s3c24xx_port_type { }; struct s3c24xx_uart_info { - char *name; + const char *name; enum s3c24xx_port_type type; unsigned int port_type; unsigned int fifosize; From patchwork Tue Mar 8 08:09:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 550305 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B3DAC433EF for ; Tue, 8 Mar 2022 08:09:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344836AbiCHIKr (ORCPT ); Tue, 8 Mar 2022 03:10:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344805AbiCHIK3 (ORCPT ); Tue, 8 Mar 2022 03:10:29 -0500 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 145A63EB92 for ; Tue, 8 Mar 2022 00:09:32 -0800 (PST) Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id E52BE3F7DE for ; Tue, 8 Mar 2022 08:09:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1646726970; bh=Dr4tgo26oKDD7/cFmU+MgZtFQEJoCk73ZvgNX0zaNnk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=d0BvjM+h5s2IiTMR9GHZh9HQp7ZL+DxL0OEbCJZOQ2dH5k4Kt3uIwSIseMS+mkjui ZFKLsQ8Gc77r0Wz9fnFVsAZuqxjs2U/vwVVgkhEWvY3BfU0/CYE5ukWf2djwu06Lhl BV2GVwYRuH+aLSsVY4VIkFD0NlOv2Tq08OVvdJUtykdEZ+Bf3xEMPRyzgF7FY08TzV /5MPrPrXoe25X80xaVDgUprL1mpWfE8j7YqKld3yPKcSfdtUedRF/JdbORy8HpBE/n QLnpfMPg0eA9WvwK/SPuNXHpIML52HIY1xh5voZTXSRC/sObGOdy3EeoIyFQuLjRfV 8skUYkeuMNarQ== Received: by mail-ej1-f70.google.com with SMTP id h22-20020a1709060f5600b006b11a2d3dcfso8255405ejj.4 for ; Tue, 08 Mar 2022 00:09:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Dr4tgo26oKDD7/cFmU+MgZtFQEJoCk73ZvgNX0zaNnk=; b=GyDzQgiv9TpwTv7k9liZ6qsuAj/LKO5+/eBgf1DKyubRbAGw1/Du1+m5LVw78dnkFJ nADJxJxrNu7LsqGXO/xmA9CVSVLJFgj233RSN0DwnA2dWIiF6jlmM7FaU5YZq9D1aDNJ OUmmU9A8c2uieinkLrvECoEmKi4l2aSyKAUCg4RmaytqYrrxZMMQmDlGVgLZYLTLLiEV 0GXWjh5aRrzXqVZthrxfZBSNjUsBP/WMHS1LefIQyTQMFuItRjhBZ4t4Seg3qB06DnJ5 zVML7vsC1/VN5o+lS7Vput0RC5CM5AXdxM58kgmwVd1Y4CZuSrIky1GSBhGY7zKyAy43 JGJA== X-Gm-Message-State: AOAM532HswCSlJQpOnc4vyj6M6H4kZlHbXUJl6RYhgBc6feIAMnfSrLJ 4AS8BgBgs8c/voGblLfQED7pxK/q/anYcERf7aTLw4mSlIbGdbr9WnM3boXTwSdeovV0c4AJq6I x4NB5dgx1iZYjPoJyTKtPj35QihvAjNpMnV2dZEboMbyY/vse X-Received: by 2002:a17:906:3e90:b0:6b6:829b:577c with SMTP id a16-20020a1709063e9000b006b6829b577cmr12689317ejj.711.1646726970628; Tue, 08 Mar 2022 00:09:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJyvyuR3mb0kzIzmDG7xL2Oq1O5GTZ5RmEqTaJMl1TSRoKLAqTby19CSrJRxPUdjCfrfwqyzaw== X-Received: by 2002:a17:906:3e90:b0:6b6:829b:577c with SMTP id a16-20020a1709063e9000b006b6829b577cmr12689291ejj.711.1646726970318; Tue, 08 Mar 2022 00:09:30 -0800 (PST) Received: from localhost.localdomain (xdsl-188-155-174-239.adslplus.ch. [188.155.174.239]) by smtp.gmail.com with ESMTPSA id t4-20020a056402524400b00415b90801edsm7385697edd.57.2022.03.08.00.09.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 00:09:29 -0800 (PST) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Alim Akhtar , Greg Kroah-Hartman , Jiri Slaby , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v3 6/8] tty: serial: samsung: constify s3c24xx_serial_drv_data members Date: Tue, 8 Mar 2022 09:09:17 +0100 Message-Id: <20220308080919.152715-7-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220308080919.152715-1-krzysztof.kozlowski@canonical.com> References: <20220308080919.152715-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org The driver data (struct s3c24xx_serial_drv_data) is never modified, so also its members can be made const. Except code style this has no impact because the structure itself is always a const. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jiri Slaby Reviewed-by: Alim Akhtar Tested-by: Alim Akhtar --- drivers/tty/serial/samsung_tty.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c index 7025306f76b7..b9783d8fb440 100644 --- a/drivers/tty/serial/samsung_tty.c +++ b/drivers/tty/serial/samsung_tty.c @@ -85,9 +85,9 @@ struct s3c24xx_uart_info { }; struct s3c24xx_serial_drv_data { - struct s3c24xx_uart_info info; - struct s3c2410_uartcfg def_cfg; - unsigned int fifosize[CONFIG_SERIAL_SAMSUNG_UARTS]; + const struct s3c24xx_uart_info info; + const struct s3c2410_uartcfg def_cfg; + const unsigned int fifosize[CONFIG_SERIAL_SAMSUNG_UARTS]; }; struct s3c24xx_uart_dma { From patchwork Tue Mar 8 08:09:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 549599 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A3B8C433F5 for ; Tue, 8 Mar 2022 08:10:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344844AbiCHIK4 (ORCPT ); Tue, 8 Mar 2022 03:10:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344818AbiCHIKh (ORCPT ); Tue, 8 Mar 2022 03:10:37 -0500 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80C9B3EBA7 for ; Tue, 8 Mar 2022 00:09:33 -0800 (PST) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 520543F621 for ; Tue, 8 Mar 2022 08:09:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1646726972; bh=YZ43hLE0duJi88wrK3ybDZb8cX9SjP237BkyHbKYO34=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pDDkeXEo8kI2Eol4WTMcXtArxqTPkn90ZVA6sSq3Lhstfvmok0q7b8QaMqob6ippI GeWhc7q43OUEFC0buXfFBUWq833OfQKDJwtifZV1OBi5WClwqUoGIh8q/dvob2joTC PF/g1y/wVXa/a2xrDHuO1WmejP0t7K1Uvys0FLooAOwapbQp5bjB70vmkR+ZTQ70i8 xDs5l6mwT26ue1g/svXeZLgKooi0mXNOf8Ohsv7vI9wUFd7cKxvDfWaZXetM7Z38U6 StPeJFn2u3QQrdMTXeDVTbWsQiZD7DOZma7MZBSNCDBVcIZB1LX9i0q0TLVsUyUD/p +C/9ObqWceQ8Q== Received: by mail-ed1-f69.google.com with SMTP id da28-20020a056402177c00b00415ce4b20baso9225769edb.17 for ; Tue, 08 Mar 2022 00:09:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YZ43hLE0duJi88wrK3ybDZb8cX9SjP237BkyHbKYO34=; b=NirKfuA4GVgyj1e7+0WZOx6IcFuradyP6dsLw9Z6Zj3C4UEQdyMvRMKEz+io85zYL7 82vBbxPKeVu3CErteXuBOIY6ht+D8rOLEzBYB2TkwIO8XkmG8gfPPJXlmMFX8Wrmg1sr o+ikCLXRzq4ZdPf7yx+oIfeAEOwFo5WTsXvVj9D8hUTpq5m0KhyzBnWdD6J4OmIocqnR TUmOSqwD/Kdj5neJWaIuXqCqGsHtneiMp9atiX4AE6IeHgp0FssdGN39pI34517zsW16 AddN3SEedNh9a3qhSqaFAt5FIISR6vW+hjrXq8byPM6LDWzXsPc8NZhjx6p3mt5Tzne0 pFSw== X-Gm-Message-State: AOAM53080NYwiRdE0MnIttwx+SEDjLxpzvOWzS/lvB0BZWZeXVs41S/E JXve0QE3FcNzj/UZXLPv1Z1aqqpl7wdFwsVLx+a5Sw4GBmKx+Rpj2myha4lXS53Y9MVoYmZ0fo8 RRLzZ8c2EGNSWGxmCAsSQjxn+XhAoau3JER6OdYbAmaD2NFp+ X-Received: by 2002:a17:906:e08c:b0:6bb:6f89:7d59 with SMTP id gh12-20020a170906e08c00b006bb6f897d59mr12109650ejb.85.1646726971877; Tue, 08 Mar 2022 00:09:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyxGJcW6u1S98RfCw05htwWFvnVS+wlZNMJiHq0b+kovRBJRvSyL9xFWYDEk4pestC9EEEWVA== X-Received: by 2002:a17:906:e08c:b0:6bb:6f89:7d59 with SMTP id gh12-20020a170906e08c00b006bb6f897d59mr12109636ejb.85.1646726971666; Tue, 08 Mar 2022 00:09:31 -0800 (PST) Received: from localhost.localdomain (xdsl-188-155-174-239.adslplus.ch. [188.155.174.239]) by smtp.gmail.com with ESMTPSA id t4-20020a056402524400b00415b90801edsm7385697edd.57.2022.03.08.00.09.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 00:09:31 -0800 (PST) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Alim Akhtar , Greg Kroah-Hartman , Jiri Slaby , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v3 7/8] tty: serial: samsung: constify variables and pointers Date: Tue, 8 Mar 2022 09:09:18 +0100 Message-Id: <20220308080919.152715-8-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220308080919.152715-1-krzysztof.kozlowski@canonical.com> References: <20220308080919.152715-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Constify variables, data pointed by several pointers and "udivslot_table" static array. This makes code a bit safer. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jiri Slaby Reviewed-by: Alim Akhtar Tested-by: Alim Akhtar --- drivers/tty/serial/samsung_tty.c | 46 ++++++++++++++++---------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c index b9783d8fb440..3ffae912217c 100644 --- a/drivers/tty/serial/samsung_tty.c +++ b/drivers/tty/serial/samsung_tty.c @@ -164,7 +164,7 @@ static void s3c24xx_serial_tx_chars(struct s3c24xx_uart_port *ourport); #define portaddrl(port, reg) \ ((unsigned long *)(unsigned long)((port)->membase + (reg))) -static u32 rd_reg(struct uart_port *port, u32 reg) +static u32 rd_reg(const struct uart_port *port, u32 reg) { switch (port->iotype) { case UPIO_MEM: @@ -179,7 +179,7 @@ static u32 rd_reg(struct uart_port *port, u32 reg) #define rd_regl(port, reg) (readl_relaxed(portaddr(port, reg))) -static void wr_reg(struct uart_port *port, u32 reg, u32 val) +static void wr_reg(const struct uart_port *port, u32 reg, u32 val) { switch (port->iotype) { case UPIO_MEM: @@ -195,7 +195,7 @@ static void wr_reg(struct uart_port *port, u32 reg, u32 val) /* Byte-order aware bit setting/clearing functions. */ -static inline void s3c24xx_set_bit(struct uart_port *port, int idx, +static inline void s3c24xx_set_bit(const struct uart_port *port, int idx, unsigned int reg) { unsigned long flags; @@ -208,7 +208,7 @@ static inline void s3c24xx_set_bit(struct uart_port *port, int idx, local_irq_restore(flags); } -static inline void s3c24xx_clear_bit(struct uart_port *port, int idx, +static inline void s3c24xx_clear_bit(const struct uart_port *port, int idx, unsigned int reg) { unsigned long flags; @@ -221,19 +221,19 @@ static inline void s3c24xx_clear_bit(struct uart_port *port, int idx, local_irq_restore(flags); } -static inline struct s3c24xx_uart_port *to_ourport(const struct uart_port *port) +static inline struct s3c24xx_uart_port *to_ourport(struct uart_port *port) { return container_of(port, struct s3c24xx_uart_port, port); } /* translate a port to the device name */ -static inline const char *s3c24xx_serial_portname(struct uart_port *port) +static inline const char *s3c24xx_serial_portname(const struct uart_port *port) { return to_platform_device(port->dev)->name; } -static int s3c24xx_serial_txempty_nofifo(struct uart_port *port) +static int s3c24xx_serial_txempty_nofifo(const struct uart_port *port) { return rd_regl(port, S3C2410_UTRSTAT) & S3C2410_UTRSTAT_TXE; } @@ -358,7 +358,7 @@ static void s3c24xx_serial_tx_dma_complete(void *args) static void enable_tx_dma(struct s3c24xx_uart_port *ourport) { - struct uart_port *port = &ourport->port; + const struct uart_port *port = &ourport->port; u32 ucon; /* Mask Tx interrupt */ @@ -387,7 +387,7 @@ static void enable_tx_dma(struct s3c24xx_uart_port *ourport) static void enable_tx_pio(struct s3c24xx_uart_port *ourport) { - struct uart_port *port = &ourport->port; + const struct uart_port *port = &ourport->port; u32 ucon, ufcon; /* Set ufcon txtrig */ @@ -580,9 +580,9 @@ static inline const struct s3c24xx_uart_info } static inline const struct s3c2410_uartcfg - *s3c24xx_port_to_cfg(struct uart_port *port) + *s3c24xx_port_to_cfg(const struct uart_port *port) { - struct s3c24xx_uart_port *ourport; + const struct s3c24xx_uart_port *ourport; if (port->dev == NULL) return NULL; @@ -591,7 +591,7 @@ static inline const struct s3c2410_uartcfg return ourport->cfg; } -static int s3c24xx_serial_rx_fifocnt(struct s3c24xx_uart_port *ourport, +static int s3c24xx_serial_rx_fifocnt(const struct s3c24xx_uart_port *ourport, unsigned long ufstat) { const struct s3c24xx_uart_info *info = ourport->info; @@ -947,8 +947,8 @@ static irqreturn_t s3c24xx_serial_tx_irq(int irq, void *id) /* interrupt handler for s3c64xx and later SoC's.*/ static irqreturn_t s3c64xx_serial_handle_irq(int irq, void *id) { - struct s3c24xx_uart_port *ourport = id; - struct uart_port *port = &ourport->port; + const struct s3c24xx_uart_port *ourport = id; + const struct uart_port *port = &ourport->port; unsigned int pend = rd_regl(port, S3C64XX_UINTP); irqreturn_t ret = IRQ_HANDLED; @@ -966,8 +966,8 @@ static irqreturn_t s3c64xx_serial_handle_irq(int irq, void *id) /* interrupt handler for Apple SoC's.*/ static irqreturn_t apple_serial_handle_irq(int irq, void *id) { - struct s3c24xx_uart_port *ourport = id; - struct uart_port *port = &ourport->port; + const struct s3c24xx_uart_port *ourport = id; + const struct uart_port *port = &ourport->port; unsigned int pend = rd_regl(port, S3C2410_UTRSTAT); irqreturn_t ret = IRQ_NONE; @@ -1499,7 +1499,7 @@ static unsigned int s3c24xx_serial_getclk(struct s3c24xx_uart_port *ourport, * This table takes the fractional value of the baud divisor and gives * the recommended setting for the UDIVSLOT register. */ -static u16 udivslot_table[16] = { +static const u16 udivslot_table[16] = { [0] = 0x0000, [1] = 0x0080, [2] = 0x0808, @@ -1675,7 +1675,7 @@ static void s3c24xx_serial_set_termios(struct uart_port *port, static const char *s3c24xx_serial_type(struct uart_port *port) { - struct s3c24xx_uart_port *ourport = to_ourport(port); + const struct s3c24xx_uart_port *ourport = to_ourport(port); switch (ourport->info->type) { case TYPE_S3C24XX: @@ -2450,7 +2450,7 @@ s3c24xx_port_configured(unsigned int ucon) static int s3c24xx_serial_get_poll_char(struct uart_port *port) { - struct s3c24xx_uart_port *ourport = to_ourport(port); + const struct s3c24xx_uart_port *ourport = to_ourport(port); unsigned int ufstat; ufstat = rd_regl(port, S3C2410_UFSTAT); @@ -2935,7 +2935,7 @@ module_exit(samsung_serial_exit); * Early console. */ -static void wr_reg_barrier(struct uart_port *port, u32 reg, u32 val) +static void wr_reg_barrier(const struct uart_port *port, u32 reg, u32 val) { switch (port->iotype) { case UPIO_MEM: @@ -2951,15 +2951,15 @@ struct samsung_early_console_data { u32 txfull_mask; }; -static void samsung_early_busyuart(struct uart_port *port) +static void samsung_early_busyuart(const struct uart_port *port) { while (!(readl(port->membase + S3C2410_UTRSTAT) & S3C2410_UTRSTAT_TXFE)) ; } -static void samsung_early_busyuart_fifo(struct uart_port *port) +static void samsung_early_busyuart_fifo(const struct uart_port *port) { - struct samsung_early_console_data *data = port->private_data; + const struct samsung_early_console_data *data = port->private_data; while (readl(port->membase + S3C2410_UFSTAT) & data->txfull_mask) ; From patchwork Tue Mar 8 08:09:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 550304 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA473C433EF for ; Tue, 8 Mar 2022 08:10:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244997AbiCHILN (ORCPT ); Tue, 8 Mar 2022 03:11:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344823AbiCHIKh (ORCPT ); Tue, 8 Mar 2022 03:10:37 -0500 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED6BA3D1F6 for ; Tue, 8 Mar 2022 00:09:34 -0800 (PST) Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 9D7BC3F79D for ; Tue, 8 Mar 2022 08:09:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1646726973; bh=HBWgDosMAxuyNUJy93OLxsRzmckdD8hfFxFfwNDa3dk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gTeTFmNS5aebL7Hy7XLUm1mOhREgd7O3FVcgt1QYGhKZYxSTk0tWAjT/Uu5uryPoA WfdfSRFLipFl72xbXy1CV/QECMhWfStoQmy7CNGuIwk+yQOErXny4Imvz3QGPnBHbx HyTpYRFchYhuptwz8ri0GRWC9tGz0wRtIjclmAX0IzcLfNcgEYuhzwfbcxIosOOdv4 1p8odZsdwLxL7rJ1VoVq7ebhArOygBHhCtyh0p1wsLYviFJA5doITv0KvV9In/G0G3 btbNnnZXOYSoB9ikn2gfUfEC6xamK8/kZhGqJTcsTGfcS/bb3GpbzhIeqWjqcWaPKY lRR3IRG8dbuBQ== Received: by mail-ej1-f71.google.com with SMTP id x2-20020a1709065ac200b006d9b316257fso8283173ejs.12 for ; Tue, 08 Mar 2022 00:09:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HBWgDosMAxuyNUJy93OLxsRzmckdD8hfFxFfwNDa3dk=; b=geem1osgdDBWIzMCSz0Z/5vVIkPmytKfczQSW1GzBUw1epjcUVcL6nDsdDawUUYxu6 sE6q2iXIX4+rxRWqE22gh6Ifiy0badoSgyeNwIbMqhjMZ69vvyuxzO8DSOwAFX+mA8bN ySe9pXQLypev9QH4vdZMXLxqkaymgbJHFIeSc25oxPK0Eu45j6ZrN+Ydv3S/aOSXi/ao h2XaMH5WLxChB97ghFhmD5kyHHlcDc6YCm3VrPibnVVxgqp1m0GvmJ8k6mVnyBWryvKM d1y8PDYkln+V29A1kpu3jULVkMr3kzbLUFLvVE9drl+xJZo8a/s4dDpa9hyTjNGmSqxC i1CA== X-Gm-Message-State: AOAM530VYqwbr2HlZjpnHb2SU/5NWYTBwo7iajOtS9tmaSO93bxPd7jM DdLr3SP+QT1QS3FpFvk8Sc63LA4GyqJNn9f8/u3fEDivl27sKrFhC7ikiL1Lx+pXt3eh225qkM7 Ed/MrQQfp1ufuJo94H0sqfdo0hPkskJdH0A2zvLXMtx4U+Hfr X-Received: by 2002:a05:6402:3582:b0:416:6d78:c693 with SMTP id y2-20020a056402358200b004166d78c693mr1885066edc.24.1646726973213; Tue, 08 Mar 2022 00:09:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJwX4vanJVIXL0r2uldoJOauafSu6vD8LH4bQI9ff/g3MAlWaGOGZ5yN4YqE3lb73p272nAkog== X-Received: by 2002:a05:6402:3582:b0:416:6d78:c693 with SMTP id y2-20020a056402358200b004166d78c693mr1885050edc.24.1646726973053; Tue, 08 Mar 2022 00:09:33 -0800 (PST) Received: from localhost.localdomain (xdsl-188-155-174-239.adslplus.ch. [188.155.174.239]) by smtp.gmail.com with ESMTPSA id t4-20020a056402524400b00415b90801edsm7385697edd.57.2022.03.08.00.09.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 00:09:32 -0800 (PST) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Alim Akhtar , Greg Kroah-Hartman , Jiri Slaby , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v3 8/8] tty: serial: samsung: simplify getting OF match data Date: Tue, 8 Mar 2022 09:09:19 +0100 Message-Id: <20220308080919.152715-9-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220308080919.152715-1-krzysztof.kozlowski@canonical.com> References: <20220308080919.152715-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Simplify the code with of_device_get_match_data() and use dev_of_node() to remove ifdef-erry. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Alim Akhtar Tested-by: Alim Akhtar --- drivers/tty/serial/samsung_tty.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c index 3ffae912217c..74d466cc4152 100644 --- a/drivers/tty/serial/samsung_tty.c +++ b/drivers/tty/serial/samsung_tty.c @@ -2150,23 +2150,14 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, /* Device driver serial port probe */ -#ifdef CONFIG_OF -static const struct of_device_id s3c24xx_uart_dt_match[]; -#endif - static int probe_index; static inline const struct s3c24xx_serial_drv_data * s3c24xx_get_driver_data(struct platform_device *pdev) { -#ifdef CONFIG_OF - if (pdev->dev.of_node) { - const struct of_device_id *match; + if (dev_of_node(&pdev->dev)) + return of_device_get_match_data(&pdev->dev); - match = of_match_node(s3c24xx_uart_dt_match, pdev->dev.of_node); - return (struct s3c24xx_serial_drv_data *)match->data; - } -#endif return (struct s3c24xx_serial_drv_data *) platform_get_device_id(pdev)->driver_data; }