Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2424185rdb; Thu, 21 Sep 2023 19:59:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGe1xm7+STjCswNsMGd1GHhAJ9k8X6n6V3m5K43wojzPhtsjsdtcvr5+nUvJkeE+E1VhPJH X-Received: by 2002:a17:902:e812:b0:1c5:6b7a:dbb0 with SMTP id u18-20020a170902e81200b001c56b7adbb0mr7183675plg.29.1695351592136; Thu, 21 Sep 2023 19:59:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1695351592; cv=pass; d=google.com; s=arc-20160816; b=qmihhv+DBe7IihR/wr6CwiMOmGWLRAOKkyMOaac5yiQAVk93+/0hej7Wq70yRTJ5Wu xvS182vLGlLSLPzG3iKq2U7OzJqrnFg/arkgc/mr6jpMFyS18lqnP0dpxSEYHlvzin2x YKX6jhFd1egjETZel9r6nVVUVlbneHevA92eEguOgR4TymjlQ24Q2WTmjh0quZKqS8PQ 9eZixJFjh4h/fviY/TuZT1++vFb1tz7uBVEoeBxH/GoKmYsGqkxtsw4RXBGrrmTz6Dlq 9oS4aPNMIBaA6r+A+mFf9zfgoqo7aaSVxCa2QK+oD8TDk2ac0HondIjZTg/qpVJgox/3 opxQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=I7HbrAO2tKhQjlUQWQ+4ql1lxSP+dYyZf4RUR0Xy72A=; fh=qFyfG6g7fHN0QEB3+K3Di6vdnZphfCkyuLvO81dux24=; b=Wl67OpfufrCuRxVTLVEs+10ij9+//PQxJh17UgbDM7p+WiXg0kbSRZsRwjpVj0dY8W vjR0lGteW4IPfb15y0H4M+xI7Vvyi92RoJ1V5Jt1t0gyyMUpyJn5BFrh/6gcvnQ2eGkl sCpSMMt9bWmDIo8NGI3F5fL8ewwDwpIKSysYATBSjkbQuYRNTRF+ungJqoCa7Z/FC049 gPG8Ef/kuhgVMBL/FthIGzPqM2FVa8TaqbdtHA5WkVOOF7AZ1Erusm2WYNcltbNrXvwP rnas/FlShVITs222PRz6omCRlWZnir2yo2WLodqYCBOkzUE4Pl1ka/MDe72FubRoWF1m 8Nrw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bp.renesas.com header.s=selector1 header.b=N5T6GGXc; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dkim=pass dkdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=renesas.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id kg5-20020a170903060500b001c3f96ec6d6si2757955plb.111.2023.09.21.19.59.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 19:59:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@bp.renesas.com header.s=selector1 header.b=N5T6GGXc; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dkim=pass dkdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id D0A1C8317499; Wed, 20 Sep 2023 06:33:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234946AbjITNdd (ORCPT + 99 others); Wed, 20 Sep 2023 09:33:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234646AbjITNdc (ORCPT ); Wed, 20 Sep 2023 09:33:32 -0400 Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01on2135.outbound.protection.outlook.com [40.107.114.135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE9DB9E; Wed, 20 Sep 2023 06:33:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BjbjOvREyODCbi8eETgNBHjyliLyzYJNlZ0VZPd/OEkwCrgKl8qvWivRo6yzuJiKe3aHyvT7un7V/imSCxP2uyGxoTMBVIA6h8a0hUOW5l0nkT1SCdG/RFzRWYrazyg9BoplaApgvaiuvcD2ag/jR05MtQWM2DPfAGX/Tmc9JlUsEzMS5Usm3CwC/IrGk4a9GTbaitVXHWI+vJPYLayWFnG/kHGsxVRsCq25I51V/sltdn1bet1GKY/jItOmOamjUacjQxl3HhZE/7zQST4WgGk7WloWYCmKCMLUuriIPfysp/0IuM5GoHha57FOCrhjC5iJZ2hPF6Nl9dBfe5zQ0Q== 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=I7HbrAO2tKhQjlUQWQ+4ql1lxSP+dYyZf4RUR0Xy72A=; b=I+hiSyHbGWhpdwFnvM3zkUMcnM1dqXlndE7lm13fkaDbiTDS+wQfjAd/P8R990HzocXbYntIvMazTuiz/6mKlprnZmTmkW6sx5ssbuZGsgalewVB+ZZ6NMKZMn5Y0Y+LsEf0RXkrxz8atZLwdq7LWfYvIWdOUBalSczxllSMmnWONcdzksvLIhYQ4BdmarJsH0qKy2HYEqc/+1L7oHlj/rK7bLpi7kh9y/miwSaoXGIyAeP8LFMGBXw8bung4YxfzaUUSAN7lriAyp1KAZ/Cx2bCCPeaFYAAfTW9TdC/VPMX7ejf1Cj33BISTPWerXGd0es9oqF3Z303lTfRuLtmjQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=bp.renesas.com; dmarc=pass action=none header.from=bp.renesas.com; dkim=pass header.d=bp.renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bp.renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I7HbrAO2tKhQjlUQWQ+4ql1lxSP+dYyZf4RUR0Xy72A=; b=N5T6GGXcQX/u+FZPssgVosSlqO9DHdrrAHM6vb8ACThp7O0+W4wmz666rQ4MgHqstwePLgja0qlM+7A8G4qG/yoB/VJ/HmDf2zZRTaceyp3mexdVG5Ju5v13cNmNCgou/GO5hOaKaoXgsuxsPE8t5ZBgTXjROJSCPJoU4LSsg8w= Received: from OS0PR01MB5922.jpnprd01.prod.outlook.com (2603:1096:604:bb::5) by TYWPR01MB10115.jpnprd01.prod.outlook.com (2603:1096:400:1e7::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.19; Wed, 20 Sep 2023 13:33:23 +0000 Received: from OS0PR01MB5922.jpnprd01.prod.outlook.com ([fe80::9d23:32f5:9325:3706]) by OS0PR01MB5922.jpnprd01.prod.outlook.com ([fe80::9d23:32f5:9325:3706%5]) with mapi id 15.20.6813.017; Wed, 20 Sep 2023 13:33:23 +0000 From: Biju Das To: Biju Das , Alexandre Belloni CC: Thomas Gleixner , Alessandro Zummo , John Stultz , Stephen Boyd , Geert Uytterhoeven , Biju Das , "linux-rtc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-renesas-soc@vger.kernel.org" Subject: RE: [PATCH] alarmtimer: Fix rebind failure Thread-Topic: [PATCH] alarmtimer: Fix rebind failure Thread-Index: AQHZ67nxDPIpzSJRaUGrxRMZix2AJrAjtMiAgAAA3DCAAAChAA== Date: Wed, 20 Sep 2023 13:33:23 +0000 Message-ID: References: <20230920115935.144391-1-biju.das.jz@bp.renesas.com> <2023092013265355e7a02a@mail.local> In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=bp.renesas.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: OS0PR01MB5922:EE_|TYWPR01MB10115:EE_ x-ms-office365-filtering-correlation-id: a9566ceb-51b1-4ddb-6647-08dbb9de2989 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: JbvAhBuTgHbv1qWnLXHwmLu4UQxsVKu7ckl5dTG2JVfdjmVST8emxoKPB4Gu8Wh/7c7+yockz8/6hje2Brx3D+UMEMsDf9ISB3LT0lhT8wZB9FTiQ6tjVinakWpfLw+WQ3+Glj/foqSIjEIVTfXhou01K+KoR7YwQAYzdLR8l0xQa0B45+Y1GajyFz5U5KlZOqQV5is31PH4j+8vJV7RnSD3C1t+pS97aAoY+l4Q/5fgwN6FOw58xJZXWUroMlcUCBzk5U2KDKz2rmhisLc3lyE9lgNtup9Y+xMoTYCH/4bAxfuK6AGEGY/Cg1BnyHCCHAvt0J8ioeimbC6aXs72wiKVG4TWznE4l7ZkcX5u9ipJUk6kprXBkYg6rd4tyOdbO1657vr+vBJc37aYlbp6PPh/tHjpGzSdYx/PwKpM/igvy+bWoA0TZgeqBV8fRPbpJV4M805W9q+krj0pN+RPszx5GQRzGrPgUuElwcro2KYzfi6kLJwP7o+ExCM/XZSVnNHs8GdeLNcK12ns/MI5XoXBQqjoxYAYhFUGaPLjnX3GirbIDH0Lk8FHOxv5E61E9ZXEgR6GvNakJnID+ekMioEr3vYFG9dqWlkZXKQE9Cqx8T4jGJsZfkzRV6qwmHXH x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:OS0PR01MB5922.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(39860400002)(346002)(376002)(136003)(366004)(186009)(1800799009)(451199024)(2940100002)(71200400001)(7696005)(9686003)(6506007)(478600001)(83380400001)(4326008)(7416002)(2906002)(5660300002)(8676002)(66556008)(8936002)(64756008)(76116006)(66946007)(54906003)(66446008)(41300700001)(316002)(66476007)(110136005)(52536014)(86362001)(33656002)(55016003)(38070700005)(38100700002)(122000001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?w+FLR9Hmk9BSol4ArWxirXkGyIeX0SzHSNz107dXQJvnhOhVds4WJaXVYZTT?= =?us-ascii?Q?GDgn8a8TyyEaKRDOKEAXG+4qtPNBsDDDJ0MJCV9GbU+9ogn/YgjtmISsE58g?= =?us-ascii?Q?KVONCmHVsaX1AzsLtZd516YdtXLVE08Wvo3CICyN3fU98cA6Y6Olf7k0YnBg?= =?us-ascii?Q?D6aQgHgZFsaqcuhKxkkhaMnzjvuKxQaYtYpXvcB/mod5WK3q89zpfjl7r1C/?= =?us-ascii?Q?0GLkGd+kjLqBBnIJU/LjJKydlUvQyi432I9JqdmWkyW7zlXZLt+I2iJD1vxG?= =?us-ascii?Q?Uw0PQDDWWC7ltleU5gZTsqVQ0un5j6wXPL/mOhWO7DsXoO4p9SHVDYV0v49Q?= =?us-ascii?Q?Px0V3x9ELsWVwqPEBfHAO1tkL9FvaOSzXzxSCDtYC9dlN3Q9csO7psIHa4JF?= =?us-ascii?Q?UPzE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OSnbJruYPOJsxWF4?= =?us-ascii?Q?QINYeMexOk1dynfzOqwPf3pZg60nVFObdHDcrCfm1F4k9HKi+/jK58Omt05Z?= =?us-ascii?Q?1OnW5qE3R8250ocxE0YTnjoW3UrpvsqJDkWc7fc9hwg2N3QKJ1PVQoxdzIOw?= =?us-ascii?Q?7fx896/4cVhXYXKeN9o/DlUd9Y5/skX4vcKTb8QzdVWb1VIMbYbx4MU4K/Kw?= =?us-ascii?Q?L0BFaXFRmvMhaSEQFRYMbyrJwnhCDC2BZaln3PKIHKZ4+QuPZafl0eLfMVF/?= =?us-ascii?Q?jinvn/p4+bZUfTb0M7Y=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: bp.renesas.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: OS0PR01MB5922.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a9566ceb-51b1-4ddb-6647-08dbb9de2989 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Sep 2023 13:33:23.3259 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 1PB+tn1dhlm/S3veRBCzY5bOYSM0WME96/2YG5iPlfIFNDdDwU9lkeMjN7Qqcf0yQ9/5MjSkklK+J6N9wWbzvJvmyAnG4Fil7Rfi+RKOBt0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYWPR01MB10115 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 20 Sep 2023 06:33:37 -0700 (PDT) > Subject: RE: [PATCH] alarmtimer: Fix rebind failure >=20 > Hi Alexandre Belloni, >=20 > > Subject: Re: [PATCH] alarmtimer: Fix rebind failure > > > > On 20/09/2023 12:59:35+0100, Biju Das wrote: > > > The resources allocated in alarmtimer_rtc_add_device() are not freed > > > leading to re-bind failure for the endpoint driver. Fix this issue > > > by adding alarmtimer_rtc_remove_device(). > > > > > > Signed-off-by: Biju Das > > > --- > > > This issue is found while adding irq support for built in RTC found > > > on Renesas PMIC RAA215300 device. This issue should present on all > > > RTC drivers which calls device_init_wakeup() in probe(). > > > --- > > > kernel/time/alarmtimer.c | 20 ++++++++++++++++++++ > > > 1 file changed, 20 insertions(+) > > > > > > diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c > > > index > > > 8d9f13d847f0..592668136bb5 100644 > > > --- a/kernel/time/alarmtimer.c > > > +++ b/kernel/time/alarmtimer.c > > > @@ -61,6 +61,7 @@ static DEFINE_SPINLOCK(freezer_delta_lock); > > > /* rtc timer and device for setting alarm wakeups at suspend */ > > > static struct rtc_timer rtctimer; > > > static struct rtc_device *rtcdev; > > > +static struct platform_device *rtc_pdev; > > > > This is the alarmtimer pdev, not the RTC one, right? >=20 > Yes, it is alarmtimer pdev. OK, I will change it to alarmtimer_pdev to avoid confusion. Cheers, Biju >=20 > > > > > static DEFINE_SPINLOCK(rtcdev_lock); > > > > > > /** > > > @@ -109,6 +110,7 @@ static int alarmtimer_rtc_add_device(struct > > > device > > *dev) > > > } > > > > > > rtcdev =3D rtc; > > > + rtc_pdev =3D pdev; > > > /* hold a reference so it doesn't go away */ > > > get_device(dev); > > > pdev =3D NULL; > > > @@ -123,6 +125,23 @@ static int alarmtimer_rtc_add_device(struct > > > device > > *dev) > > > return ret; > > > } > > > > > > +static void alarmtimer_rtc_remove_device(struct device *dev) { > > > + struct rtc_device *rtc =3D to_rtc_device(dev); > > > + > > > + if (rtc_pdev) { > > > + module_put(rtc->owner); > > > + if (device_may_wakeup(rtc->dev.parent)) > > > + device_init_wakeup(&rtc_pdev->dev, false); > > > + > > > + platform_device_unregister(rtc_pdev); > > > + put_device(dev); > > > + } > > > + > > > + rtcdev =3D NULL; > > > + rtc_pdev =3D NULL; > > > +} > > > + > > > static inline void alarmtimer_rtc_timer_init(void) { > > > rtc_timer_init(&rtctimer, NULL, NULL); @@ -130,6 +149,7 @@ static > > > inline void alarmtimer_rtc_timer_init(void) > > > > > > static struct class_interface alarmtimer_rtc_interface =3D { > > > .add_dev =3D &alarmtimer_rtc_add_device, > > > + .remove_dev =3D &alarmtimer_rtc_remove_device, > > > }; > > > > > > static int alarmtimer_rtc_interface_setup(void) > > > -- > > > 2.25.1 > > > > > > > -- > >