Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3152525pxv; Mon, 12 Jul 2021 10:29:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpVEXhMKqQqnlKD/WWDVTcMUvLvT/D7eZ0UexuCEYj6c5DW7tMB1qPbCWiZ6+KUvQ8poa+ X-Received: by 2002:a17:906:3919:: with SMTP id f25mr227563eje.190.1626110999467; Mon, 12 Jul 2021 10:29:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626110999; cv=none; d=google.com; s=arc-20160816; b=gDL3Zpf2gWZcQxH0bcfjBi1a4MvpzGZxgQqpwa5OOU2EeQyEgujMJgN6zQxNUmeJ+a VZzmgWgqvryLuHU7tGhiXzaC+1UcfRsq2Uj6aKYcys04+KTeD16dU3VtSKu+LRpqR2Oj JhYZOdCWAIZvBda18Jef3D5raxz0cCfI0whlHBexzq4EdtnLznklVBc2ZPUbp5x1wNxV SHcKBOj3FGKnqbBDWvIiJj8JtpjSLM5DjB7pXrcV0CWCloagWOIyY/9ffm0v4gbgbsmP Z//gdgvKn48lTSYK+SNlMpePdYLFWPBvuWD3EQJX3Gko0tL8SKL4DaP2wwzToU9o04Gp YTlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Ge8FounB0ry6ebP98US+IWEzMuKjaxVXNYOZUMo7sns=; b=AMLRXQ8yAq4Gw1minFmrYx20AcHVnlBUsuMunPdd/hVGdZz8MhXaSGp+N5zKF4gc8+ gK68S+6JxG79MCjnQ8joZmCEYp6uO4Y9ShhzJot2iocej8CA081hk6mplZZx5m+uz+Aj pf1bChWI1439QNL9YcQsySumFWkK9PsMj8X6aHn0I974FfoYryFB1XXPOCTQ0hIhOe9E HA66Vh2FxJnc2q0Swr9O+QXskPXHYIPlmLtwmG+JbqnEO7awQbxyQUYjcQRQY/MLvfFb X0kfwwjErk9RcATYJOI2H/4xxHkd3c7zItJ2ATw74vweSXMzGGq8+FzQbFGu2nDerowK 7ARA== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o2si18994208ejy.80.2021.07.12.10.29.34; Mon, 12 Jul 2021 10:29:59 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235599AbhGLRbZ (ORCPT + 99 others); Mon, 12 Jul 2021 13:31:25 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:61526 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234742AbhGLRbY (ORCPT ); Mon, 12 Jul 2021 13:31:24 -0400 Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 2.1.0) id e09e8c5f6ca796ac; Mon, 12 Jul 2021 19:28:35 +0200 Received: from kreacher.localnet (89-64-82-45.dynamic.chello.pl [89.64.82.45]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id 2E631669C37; Mon, 12 Jul 2021 19:28:34 +0200 (CEST) From: "Rafael J. Wysocki" To: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" , Andy Shevchenko , Linux ACPI , LKML , "Krogerus, Heikki" Subject: [PATCH v1 6/6] driver core: Split device_platform_notify() Date: Mon, 12 Jul 2021 19:28:16 +0200 Message-ID: <7971483.NyiUUSuA9g@kreacher> In-Reply-To: <2780027.e9J7NaK4W3@kreacher> References: <2780027.e9J7NaK4W3@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 89.64.82.45 X-CLIENT-HOSTNAME: 89-64-82-45.dynamic.chello.pl X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvtddruddvgdduudduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvjeelgffhiedukedtleekkedvudfggefhgfegjefgueekjeelvefggfdvledutdenucfkphepkeelrdeigedrkedvrdegheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeekledrieegrdekvddrgeehpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhrtghpthhtohepghhrvghgkhhhsehlihhnuhigfhhouhhnuggrthhiohhnrdhorhhgpdhrtghpthhtoheprhgrfhgrvghlsehkvghrnhgvlhdrohhrghdprhgtphhtthhopegrnhgurhhihidrshhhvghvtghhvghnkhhosehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehv ghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohephhgvihhkkhhirdhkrhhoghgvrhhusheslhhinhhugidrihhnthgvlhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki Split device_platform_notify_remove) out of device_platform_notify() and call the latter on device addition and the former on device removal. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/base/core.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) Index: linux-pm/drivers/base/core.c =================================================================== --- linux-pm.orig/drivers/base/core.c +++ linux-pm/drivers/base/core.c @@ -2000,24 +2000,24 @@ static inline int device_is_not_partitio } #endif -static int -device_platform_notify(struct device *dev, enum kobject_action action) +static void device_platform_notify(struct device *dev) { - if (action == KOBJ_ADD) - acpi_device_notify(dev); - else if (action == KOBJ_REMOVE) - acpi_device_notify_remove(dev); - - if (action == KOBJ_ADD) - software_node_notify(dev); - else if (action == KOBJ_REMOVE) - software_node_notify_remove(dev); + acpi_device_notify(dev); - if (platform_notify && action == KOBJ_ADD) + software_node_notify(dev); + + if (platform_notify) platform_notify(dev); - else if (platform_notify_remove && action == KOBJ_REMOVE) +} + +static void device_platform_notify_remove(struct device *dev) +{ + acpi_device_notify_remove(dev); + + software_node_notify_remove(dev); + + if (platform_notify_remove) platform_notify_remove(dev); - return 0; } /** @@ -3289,9 +3289,7 @@ int device_add(struct device *dev) } /* notify platform of device entry */ - error = device_platform_notify(dev, KOBJ_ADD); - if (error) - goto platform_error; + device_platform_notify(dev); error = device_create_file(dev, &dev_attr_uevent); if (error) @@ -3394,8 +3392,7 @@ done: SymlinkError: device_remove_file(dev, &dev_attr_uevent); attrError: - device_platform_notify(dev, KOBJ_REMOVE); -platform_error: + device_platform_notify_remove(dev); kobject_uevent(&dev->kobj, KOBJ_REMOVE); glue_dir = get_glue_dir(dev); kobject_del(&dev->kobj); @@ -3540,7 +3537,7 @@ void device_del(struct device *dev) bus_remove_device(dev); device_pm_remove(dev); driver_deferred_probe_del(dev); - device_platform_notify(dev, KOBJ_REMOVE); + device_platform_notify_remove(dev); device_remove_properties(dev); device_links_purge(dev);