From patchwork Sat Jul 30 12:50:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12932983 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 3A562C04A68 for ; Sat, 30 Jul 2022 12:50:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232643AbiG3Mu2 (ORCPT ); Sat, 30 Jul 2022 08:50:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230135AbiG3Mu2 (ORCPT ); Sat, 30 Jul 2022 08:50:28 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6994C10FD4; Sat, 30 Jul 2022 05:50:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659185427; x=1690721427; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=9N+Y0hwSBNvilXODigvbdDCkEB5+1QfNgg0yfN9wBLo=; b=hbNtEFeGlESUVRVUX7lc5Pvpbk1TjUIg4UIwE61W7NJChhC+W4y7DhqM qj84mWs/JfdFksbojjc+8Ma/gBrTOdeuNAFwsbv3y5gkZVzuVndxUx/jS P+g6mS3YMhU9z1ShRnseogiqpMOoHyGkyjFL5YYQE2gl29cnqVGjFgmB7 P+rXEEU70XkkNi1Dj1C6A8O3G5dc7p8ZgnuxSJ07mkmG0T53cXgoXEafg kVyYDG1mNrNNZ0Z4dxqwgPwElMbBpRY25P/TKf3SJbN0m4DhgqAxyZj9E OX9BuwJp97FuvEey/n9RjcBvlkP1bIlEoGQ9WQIbzdhn4DG6mVTX6/FaJ A==; X-IronPort-AV: E=McAfee;i="6400,9594,10423"; a="287671346" X-IronPort-AV: E=Sophos;i="5.93,204,1654585200"; d="scan'208";a="287671346" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2022 05:50:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,204,1654585200"; d="scan'208";a="552016971" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 30 Jul 2022 05:50:25 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 7138FF1; Sat, 30 Jul 2022 15:50:35 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jean Delvare , Guenter Roeck Subject: [PATCH v1 1/1] hwmon: (iio_hwmon) Make use of device properties Date: Sat, 30 Jul 2022 15:50:24 +0300 Message-Id: <20220730125024.87764-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Convert the module to be property provider agnostic and allow it to be used on non-OF platforms. Add mod_devicetable.h include. Signed-off-by: Andy Shevchenko --- drivers/hwmon/iio_hwmon.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon/iio_hwmon.c b/drivers/hwmon/iio_hwmon.c index 580a7d125b88..3aa40893fc09 100644 --- a/drivers/hwmon/iio_hwmon.c +++ b/drivers/hwmon/iio_hwmon.c @@ -6,11 +6,13 @@ #include #include +#include #include #include #include +#include + #include -#include #include #include #include @@ -149,8 +151,8 @@ static int iio_hwmon_probe(struct platform_device *pdev) st->attr_group.attrs = st->attrs; st->groups[0] = &st->attr_group; - if (dev->of_node) { - sname = devm_kasprintf(dev, GFP_KERNEL, "%pOFn", dev->of_node); + if (dev_fwnode(dev)) { + sname = devm_kasprintf(dev, GFP_KERNEL, "%pfwP", dev_fwnode(dev)); if (!sname) return -ENOMEM; strreplace(sname, '-', '_');