Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp296033pxb; Mon, 7 Feb 2022 11:31:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJxAuBzp6BexrWajxaMQYSPfSgnLahNOMFw7Gvu3+/NIMeOa9m928dNi0WUBqRnzgzoqbNWp X-Received: by 2002:a17:907:90c8:: with SMTP id gk8mr984066ejb.630.1644262313891; Mon, 07 Feb 2022 11:31:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644262313; cv=none; d=google.com; s=arc-20160816; b=qqwdfrZZ3hcNTKMaVxVW36UEuebssXIrdDXvVKLsObiUPQOpa2c7/ndIZF9YX4NLNh 2MfurCpfZOCzepZ6AeN1mk9rbKqrr1exlrzQ+g5Tk377XdGs7nJG5MA6J0TOX6+Mu3Iy 5fnZjFrZ1ie10FCMhsHTgA+SyV96EKaFLyLwT3is7Ia+e7uJC0hOS/oqs+hG7ibf5QBQ eGvWWkxqfIACrfbmXbiI+Q/hdfieIDXCYAJUm498GsIXgS5RbYawOXEKeVtYMdLOVij9 5P+4nyK/yqGu3X0CR+8u9w8K3jux2NFAHnkeyCtJHagtOclp9Bs2J7/ZIsV91qmdMyYu aIkw== 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 :message-id:date:subject:cc:to:from; bh=RmZsCyun88AG6+fVOsN5W+SX+EOPvAmu0TiZ447c1UM=; b=ETiKPj9CaqwaP3wseakO/K7fO0SmQkO53cOdym1qQtcUWuyxZYZZVoI+LzH4pm4iyc jNX1UUzdEipvUjw4HOYk8jrwRbjciWkgNkTqnkOFPOXofrMLbuwStEhSWHuqNpgi0ggG g68EI5+SoMan3gV8MyOM/JWXzKCU/vy6HQnj1BrzcsNCbT/otJ7HrpLnGyD6CiXITl1D 6P0EZ/QfJan9s5Y2drGxaEq6bx7OvSFMCc5OtTsMppzUvw/8AHa8yyycjhbVIaU8vZIO LQExwy03dkOyLF8UKfso4CWU3OTvmyRYTNK78KSIzuv0r48EwHEETuWE2/JrZNjeQCWD YDjQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb9si8538953ejc.38.2022.02.07.11.31.29; Mon, 07 Feb 2022 11:31:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234393AbiBAT6k (ORCPT + 99 others); Tue, 1 Feb 2022 14:58:40 -0500 Received: from cloudserver094114.home.pl ([79.96.170.134]:44428 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231815AbiBAT6j (ORCPT ); Tue, 1 Feb 2022 14:58:39 -0500 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 4.0.0) id 48eb9971b89e43b8; Tue, 1 Feb 2022 20:58:38 +0100 Received: from kreacher.localnet (unknown [213.134.162.64]) (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 0DC1266B390; Tue, 1 Feb 2022 20:58:37 +0100 (CET) From: "Rafael J. Wysocki" To: netdev@vger.kernel.org Cc: Sunil Goutham , Iyappan Subramanian , Andrew Lunn , "David S. Miller" , Jakub Kicinski , Keyur Chudgar , Quan Nguyen , Heiner Kallweit , LKML , Linux ACPI Subject: [PATCH v2] drivers: net: Replace acpi_bus_get_device() Date: Tue, 01 Feb 2022 20:58:36 +0100 Message-ID: <11918902.O9o76ZdvQC@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.162.64 X-CLIENT-HOSTNAME: 213.134.162.64 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvvddrgeefgddufeduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpefhgedtffejheekgeeljeevvedtuefgffeiieejuddutdekgfejvdehueejjeetvdenucfkphepvddufedrudefgedrudeivddrieegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvddufedrudefgedrudeivddrieegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeduuddprhgtphhtthhopehnvghtuggvvhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehsghhouhhthhgrmhesmhgrrhhvvghllhdrtghomhdprhgtphhtthhopehihigrphhprghnsehoshdrrghmphgvrhgvtghomhhpuhhtihhnghdrtghomhdprhgtphhtthhopegrnhgurhgvfieslhhunhhnrdgthhdprhgtphhtthhopegurghvvghmsegurghvvghmlhho fhhtrdhnvghtpdhrtghpthhtohepkhhusggrsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehkvgihuhhrsehoshdrrghmphgvrhgvtghomhhpuhhtihhnghdrtghomhdprhgtphhtthhopehquhgrnhesohhsrdgrmhhpvghrvggtohhmphhuthhinhhgrdgtohhmpdhrtghpthhtohephhhkrghllhifvghithdusehgmhgrihhlrdgtohhmpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhg X-DCC--Metrics: v370.home.net.pl 1024; Body=11 Fuz1=11 Fuz2=11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki Subject: [PATCH] drivers: net: Replace acpi_bus_get_device() Replace acpi_bus_get_device() that is going to be dropped with acpi_fetch_acpi_dev(). While at it, rearrange the local variable definitions in bgx_acpi_register_phy() and mdio-xgene.c:acpi_register_phy() so as to put them in the reverse xmas tree order. No intentional functional impact. Reviewed-by: Andrew Lunn Signed-off-by: Rafael J. Wysocki --- -> v2: Put local variable definitions in two functions the reverse xmas tree order (Andrew Lunn). --- drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 6 +++--- drivers/net/fjes/fjes_main.c | 10 +++------- drivers/net/mdio/mdio-xgene.c | 10 ++++------ 3 files changed, 10 insertions(+), 16 deletions(-) Index: linux-pm/drivers/net/ethernet/cavium/thunder/thunder_bgx.c =================================================================== --- linux-pm.orig/drivers/net/ethernet/cavium/thunder/thunder_bgx.c +++ linux-pm/drivers/net/ethernet/cavium/thunder/thunder_bgx.c @@ -1405,11 +1405,11 @@ static int acpi_get_mac_address(struct d static acpi_status bgx_acpi_register_phy(acpi_handle handle, u32 lvl, void *context, void **rv) { - struct bgx *bgx = context; + struct acpi_device *adev = acpi_fetch_acpi_dev(handle); struct device *dev = &bgx->pdev->dev; - struct acpi_device *adev; + struct bgx *bgx = context; - if (acpi_bus_get_device(handle, &adev)) + if (!adev) goto out; acpi_get_mac_address(dev, adev, bgx->lmac[bgx->acpi_lmac_idx].mac); Index: linux-pm/drivers/net/fjes/fjes_main.c =================================================================== --- linux-pm.orig/drivers/net/fjes/fjes_main.c +++ linux-pm/drivers/net/fjes/fjes_main.c @@ -1512,15 +1512,11 @@ static acpi_status acpi_find_extended_socket_device(acpi_handle obj_handle, u32 level, void *context, void **return_value) { - struct acpi_device *device; + struct acpi_device *device = acpi_fetch_acpi_dev(obj_handle); bool *found = context; - int result; - result = acpi_bus_get_device(obj_handle, &device); - if (result) - return AE_OK; - - if (strcmp(acpi_device_hid(device), ACPI_MOTHERBOARD_RESOURCE_HID)) + if (!device || + strcmp(acpi_device_hid(device), ACPI_MOTHERBOARD_RESOURCE_HID)) return AE_OK; if (!is_extended_socket_device(device)) Index: linux-pm/drivers/net/mdio/mdio-xgene.c =================================================================== --- linux-pm.orig/drivers/net/mdio/mdio-xgene.c +++ linux-pm/drivers/net/mdio/mdio-xgene.c @@ -279,16 +279,14 @@ EXPORT_SYMBOL(xgene_enet_phy_register); static acpi_status acpi_register_phy(acpi_handle handle, u32 lvl, void *context, void **ret) { + struct acpi_device *adev = acpi_fetch_acpi_dev(handle); struct mii_bus *mdio = context; - struct acpi_device *adev; - struct phy_device *phy_dev; const union acpi_object *obj; + struct phy_device *phy_dev; u32 phy_addr; - if (acpi_bus_get_device(handle, &adev)) - return AE_OK; - - if (acpi_dev_get_property(adev, "phy-channel", ACPI_TYPE_INTEGER, &obj)) + if (!adev || + acpi_dev_get_property(adev, "phy-channel", ACPI_TYPE_INTEGER, &obj)) return AE_OK; phy_addr = obj->integer.value;