From patchwork Tue Jun 18 00:37:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 13701580 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DF495C2BB85 for ; Tue, 18 Jun 2024 00:38:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=K0nRAEwRS+Kqa+xFeL/UdK1/42jrpGZZ3oW8XiNINwY=; b=0D29YPIxjb4ekfQCb6s6Ynn/Rn 97W/lS8p6zWXE4xGTJM3y59nn0BGD2DMBeq4LNsCXLX2DoNJKEHPhJG8SH2x02O/U0yCGQ/AfPk7S 5it9zR+YPektc1EvbfLOiK5e63iUdnUVsJXG4QHbDu1jRV06ACZ8LBdkP+Xl9N81ItZ3rq7eavU2O eFuelaBO9vF193zRjIN+gojoFo6JxJuhs1MSfEPaOWTkq6m/FpUZOMLF/zO7k9C3rB6OtrmXdqxyt wJzdeLPVqwzc912ZkvVADOOwnoz4H86bI90T9rvzS4Ke/X9/vfsu4Gzd7X37I/njmLdqKmR+IOn2O GCgSbx3A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJMrF-0000000D4rW-1rZP; Tue, 18 Jun 2024 00:37:57 +0000 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJMr5-0000000D4lS-1Yoj for linux-arm-kernel@lists.infradead.org; Tue, 18 Jun 2024 00:37:49 +0000 Received: by mail-ot1-x334.google.com with SMTP id 46e09a7af769-6f855b2499cso2741076a34.1 for ; Mon, 17 Jun 2024 17:37:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718671066; x=1719275866; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=K0nRAEwRS+Kqa+xFeL/UdK1/42jrpGZZ3oW8XiNINwY=; b=KIzx5vc2I4u5V2LcAIgN3ys0YBERPEFx0tJ6o8Exxu9JeBfzolch+r6lk1tgdAm7LS dL38GOXZj8msexGKm1OKcwLrzJ10eU88mQNGQApYitIXCXkyZTLz9iHXpmMD5DirHCPt 4gOjQ6aphy9n5ag86rFdE1PSUNdDm+8SsOyNqm7XJkKGfATeqF5uF5YUbSFm8h8fJK83 ocyRyx669qAe26CVv4DSm3CIz7Q+680VeSvtJ2aY35f2ghCSZAEidFocOBzpcUEtDDzp FlHEHgzrY41sFL91hxSZOvkPX0yQjUqAfST674fodI+SooNwwTz7D8OVmKKdRjG5jBTx 8tQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718671066; x=1719275866; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K0nRAEwRS+Kqa+xFeL/UdK1/42jrpGZZ3oW8XiNINwY=; b=VCOph6x6J6TX3zdW1KExM3zucPNbaywYpc+x0nXdktO3Gtq2qmEIuAN6elKDQK2Uul rVys7hzelBG+VqqOz5NDAigS8MamrQB2FPy/X+RjirCqcOPMmqA7YcysSiadkWAQtWq9 X3Xr425vB+3RgDi3fLZDNCvP+c5YSxhUrTtINrbtyQEtMm4IdgUb+7sI4x1aDndvgtWG iXtLyrpP8ilYuAtuMMUZZ9GW5EvpM9l6065iE8tqdjEOxoZ4FpXeToX3ZhoZGwsicpDV oHwa+zWFSnUPloKpLIfqQc/iuu6zn4VRmjULhjftYahAzb83U1WWLLC4YImYKj0vBo40 4Teg== X-Forwarded-Encrypted: i=1; AJvYcCVspkXd9XrFKsd2dYpO4YiN4geKa4xy4zYP6YOhzj46Rmj3NKwWFVScDOjMyD6oeajp0Wc9bEl2H5JA2Iz+cQBOky9kS/++Sdl43v9WNTJOOJQONWQ= X-Gm-Message-State: AOJu0YziVkd/Z/WQkriVfSXN+gm9f1ldcvkWDLwBlS6IU4Lfk44IWIPz 3SqqzW0J1gRg+hcPdL1QHsJx2/ykIECr1rgwxXbi6p8e4KkbC8R4JP/M+SpcS84= X-Google-Smtp-Source: AGHT+IGJdLC4WFJwxFevTuE9JllHcgHxe3B4leT9QNXKwBCjfTWKffWwR3974mIIt9gULbt3K2lVdg== X-Received: by 2002:a9d:66c7:0:b0:6f9:6f4b:f5ce with SMTP id 46e09a7af769-6fb93297d78mr12526107a34.8.1718671065819; Mon, 17 Jun 2024 17:37:45 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-6fb5b1eb6c8sm1738540a34.43.2024.06.17.17.37.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 17:37:45 -0700 (PDT) From: Sam Protsenko To: =?utf-8?q?=C5=81ukasz_Stelmach?= , Krzysztof Kozlowski , Rob Herring , Conor Dooley Cc: Olivia Mackall , Herbert Xu , Alim Akhtar , linux-samsung-soc@vger.kernel.org, linux-crypto@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/7] hwrng: exynos: Improve coding style Date: Mon, 17 Jun 2024 19:37:39 -0500 Message-Id: <20240618003743.2975-4-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240618003743.2975-1-semen.protsenko@linaro.org> References: <20240618003743.2975-1-semen.protsenko@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240617_173747_448535_6C0C5948 X-CRM114-Status: GOOD ( 14.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Fix obvious style issues. Some of those were found with checkpatch, and some just contradict the kernel coding style guide. No functional change. Signed-off-by: Sam Protsenko Reviewed-by: Krzysztof Kozlowski --- drivers/char/hw_random/exynos-trng.c | 61 +++++++++++++--------------- 1 file changed, 29 insertions(+), 32 deletions(-) diff --git a/drivers/char/hw_random/exynos-trng.c b/drivers/char/hw_random/exynos-trng.c index 0ed5d22fe667..88a5088ed34d 100644 --- a/drivers/char/hw_random/exynos-trng.c +++ b/drivers/char/hw_random/exynos-trng.c @@ -23,45 +23,41 @@ #include #include -#define EXYNOS_TRNG_CLKDIV (0x0) - -#define EXYNOS_TRNG_CTRL (0x20) -#define EXYNOS_TRNG_CTRL_RNGEN BIT(31) - -#define EXYNOS_TRNG_POST_CTRL (0x30) -#define EXYNOS_TRNG_ONLINE_CTRL (0x40) -#define EXYNOS_TRNG_ONLINE_STAT (0x44) -#define EXYNOS_TRNG_ONLINE_MAXCHI2 (0x48) -#define EXYNOS_TRNG_FIFO_CTRL (0x50) -#define EXYNOS_TRNG_FIFO_0 (0x80) -#define EXYNOS_TRNG_FIFO_1 (0x84) -#define EXYNOS_TRNG_FIFO_2 (0x88) -#define EXYNOS_TRNG_FIFO_3 (0x8c) -#define EXYNOS_TRNG_FIFO_4 (0x90) -#define EXYNOS_TRNG_FIFO_5 (0x94) -#define EXYNOS_TRNG_FIFO_6 (0x98) -#define EXYNOS_TRNG_FIFO_7 (0x9c) -#define EXYNOS_TRNG_FIFO_LEN (8) -#define EXYNOS_TRNG_CLOCK_RATE (500000) - +#define EXYNOS_TRNG_CLKDIV 0x0 + +#define EXYNOS_TRNG_CTRL 0x20 +#define EXYNOS_TRNG_CTRL_RNGEN BIT(31) + +#define EXYNOS_TRNG_POST_CTRL 0x30 +#define EXYNOS_TRNG_ONLINE_CTRL 0x40 +#define EXYNOS_TRNG_ONLINE_STAT 0x44 +#define EXYNOS_TRNG_ONLINE_MAXCHI2 0x48 +#define EXYNOS_TRNG_FIFO_CTRL 0x50 +#define EXYNOS_TRNG_FIFO_0 0x80 +#define EXYNOS_TRNG_FIFO_1 0x84 +#define EXYNOS_TRNG_FIFO_2 0x88 +#define EXYNOS_TRNG_FIFO_3 0x8c +#define EXYNOS_TRNG_FIFO_4 0x90 +#define EXYNOS_TRNG_FIFO_5 0x94 +#define EXYNOS_TRNG_FIFO_6 0x98 +#define EXYNOS_TRNG_FIFO_7 0x9c +#define EXYNOS_TRNG_FIFO_LEN 8 +#define EXYNOS_TRNG_CLOCK_RATE 500000 struct exynos_trng_dev { - struct device *dev; - void __iomem *mem; - struct clk *clk; - struct hwrng rng; + struct device *dev; + void __iomem *mem; + struct clk *clk; + struct hwrng rng; }; static int exynos_trng_do_read(struct hwrng *rng, void *data, size_t max, bool wait) { - struct exynos_trng_dev *trng; + struct exynos_trng_dev *trng = (struct exynos_trng_dev *)rng->priv; int val; max = min_t(size_t, max, (EXYNOS_TRNG_FIFO_LEN * 4)); - - trng = (struct exynos_trng_dev *)rng->priv; - writel_relaxed(max * 8, trng->mem + EXYNOS_TRNG_FIFO_CTRL); val = readl_poll_timeout(trng->mem + EXYNOS_TRNG_FIFO_CTRL, val, val == 0, 200, 1000000); @@ -122,7 +118,7 @@ static int exynos_trng_probe(struct platform_device *pdev) trng->rng.init = exynos_trng_init; trng->rng.read = exynos_trng_do_read; - trng->rng.priv = (unsigned long) trng; + trng->rng.priv = (unsigned long)trng; platform_set_drvdata(pdev, trng); trng->dev = &pdev->dev; @@ -175,7 +171,7 @@ static int exynos_trng_probe(struct platform_device *pdev) static void exynos_trng_remove(struct platform_device *pdev) { - struct exynos_trng_dev *trng = platform_get_drvdata(pdev); + struct exynos_trng_dev *trng = platform_get_drvdata(pdev); clk_disable_unprepare(trng->clk); @@ -204,7 +200,7 @@ static int exynos_trng_resume(struct device *dev) } static DEFINE_SIMPLE_DEV_PM_OPS(exynos_trng_pm_ops, exynos_trng_suspend, - exynos_trng_resume); + exynos_trng_resume); static const struct of_device_id exynos_trng_dt_match[] = { { @@ -225,6 +221,7 @@ static struct platform_driver exynos_trng_driver = { }; module_platform_driver(exynos_trng_driver); + MODULE_AUTHOR("Ɓukasz Stelmach"); MODULE_DESCRIPTION("H/W TRNG driver for Exynos chips"); MODULE_LICENSE("GPL v2");