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 D90B7C07E9D for ; Sat, 24 Sep 2022 03:54:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233235AbiIXDyv (ORCPT ); Fri, 23 Sep 2022 23:54:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231864AbiIXDyt (ORCPT ); Fri, 23 Sep 2022 23:54:49 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DD8219C2B for ; Fri, 23 Sep 2022 20:54:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663991689; x=1695527689; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=MLejNRe6zMqpKGJ1HjzGL/nNtl3nyWQq/JpH4j73Ht0=; b=XHuy999yjbakUh9558ZEO3EhAOruapzP4VIqRAjREUkXjhFPFfQDso7u rc7fcgsEqxKO062qNFMh4DbQynaiA0HNZC2zrQRCHj/vsNxFPyrKbSArW MuwUOUaPywiqtC1ORsT8raE4ema9oybUqddYejwRVaRrUvBMKKT4UswDD XNFbn3fbhO02CgvPKQC+TQFsIrEO8x5LYibDPbq3vgCP5Udg1iLyhaxYG wY4fmku/Fw9FGkiBn7PBt+9HF1Nzz65xb/Pe8dYKoWFJ+WN2NaE8ebUKP VLdYfKEVE6WTbDg/apQgAHsyRDrzfXBh+F+GfVxVYBQbNTPaVnZoYnRj8 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10479"; a="299463791" X-IronPort-AV: E=Sophos;i="5.93,341,1654585200"; d="scan'208";a="299463791" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2022 20:54:48 -0700 X-IronPort-AV: E=Sophos;i="5.93,341,1654585200"; d="scan'208";a="688955996" Received: from adixit-mobl.amr.corp.intel.com (HELO adixit-arch.intel.com) ([10.252.138.221]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2022 20:54:48 -0700 Date: Fri, 23 Sep 2022 20:54:47 -0700 Message-ID: <87r1018m0o.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Badal Nilawar Cc: , , , , , , , Subject: Re: [PATCH 1/7] drm/i915/hwmon: Add HWMON infrastructure In-Reply-To: <20220923195643.2376927-2-badal.nilawar@intel.com> References: <20220923195643.2376927-1-badal.nilawar@intel.com> <20220923195643.2376927-2-badal.nilawar@intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org On Fri, 23 Sep 2022 12:56:37 -0700, Badal Nilawar wrote: > Hi Badal, Let me add this comment on the latest version so we don't forget about it: > +void i915_hwmon_register(struct drm_i915_private *i915) > +{ > + struct device *dev = i915->drm.dev; > + struct i915_hwmon *hwmon; > + struct device *hwmon_dev; > + struct hwm_drvdata *ddat; > + > + /* hwmon is available only for dGfx */ > + if (!IS_DGFX(i915)) > + return; > + > + hwmon = devm_kzalloc(dev, sizeof(*hwmon), GFP_KERNEL); If we are using devm_kzalloc we might as well replace all the hwmon_device_register_with_info's (in Patch 1 and 7) with devm_hwmon_device_register_with_info and then i915_hwmon_unregister is just this: void i915_hwmon_unregister(struct drm_i915_private *i915) { fetch_and_zero(&i915->hwmon); } Even the above statement is probably not needed but might as well retain it for sanity. So this is a simple change. Thanks. -- Ashutosh