Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp262308pxb; Tue, 19 Oct 2021 02:17:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygwBhgJc0umSx5yrcNNgwU3oywzxrYCSkbCCIiBMp6fv5J3zajMMs1bTQ+yWP2DVGarWSL X-Received: by 2002:a17:906:2757:: with SMTP id a23mr35923072ejd.230.1634635063902; Tue, 19 Oct 2021 02:17:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1634635063; cv=pass; d=google.com; s=arc-20160816; b=NzuNwJw/uomVQ442NSDRnfwBlgtB1EnxU3rT5u5PDsXOtNoj7owIuoHDQzNiwIHjqr lTwV/JtbZxDZamNdg6tL3afy+Tvfuhy7kuEBkOCvRQqDLrhhLu0M7h5o2bzSoxdC2tQD GOXQq3dTUe5lT5pTbn7YrnVkGq8jIH4etel3gAm30aZJ7q+wg+6QHCjgY9V0AfUwyRHA n1NAKHu1EqBlg83wPZegzSAEB0E+WTnWVjmsfZO9304NTeQulWzSZ65rbx4rYCPOad9R ALVjxXraaExmJ4BqTWEHh1esRy1xAdna2aBtFCeZHpNQTYWPT9b5c/Xv0XDO9OxeDBTc /9UA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=mFheHQJ6WdWVbOFR2iqet41nB7ohpEtAMAWJRLQBtLw=; b=nlOMnC9mGdgVERUkKGwIkspgocxtkqDYqsOfBOUcLBmr2YHxP+DFfTk2MdhStPBK/k IalKuU6qs8KzLENz1H/GsY1mzJT7zXi5VWY4kI3UuAips4PxhjIjVI2uVQC9k+Sdc0L4 9VgdB7GJv9r7glSWDxx6ehLubG4hqB1kPWI4XuXO4FPUDrhWj1vsAL4SUQ4jpjJDa0ri mFxi0B97YXxA+SbS3NzsNgA3wF8UL+tcv/ESeChZkZY9uvsmIO8dTEagvDtFUKy7fSsr XgCI2DuKzsiHXVVBAkfCcYCiEISa+KdbVJNKe2FKY1YVn1nSSPmp4xCahFATwiTFeQic 7Qsg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@windriver.com header.s=PPS06212021 header.b=qBIfDjs+; arc=pass (i=1 spf=pass spfdomain=windriver.com dkim=pass dkdomain=windriver.com dmarc=pass fromdomain=windriver.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=windriver.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j1si24497739ejm.506.2021.10.19.02.17.19; Tue, 19 Oct 2021 02:17:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@windriver.com header.s=PPS06212021 header.b=qBIfDjs+; arc=pass (i=1 spf=pass spfdomain=windriver.com dkim=pass dkdomain=windriver.com dmarc=pass fromdomain=windriver.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=windriver.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234942AbhJSJRi (ORCPT + 99 others); Tue, 19 Oct 2021 05:17:38 -0400 Received: from mx0a-0064b401.pphosted.com ([205.220.166.238]:31760 "EHLO mx0a-0064b401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234511AbhJSJRh (ORCPT ); Tue, 19 Oct 2021 05:17:37 -0400 Received: from pps.filterd (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19J8VJZg018153; Tue, 19 Oct 2021 02:15:05 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : content-type : mime-version; s=PPS06212021; bh=mFheHQJ6WdWVbOFR2iqet41nB7ohpEtAMAWJRLQBtLw=; b=qBIfDjs+zgBW+UgnGgn4JC5mUo90pbHL7uL2eFQWqaGfE+5ZGWq7Si7mx1u6UU5hCTPF 5rNyKQ8fKyZqlD6toNIZAp+qv7+XGD4tnOR8+u/5leS3tHONQ23WsroJNjNRVod1aPPp HC+Xqbk9BdYgFCOI993Bu6Dxp7NxKGrHx1IttofcHaqANRnaeo8uakc7wTbCMhHPGBuU rGPO93T/HSB1VT1MVxfXtt1lCuiq9V4R6Ri2dtybqRZccQIpFE4ntCEqhokUzWwjn+O1 XmHLAkfOKxUkCe7Qz37D0BCOpkWMyVFJn3Im2MBEwACg3y7EiGOXcBtxlmAj+sxPNsfd Sg== Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2176.outbound.protection.outlook.com [104.47.58.176]) by mx0a-0064b401.pphosted.com with ESMTP id 3bsmtb088h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Oct 2021 02:15:05 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tll2JYk11RXpnwL31TIBLEuRqCLstS+1AsYfu/SzaJuvCGVJ/GrEkWEIS3iHbEeJnY4hBlIpBOzL99x5cnaNTsQ+GI5oCxtMqDu0DB5Z8rZugkMabLC3b/2JQIDeMsgqjMA4FT9aiE8UId4UZLFv5R7X8h2mR2+0P89NpHCRg4Fx3rjjLMWdn+NZGVfD3QNwvfJcTMdjB6U91YonOoz9KDVOXdmRhAI3WB3lgf+glbstONV6GnfMZIXy3kWaeHAtxj60cNFZzXwB0H7K32Nj9L3tNsXJaMkpv03mIeKsF6eWEDnA4G61zzpsFG4AeaYRl5NSdnQvQFOB7YwmDNNhKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mFheHQJ6WdWVbOFR2iqet41nB7ohpEtAMAWJRLQBtLw=; b=VchNTyTme9LwRU7eiKLohraH87vfn7zSERzZ76L9hyyMScmFEgUSu56/XcDeO/W6TUyxJqRlMrlFb/U9mqnqIUXcwAnlz764O4oeaSg9DDb4TULaJfPvGsDkaiAqKEeuss0AH9RESXGzltwa/ypb9KzvfbzSh22cR3BDW1xIFDHkB0HG/EHNE1Jp6clno+X4EOp0p4tgeekd5UJYbYEcbo0JGP6BLCCQGTAsFFawqf+0PG5pbzQv4AYuTvNg/MABsjM5gvzpryDKPyXwl1fDMUAz0dzsZe9GAgro3w52ZwSOo7/Lxu/f1U6j/8ZKg083UonamGrftfkyDheJsh4Ktg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Authentication-Results: grandegger.com; dkim=none (message not signed) header.d=none;grandegger.com; dmarc=none action=none header.from=windriver.com; Received: from PH0PR11MB5191.namprd11.prod.outlook.com (2603:10b6:510:3e::24) by PH0PR11MB4901.namprd11.prod.outlook.com (2603:10b6:510:3a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15; Tue, 19 Oct 2021 09:15:02 +0000 Received: from PH0PR11MB5191.namprd11.prod.outlook.com ([fe80::c11a:b99e:67ce:4a14]) by PH0PR11MB5191.namprd11.prod.outlook.com ([fe80::c11a:b99e:67ce:4a14%8]) with mapi id 15.20.4608.018; Tue, 19 Oct 2021 09:15:01 +0000 From: Meng Li To: wg@grandegger.com, mkl@pengutronix.de, davem@davemloft.net, kuba@kernel.org, mailhol.vincent@wanadoo.fr, socketcan@hartkopp.net, ramesh.shanmugasundaram@bp.renesas.com Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, meng.li@windriver.com Subject: [PATCH] driver: net: can: disable clock when it is in enable status Date: Tue, 19 Oct 2021 17:14:16 +0800 Message-Id: <20211019091416.16923-1-Meng.Li@windriver.com> X-Mailer: git-send-email 2.17.1 Content-Type: text/plain X-ClientProxiedBy: HK2PR06CA0012.apcprd06.prod.outlook.com (2603:1096:202:2e::24) To PH0PR11MB5191.namprd11.prod.outlook.com (2603:10b6:510:3e::24) MIME-Version: 1.0 Received: from pek-mli1-d2.wrs.com (60.247.85.82) by HK2PR06CA0012.apcprd06.prod.outlook.com (2603:1096:202:2e::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18 via Frontend Transport; Tue, 19 Oct 2021 09:14:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 87c6ece2-ac8a-4f4b-7931-08d992e0ee23 X-MS-TrafficTypeDiagnostic: PH0PR11MB4901: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 33A2Spc4jZlukxYDAhLQcABkgLKg7GBBLgnBY96w8WdYiFpVjfUQ+JEHg4OfmP/xKvRb0HOiGofol47JY0A6Rguc3ClkLLIStL2oWER4ht98oTjF+sWoT+K3GrYOEXgpiY52rKopetMzUwWuBqckXWLFEhmIp6FC/fBcrAhnvKxlCV9aOSYff1xsw9Sy3qjAbxRjw5Nzrq7LT4lib/BkKOlcqI6gk+L/hWayDAMZWggD0Bi1gRyGQIEYKegkz0slx+i4DBn4mE780lxHfRzrJIpNWrKdLt1lpKNGu6JpCqANHFLYptGcM0brUI6rgW/CpTIpW7qwIpXAoMZHfx4FZNEsnwSu+DrVsMtfdnW9EXY98o9NHqx83J5vSW5KYFDSLutCAEvFQ7O6SO34FsBGdICM4wk1gtAJh3IaBR4Qdu8Piy5O0WmfvayFB/RAJFMRP52ptreGaGhkjlAe6KzaQ2BMmBiar9z7uffE6y9a14tju6qi9NTgrGsurSl7LeGwVwftIsKwK0KJc61EzbJu9rgMKeI99DzbSxBJa/lbV/I5xxMy6sT6WWcevRoTqnwFUCDOGMCC7KzodcVznDpIWk49u8ZKjpr35wQlY5org4zp6OA0d6OHigfH834syhvEgjUdv6vx688N4Kr3SQE5SIkcCMPOeMcGVsEHM6OTtTyPO6KuRfOHT7mzmn3VVVI5Q5S2dsEG9dUN/j6MTCzlKw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5191.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(26005)(186003)(6666004)(8676002)(36756003)(508600001)(2906002)(52116002)(86362001)(66476007)(66556008)(83380400001)(1076003)(7416002)(5660300002)(6512007)(6486002)(8936002)(66946007)(38350700002)(38100700002)(316002)(2616005)(6506007)(956004)(107886003)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?TKWuEZxlB9gU0CWhdVVOGRaRZAHsqhDtM8pfmLphu/P2AMQCEf8yK7/ceGGq?= =?us-ascii?Q?iloWwctfOhlNoaiMwPaE0EN2aSOo0huHYwZVz3PnTv/kebCu7pZg9Jx+y5Vs?= =?us-ascii?Q?41fys0r7t0EpJSkptmai73Iy7FVtIOUoNDh7ynulRfyMzYDthzOFYiflkQuO?= =?us-ascii?Q?mXLaaZ+gYiQv5WX6MRFrK0W5ez2SSG4iY7ymZ0UjP92F3e18vBGCUzvpFcjh?= =?us-ascii?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p8PruAHac9qqriELRiza+iNFE26Bpll?= =?us-ascii?Q?cgVPanCXD9LR0P3yPgSNNo/z+hBffLH6zwTvPs3Me4Cgv6wZonD1O9jAbSIR?= =?us-ascii?Q?KPMUwueUzmQM2HxrAcgLmhvA9JPsGyV+mO2ittTbDe8s00KpMuafKRFnwmMs?= =?us-ascii?Q?R+PwYirEpxF/l+/k95TEoFez7fZMcKJ6ksrxN/U8DjfY4FxnGMB7GGPY0qgD?= =?us-ascii?Q?OuDzmtn8RFdAm2HC/6BXLYqr?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 87c6ece2-ac8a-4f4b-7931-08d992e0ee23 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5191.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 09:15:01.8324 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: her1UKag0IzzHyZIfP9nzXixZ5Jll2UibgO1xndOC3xLh8Qbb+jAtDa9MUWCnHki2wP1gG+o/pgrdmdoB6Fg4A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4901 X-Proofpoint-ORIG-GUID: 9AiDFZcj2Zba1GiuMmqxmBtyRPn9Qi-2 X-Proofpoint-GUID: 9AiDFZcj2Zba1GiuMmqxmBtyRPn9Qi-2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-18_07,2021-10-18_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=559 impostorscore=0 suspectscore=0 clxscore=1011 priorityscore=1501 adultscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 malwarescore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110190056 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If disable a clock when it is already in disable status, there will be a warning trace generated. So, it is need to confirm whether what status the clock is in before disable it. Fixes: a23b97e6255b ("can: rcar_can: Move Renesas CAN driver to rcar dir") Cc: stable@vger.kernel.org Signed-off-by: Meng Li --- drivers/net/can/rcar/rcar_can.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/rcar/rcar_can.c b/drivers/net/can/rcar/rcar_can.c index 48575900adb7..e340e32cd145 100644 --- a/drivers/net/can/rcar/rcar_can.c +++ b/drivers/net/can/rcar/rcar_can.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #define RCAR_CAN_DRV_NAME "rcar_can" @@ -857,7 +858,9 @@ static int __maybe_unused rcar_can_suspend(struct device *dev) writew(ctlr, &priv->regs->ctlr); priv->can.state = CAN_STATE_SLEEPING; - clk_disable(priv->clk); + if(__clk_is_enabled(priv->clk)) + clk_disable(priv->clk); + return 0; } -- 2.17.1