From patchwork Tue Feb 6 18:43:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 197582 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1743726dyb; Tue, 6 Feb 2024 10:44:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IHMJQVWbZRtC0gXCqgcft7BN4xr9k3Ea40C9MpyvwfCzNBSnJvlF/4jGU6rzFHyMTmiFK55 X-Received: by 2002:a50:9e81:0:b0:55f:cc6d:29b5 with SMTP id a1-20020a509e81000000b0055fcc6d29b5mr9646658edf.21.1707245083964; Tue, 06 Feb 2024 10:44:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707245083; cv=pass; d=google.com; s=arc-20160816; b=lsHBWMfqL4J30ZiifEpe5dNyvncwsRmJHR18+b8mQomMFY2OtcF9oqSwVlJvSmCuNu 7n5D+NOJd+gzNG75PqfD2l5UYtKkchutcGC2AsnkXVw05qO1CXDNxpmjHSVreUFyIFwA 7Xk0/feL0QkOtQal9iFBJ7Wskf3G71/CIOQVPYB7Ip7WpXXjut108a8fbvrWc5oNuHQo QAf0DZih1Hy/CWFN2fBz4q+Ya7dLXuSXfoWMIU/YfBOdMRoRNZrErKBKB213VVpZd4oE 9RG91/NzseNDAv3qdz89aQTMPaNQ7Dh1RwGqgbQvvxHbsTN1JvQ6v902/7jUhTy4zFnf aEJQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=xM2C1iHMDXw9CwZlcSXjRB1uc7rC+T3sEjwlxMY+VkA=; fh=aFVI+nEPkvv3E9p3XwMQBhY1rG5g6w5jQsbthKpuTDM=; b=L5ZKFuDzRfyG4/yHLCVMLP2uM6cnUfLlt4Cb6CcW/h8Y8Sg4bQ4/oEL9vI3DaXu+EU v3YJE1RVvMqQ+FZ8D7cw4uQkx4IPfFsqVw3m8Kj/NSKsS51lBpRQd7rV2zkOqY69bxGk KyJAxoUWXfimGYdxgrbtgSYVbHpo7ORhW9Gd1C3rsoUfDGSONR4UnHYD7/mb7EkWSHcQ cmiP7C6uLW/PK6wQh5G+z61rg4oaCNTZ/c0LAHLGhfz6m8A9rPZ0vpCw8f30rUxSptR+ KBaIgDsyYLG5/jL6t+Z1YHONPM/1psqKZ01Z7CQoLG6Ul5BgzcwSEeTei3oYZDAgW+5J 7wCw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d1nr+2Yw; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-55471-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55471-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=1; AJvYcCXw0vgaJvdgllEOL3fRJ1rDBSasRHszrJCwsw5nO+8QtJed8/Vdg6r/Um+i5l/FoCb0FNj6UNdFDsPcZIsGoRur3qdBvg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a38-20020a509ea9000000b0055f40a5c49asi1369453edf.604.2024.02.06.10.44.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 10:44:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55471-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d1nr+2Yw; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-55471-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55471-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 603761F26275 for ; Tue, 6 Feb 2024 18:44:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D4DAF171D4; Tue, 6 Feb 2024 18:43:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="d1nr+2Yw" Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8920E134CE for ; Tue, 6 Feb 2024 18:43:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707245025; cv=none; b=gGL/MjcCZ35MNNIUPvLuvwk2aGiWJR2Rp3PTT+ToXjeMPL+89SqS1vqi6q7vKBWYfdkAGU0XJaBPU/upV2JzdB0fyoxPqe2+UiXaoFxoXUFBTOAlVU6kTs7o/wp8j1g2VYIdcRvUtFOg5a4yaIKDC/9OmSBg6Ck5RrCSQnx7NIc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707245025; c=relaxed/simple; bh=eVTHPrT2Om77CguELWV9DheT0YsZYlvmQpUZDIbQJew=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VktMhGO8WFbZad85x4qIHFlibxvA2VmFn/CPONCOCiRkLohou8hjbLahLYLyV4UGvV47E5a0N46cpwj4cBvfjKyxgF5OOlFRadl/s5uX+tmeqG22r1SltsOyccyBC+5ZbfSluR0ZExG8O8ae6aseJvsbtZfz/QciG/ajqnXvuOo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=d1nr+2Yw; arc=none smtp.client-ip=209.85.218.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a30e445602cso197491166b.0 for ; Tue, 06 Feb 2024 10:43:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707245022; x=1707849822; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=xM2C1iHMDXw9CwZlcSXjRB1uc7rC+T3sEjwlxMY+VkA=; b=d1nr+2YwHnbjAZxbYIACIvrQa3Hushxw16qK24cdSyo37se8svev5SnHHjW1tNz5Ml o9bdSNiF4+9uGPSsc0BOyzsiiHrQ5sitdPAkKmQPCKKFem6B7zYP8vLKM4T87TnrwXCK 0o0tkMn5hMKpb0l7OOZfa1K8tDk1iaNvpLsJrFQMIn/6VGhrEKfJnuqK1ke9pDSb+jB5 qrHeStwNV+LHm8uhm84WluNMJNRWEMb6Cb9RWIB7wshBtHgkHnHaVqOajNuV0TeKaU/7 kY+739UO1UDPVIOTooqO8kEHeMzuvoLRXsWduMFeVvIexuZbdcAEon7zbnhrDRmB8Vlu mbKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707245022; x=1707849822; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xM2C1iHMDXw9CwZlcSXjRB1uc7rC+T3sEjwlxMY+VkA=; b=c7QER30RaA46fqPYGauTVgzzjo24dXSn7fnkMZoja/4LiZo5MbCAXz5JVLCNE/Bdaf dmUJ8baB5i3SGsV3YPYy5vJvFq8P4cpL2tBu6H85pW1RhHK7x5q2AhQwCRXoKbZFoO74 Xwj2k16YOtGDLusR+wBv60z+dQrkCbNdIHZ9UXCfAImAYxKgrUATmBRuza25Bzp2Y3Bm 8GCEh0pWm8RJL4IiQ9ekO0Pvo48Ry1uU/to0VGHYmLHaagJUEKfLhzcxrjQuJYjW7it1 vwZB2OvkQd6LUPgYnnbfzJ7uUq8Z7j+48mm5Nbo7KV3vbNkCecdt1ab8GiviB00Mvjf0 WD+A== X-Gm-Message-State: AOJu0YzHljyOFazR/mSaBV+JmeZe7yWHDdQP8Y6z/oTdDr0MicBDIJ9T tAFJH3ONsvI2n2IFfpWBa0fa96cl/ZGWldCtdSgikPMTGA50y4rbLm4GlGUAgEvUF0Zc48Wccgo L X-Received: by 2002:a17:906:4e8b:b0:a37:687:275c with SMTP id v11-20020a1709064e8b00b00a370687275cmr3895405eju.20.1707245022012; Tue, 06 Feb 2024 10:43:42 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCWM+GgllHBWJ2Etigt3pjbEE3yQWss9rZmqNix9IDfjo96W69+gFfgzX+EoOyxHGK9XyfhotbgkKC/2xK0Rs3ENtxKyU9Rv6N29Q6+UzFrih3srAH//Lf/RoSThaXYcb9SX+7Oj++/Yae6fy5u6ZrpertCdAMcBDia7qcSLrEubBjVSXU3FhCsssN0p6lKBF1fMp1xCZmZhyfG8FoK3FXgHrdBf7vJ7X5G2DxfxbkERILWbIrM84Qkumq1tEx4QcMjIkOVNpKjWBjPoZEUEgQpVmO/ineA+S0p7F7MH/55feTOJpKahEPD3b2OIlT1dlbuyPnC3Tj1hquwYfEYHjPawp6nkr9i6h04jiuswwfBBSu+I1GpZtmb/DoXy5npAupQjn27HGRIKhcnx+liyK6Lk4T/8HshXfewb/2sTER1D/ARMUMDbhLeKQqe/aIREZ8sQ4OadVyDJ Received: from [10.167.154.1] (037008245233.garwolin.vectranet.pl. [37.8.245.233]) by smtp.gmail.com with ESMTPSA id un9-20020a170907cb8900b00a384365e3b9sm562305ejc.195.2024.02.06.10.43.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 10:43:41 -0800 (PST) From: Konrad Dybcio Date: Tue, 06 Feb 2024 19:43:35 +0100 Subject: [PATCH v2 02/18] clk: qcom: reset: Commonize the de/assert functions Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240105-topic-venus_reset-v2-2-c37eba13b5ce@linaro.org> References: <20240105-topic-venus_reset-v2-0-c37eba13b5ce@linaro.org> In-Reply-To: <20240105-topic-venus_reset-v2-0-c37eba13b5ce@linaro.org> To: Bjorn Andersson , Michael Turquette , Stephen Boyd , Philipp Zabel Cc: Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Bryan O'Donoghue , Dikshita Agarwal , Vikash Garodia , Manivannan Sadhasivam , Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1707245017; l=1957; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=eVTHPrT2Om77CguELWV9DheT0YsZYlvmQpUZDIbQJew=; b=BZQy6EUUZshJ+QDMMiLJvwCLm5SPTPfLO63fDw/6rPwVOSyeW8TZ1Eh0LDNn95U8eLZ0YsW3m AZQz+o8uwqQAtJZdCTKk4N2E5PrOw3bN7o3Qtzw6VTv2nXKOAtbYi7K X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790176221184698987 X-GMAIL-MSGID: 1790176221184698987 They do the same thing, except the last argument of the last function call differs. Commonize them. Reviewed-by: Bryan O'Donoghue Signed-off-by: Konrad Dybcio --- drivers/clk/qcom/reset.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/clk/qcom/reset.c b/drivers/clk/qcom/reset.c index e45e32804d2c..20d1d35aaf22 100644 --- a/drivers/clk/qcom/reset.c +++ b/drivers/clk/qcom/reset.c @@ -22,8 +22,8 @@ static int qcom_reset(struct reset_controller_dev *rcdev, unsigned long id) return 0; } -static int -qcom_reset_assert(struct reset_controller_dev *rcdev, unsigned long id) +static int qcom_reset_set_assert(struct reset_controller_dev *rcdev, + unsigned long id, bool assert) { struct qcom_reset_controller *rst; const struct qcom_reset_map *map; @@ -33,21 +33,17 @@ qcom_reset_assert(struct reset_controller_dev *rcdev, unsigned long id) map = &rst->reset_map[id]; mask = map->bitmask ? map->bitmask : BIT(map->bit); - return regmap_update_bits(rst->regmap, map->reg, mask, mask); + return regmap_update_bits(rst->regmap, map->reg, mask, assert ? mask : 0); } -static int -qcom_reset_deassert(struct reset_controller_dev *rcdev, unsigned long id) +static int qcom_reset_assert(struct reset_controller_dev *rcdev, unsigned long id) { - struct qcom_reset_controller *rst; - const struct qcom_reset_map *map; - u32 mask; - - rst = to_qcom_reset_controller(rcdev); - map = &rst->reset_map[id]; - mask = map->bitmask ? map->bitmask : BIT(map->bit); + return qcom_reset_set_assert(rcdev, id, true); +} - return regmap_update_bits(rst->regmap, map->reg, mask, 0); +static int qcom_reset_deassert(struct reset_controller_dev *rcdev, unsigned long id) +{ + return qcom_reset_set_assert(rcdev, id, false); } const struct reset_control_ops qcom_reset_ops = {