From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE768D18138 for ; Mon, 14 Oct 2024 18:06:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 73DA26B0088; Mon, 14 Oct 2024 14:06:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6C6AF6B008A; Mon, 14 Oct 2024 14:06:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 58DB56B008C; Mon, 14 Oct 2024 14:06:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 3942C6B0088 for ; Mon, 14 Oct 2024 14:06:57 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B09D11411A0 for ; Mon, 14 Oct 2024 18:06:48 +0000 (UTC) X-FDA: 82672988790.29.553078E Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf30.hostedemail.com (Postfix) with ESMTP id D17548001F for ; Mon, 14 Oct 2024 18:06:42 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=aqw2IT6y; spf=pass (imf30.hostedemail.com: domain of rafael@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=rafael@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728929142; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=YlPvkE8jKR8r+LcjALAY7GpqyuO11i29YLWTAhq+Jmc=; b=Km/i64FpJ4YkWtYD3E4Y30QqlY0ZgoxTO8yT5r/jHg3f/YRv41pU5BRCh6XSxRs+QBY0/1 TkkAeJNTJQvUG8UjVnn38TtVl758R9CNF3QNkNJiK9FKGTMP0gRzl3N4zccHGwjLZg+Eok ioi4gaOyUunTLZgj7EsJp8VY1pMQkkw= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=aqw2IT6y; spf=pass (imf30.hostedemail.com: domain of rafael@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=rafael@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728929142; a=rsa-sha256; cv=none; b=EqHpkbMgOF5NpTfPxbyBpDXqgDKbzo9udgiCybnGBNaiGvgM+Y2ob9zhes5Dryq3mKfB1v /xjIlHWik3/rMWVuACBGuBchpJlv92nKMdl9Tgi5OvLMFX/a4dHasZRIY7Kmg8LIXk2+oc Y2SHJULv9OrO1bo5UHbR7k8MdygS3e0= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 2C3EFA426A8 for ; Mon, 14 Oct 2024 18:06:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 593D2C4CED5 for ; Mon, 14 Oct 2024 18:06:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728929213; bh=328xf27GjivinbPRZ7hRzDtoHLMfZyHs/8hq0LBb480=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=aqw2IT6yHheGJ7fz18ra7eVQ8O0cRQrNgKjHLslffeYq89nIvV9M3LebbF9D1CS2d jx20LqApzwQAW6UMnCDzs7DlBfRt97swT330IXPpysEkfm4jHGMUeI4YGdy6M9DC8s PxYmkDLKeTlNHjoI03bE+K50GV+GymRCcCSIECbFqaOVZ8R+2YcYGnxLF1F9BBZhF+ 15iRHHbPyf7ZWfaEudEpMGqNg4AlIHFkebvkpfpweU0FTO0SeZUQ8sC6OWIDRqj02I 0ckHCDU0GFVpgaWJeklXzl/+/iQVMLS0Z4uC+85oOQdmHd0eh2iwUYdiGlAX6zAv5O j5fkXaPR3O1gw== Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-2884e7fadb8so2345689fac.2 for ; Mon, 14 Oct 2024 11:06:53 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCWTKrg5BW/rvqyeKMLqmMEyQMSGjw64YKdyRjtQ/gdLVE64hRNtHh20xis5cD+8wRpC5dxBZtCNpA==@kvack.org X-Gm-Message-State: AOJu0Yy+K8mSBILV9xgOAleTlxRfGiYaQxkJ+X6L5veXjJMSsr7kRBeK /5BnkPpCydPfWwKLuVxvd4QBKCIdCgO38UH5nrq5lIWON0GD/G+l5JvPnqAP0uN+dFVSGiXu9kU Ykepy3hAb5VEJRdWuxsKPqDaegBM= X-Google-Smtp-Source: AGHT+IGQGwT6cXGmJK8qwoh50vsACcMeRbM+96UyfnnpM9FQSznkvhAcjB/uDWXvr+/SF+GzDS6sTWMArbOPvqmwa/o= X-Received: by 2002:a05:6871:299:b0:260:e3fa:ab8d with SMTP id 586e51a60fabf-28887477812mr5317452fac.37.1728929212580; Mon, 14 Oct 2024 11:06:52 -0700 (PDT) MIME-Version: 1.0 References: <20241009124120.1124-1-shiju.jose@huawei.com> <20241009124120.1124-13-shiju.jose@huawei.com> <20241014164339.00003e73@Huawei.com> <2024101410-turf-junior-7739@gregkh> <2024101451-reword-animation-2179@gregkh> <20241014181654.00005180@Huawei.com> In-Reply-To: <20241014181654.00005180@Huawei.com> From: "Rafael J. Wysocki" Date: Mon, 14 Oct 2024 20:06:40 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v13 12/18] platform: Add __free() based cleanup function for platform_device_put To: Jonathan Cameron Cc: Greg KH , shiju.jose@huawei.com, linux-edac@vger.kernel.org, linux-cxl@vger.kernel.org, linux-acpi@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, bp@alien8.de, tony.luck@intel.com, rafael@kernel.org, lenb@kernel.org, mchehab@kernel.org, dan.j.williams@intel.com, dave@stgolabs.net, dave.jiang@intel.com, alison.schofield@intel.com, vishal.l.verma@intel.com, ira.weiny@intel.com, david@redhat.com, Vilas.Sridharan@amd.com, leo.duran@amd.com, Yazen.Ghannam@amd.com, rientjes@google.com, jiaqiyan@google.com, Jon.Grimm@amd.com, dave.hansen@linux.intel.com, naoya.horiguchi@nec.com, james.morse@arm.com, jthoughton@google.com, somasundaram.a@hpe.com, erdemaktas@google.com, pgonda@google.com, duenwen@google.com, gthelen@google.com, wschwartz@amperecomputing.com, dferguson@amperecomputing.com, wbs@os.amperecomputing.com, nifan.cxl@gmail.com, tanxiaofei@huawei.com, prime.zeng@hisilicon.com, roberto.sassu@huawei.com, kangkang.shen@futurewei.com, wanghuiqiang@huawei.com, linuxarm@huawei.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: D17548001F X-Stat-Signature: ief4qi6tati9s7q7daeaft6mpj86m8nu X-HE-Tag: 1728929202-49744 X-HE-Meta: U2FsdGVkX19F5JtiUoXyOncv9P+8oZHtCl2zZzC+RMRtlcob46PA+QDdVDIsePtWmE6k95aZW5hyK0pTuxgD1RrOUFUGui/M6QjNMtkyegq+0lqwoqPUFKuV9hb8nlMFVFkn4fFhKNBUshFZ3RnnLWG2qatDAjXF7/4mqb5dfGL8bln3b+VVVZujVb3++17zgbSihrxCrxI2L24pZ8ovpNp38O01Vl9HlgmzNJuN0oZWHrwP+b0W4h3X1GQexn0AERjQ+eTYuhOg+P9ojEP8PqUoPTsSIs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3SP3nxFH2Rn+bsSzgk6r3Ml1s3Yh9Q3/mtJ1b67KVPAFj4PNyPTNoNiDQr/XJ9+4mwjfe5UV1+Kof0hj3tffcGAq3t/vsIxKzrO8Kjx3J88LVkhcQTlHVe+MdeWf81JO+bg2mfVMQCnt+9Z X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Mon, Oct 14, 2024 at 7:17=E2=80=AFPM Jonathan Cameron wrote: > > On Mon, 14 Oct 2024 18:04:37 +0200 > Greg KH wrote: > > > On Mon, Oct 14, 2024 at 06:00:51PM +0200, Greg KH wrote: > > > On Mon, Oct 14, 2024 at 04:43:39PM +0100, Jonathan Cameron wrote: > > > > On Wed, 9 Oct 2024 13:41:13 +0100 > > > > wrote: > > > > > > > > > From: Jonathan Cameron > > > > > > > > > > Add __free() based cleanup function for platform_device_put(). > > > > > > > > > > Signed-off-by: Jonathan Cameron > > > > > Signed-off-by: Shiju Jose > > > > > --- > > > > > include/linux/platform_device.h | 1 + > > > > > 1 file changed, 1 insertion(+) > > > > > > > > > > diff --git a/include/linux/platform_device.h b/include/linux/plat= form_device.h > > > > > index d422db6eec63..606533b88f44 100644 > > > > > --- a/include/linux/platform_device.h > > > > > +++ b/include/linux/platform_device.h > > > > > @@ -232,6 +232,7 @@ extern int platform_device_add_data(struct pl= atform_device *pdev, > > > > > extern int platform_device_add(struct platform_device *pdev); > > > > > extern void platform_device_del(struct platform_device *pdev); > > > > > extern void platform_device_put(struct platform_device *pdev); > > > > > +DEFINE_FREE(platform_device_put, struct platform_device *, if (_= T) platform_device_put(_T)) > > > > > > > > > > struct platform_driver { > > > > > int (*probe)(struct platform_device *); > > > > > > > > +CC Greg KH and Rafael. > > > > > > > > Makes sure to include them on v14 as this needs review from a drive= r core point > > > > of view I think. > > > > > > Why is this needed for a platform device? This feels like you will h= ave > > > to do more work to "keep" the reference on the normal path than you t= o > > > today to release the reference on the error path, right? Have a poin= ter > > > to a patch that uses this? > > > > Ah, is it this one: > > https://lore.kernel.org/all/20241014164955.00003439@Huawei.com/ > > ? > > > > If so, no, that's an abuse of a platform device, don't do that, make a > > REAL device on the bus that this device lives on. If it doesn't live o= n > > a real bus, then put it on the virtual bus but do NOT abuse the platfor= m > > device layer for something like this. > > Ok. Probably virtual bus it is then. Rafael, what do you think makes se= nse > for a 'feature' that is described only by an ACPI table (here RAS2)? > Kind of similar(ish) to say IORT. Good question. I guess it depends on whether or not there are any registers to access or AML to interact with. If so, I think that a platform device makes sense. > My thinking on a platform device was that this could be described > in DSDT and would have ended up as one. No idea why it isn't. > Maybe it predated the resource stuff that lets you use PCC channels > from methods under devices. Anyhow, it's not something I care about > so virtual bus is fine by me.