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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBA3DC433F5 for ; Fri, 13 May 2022 11:33:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379924AbiEMLdd (ORCPT ); Fri, 13 May 2022 07:33:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243824AbiEMLdc (ORCPT ); Fri, 13 May 2022 07:33:32 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13DC02B824D; Fri, 13 May 2022 04:33:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652441612; x=1683977612; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=3EBr+y79geP5CztvBOF3MttVzuiXbWczHFziVH9D/uU=; b=LD/Yq+BG1WPshxerKhLcS0pNRfOuX0Agtt4uUs3fU00u6SyX/GLG3JQ7 qO1KGAQiEMXMBylWZjblZvlxbTdZXCgFbHPkBANYQaiF/e5zXnxrjVnxi YcKL0Cwn3SyyxF0z3pAj9OMzcnDSe11UnJcsTHAfEouBOZjBqEhc9s8Nk eXI3VrZ7wEMNuEbzifhyHSWeU+syWq3/KKVmMHxmQHWpxm289GiCDFcs9 0TqvkPnLZv8xGhoHamRJiIkwTa+qmdu7ESrx8HA6W1Ne0ZdOzJsgBRTaV 1bD3hvlFtS6tJ8cWIEzLvVJ8JJDROj2HHZaXUVtvXGuO5qA31iDln4Ab9 A==; X-IronPort-AV: E=McAfee;i="6400,9594,10345"; a="267878197" X-IronPort-AV: E=Sophos;i="5.91,221,1647327600"; d="scan'208";a="267878197" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2022 04:33:31 -0700 X-IronPort-AV: E=Sophos;i="5.91,221,1647327600"; d="scan'208";a="595179512" Received: from ychen23-mobl.ccr.corp.intel.com ([10.249.171.202]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2022 04:33:29 -0700 Message-ID: Subject: Re: [PATCH v3 2/2] hwmon: acpi_power_meter: convert to hwmon_device_register_with_info From: Zhang Rui To: LABBE Corentin , Guenter Roeck Cc: jdelvare@suse.com, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 13 May 2022 19:33:27 +0800 In-Reply-To: References: <20220509063010.3878134-1-clabbe@baylibre.com> <20220509063010.3878134-3-clabbe@baylibre.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org On Fri, 2022-05-13 at 10:02 +0200, LABBE Corentin wrote: > Le Wed, May 11, 2022 at 07:10:29PM -0700, Guenter Roeck a écrit : > > Corentin, > > > > On 5/8/22 23:30, Corentin Labbe wrote: > > > Booting lead to a hwmon_device_register() is deprecated. Please > > > convert the driver to use hwmon_device_register_with_info(). > > > So let's convert the driver to use > > > hwmon_device_register_with_info(). > > > > > > Signed-off-by: Corentin Labbe > > > --- > > > > [ ... ] > > > > > @@ -836,20 +740,20 @@ static void acpi_power_meter_notify(struct > > > acpi_device *device, u32 event) > > > if (res) > > > break; > > > > > > - remove_attrs(resource); > > > + remove_domain_devices(resource); > > > setup_attrs(resource); > > > > Zhang Rui found an interesting problem with this code: > > It needs a call to sysfs_update_groups(hwmon_dev->groups) > > to update sysfs attribute visibility, probably between > > remove_domain_devices() and setup_attrs(). > > > > > break; > > > case METER_NOTIFY_TRIP: > > > - sysfs_notify(&device->dev.kobj, NULL, > > > POWER_AVERAGE_NAME); > > > + hwmon_notify_event(&device->dev, hwmon_power, > > > hwmon_power_average, 0); > > > > ... which makes realize: The notification device should be the > > hwmon device. > > That would be resource->hwmon_dev, not the acpi device. > > > > Hello > > I will fix this, but do you have an example how to test thoses code > path easily ? No, I don't have one. -rui