From patchwork Tue Aug 30 17:11:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 601102 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 04F06ECAAD1 for ; Tue, 30 Aug 2022 17:11:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229896AbiH3RLr (ORCPT ); Tue, 30 Aug 2022 13:11:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229797AbiH3RLp (ORCPT ); Tue, 30 Aug 2022 13:11:45 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13326B942D; Tue, 30 Aug 2022 10:11:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661879505; x=1693415505; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=TsbH8WfVIPK7o9v1IjER2iQuy7ebiON15BiW0wAGgc0=; b=LwlC0c0kzRovhdU7CgL7rRkdvI8RhhD/6Ig8h+Z5BOwjpoE+iMa9n6NE 0u3kuZdxPISeruq1e46fbjbGwUJsn7fFbpvbdiS76ByRQ6mf8D3bCw1sI mawJuL4gbyxlaleqakfaxA9DE4zRGQxIchqUS+154rnjSoaCbFr2bqtA8 z6dfJJ3kHrrZE/c/GK7uG4RMSMPo7XlzGkNUTqdbJvPZX4wo9bzbvr/Ab L/kYX5/+JhpnPgZWBgaq//9wi2OcFATTARfx/TXJeJGS5w7NLIn267/88 9TOIykWOXm4eayMkqxcNzGWVYBn89SkdqtewesQL/y/I+EIQcu7UhUpqv Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10455"; a="296031024" X-IronPort-AV: E=Sophos;i="5.93,275,1654585200"; d="scan'208";a="296031024" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2022 10:11:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,275,1654585200"; d="scan'208";a="562734132" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 30 Aug 2022 10:11:42 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 8338AAD; Tue, 30 Aug 2022 20:11:56 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Hans de Goede , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Len Brown , Andy Shevchenko , Mika Westerberg Subject: [PATCH v2 1/3] ACPI: PMIC: Use sizeof() instead of hard coded value Date: Tue, 30 Aug 2022 20:11:53 +0300 Message-Id: <20220830171155.42962-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-acpi@vger.kernel.org It's better to use sizeof() of a given buffer than spreading a hard coded value. Signed-off-by: Andy Shevchenko Reviewed-by: Mika Westerberg --- v2: updated another driver as well (due to this no tag added) drivers/acpi/pmic/intel_pmic_chtdc_ti.c | 2 +- drivers/acpi/pmic/intel_pmic_xpower.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/pmic/intel_pmic_chtdc_ti.c b/drivers/acpi/pmic/intel_pmic_chtdc_ti.c index 418eec523025..6c2a6da430ed 100644 --- a/drivers/acpi/pmic/intel_pmic_chtdc_ti.c +++ b/drivers/acpi/pmic/intel_pmic_chtdc_ti.c @@ -87,7 +87,7 @@ static int chtdc_ti_pmic_get_raw_temp(struct regmap *regmap, int reg) { u8 buf[2]; - if (regmap_bulk_read(regmap, reg, buf, 2)) + if (regmap_bulk_read(regmap, reg, buf, sizeof(buf))) return -EIO; /* stored in big-endian */ diff --git a/drivers/acpi/pmic/intel_pmic_xpower.c b/drivers/acpi/pmic/intel_pmic_xpower.c index 61bbe4c24d87..33c5e85294cd 100644 --- a/drivers/acpi/pmic/intel_pmic_xpower.c +++ b/drivers/acpi/pmic/intel_pmic_xpower.c @@ -255,7 +255,7 @@ static int intel_xpower_pmic_get_raw_temp(struct regmap *regmap, int reg) if (ret) return ret; - ret = regmap_bulk_read(regmap, AXP288_GP_ADC_H, buf, 2); + ret = regmap_bulk_read(regmap, AXP288_GP_ADC_H, buf, sizeof(buf)); if (ret == 0) ret = (buf[0] << 4) + ((buf[1] >> 4) & 0x0f); From patchwork Tue Aug 30 17:11:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 601101 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 994C3ECAAD8 for ; Tue, 30 Aug 2022 17:11:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229886AbiH3RLs (ORCPT ); Tue, 30 Aug 2022 13:11:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229594AbiH3RLp (ORCPT ); Tue, 30 Aug 2022 13:11:45 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68C91B6D70; Tue, 30 Aug 2022 10:11:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661879504; x=1693415504; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=p1rw2lqi1y8+LrcoY7xgsSlWXDb8A7zXJQ7t10y/Dd0=; b=UUWbJWUtXdoM9cndyzJKwf9FxkSmyxmIehNBF/mrMxB17YJ7y+6ZMCR1 363ZtQhMN0+FSe3i+hUhIg1mCc8P5G1lkRNC6KBJaSplR2S84ksZLQrbW 3Qhi2DAnDF+BY2GEgrQdiwsdtIOGqq1WdpRM74SEmzLryyRO3XP+VYnRW EYomAPaRbk+P9F9p8B371M8cvk3ExiN14mcJ+tQ9I6Vky6fDoYsgw0i+K 3ID4Ig4cy40i+ksDEv+sJVxYpKlMcnQWvI2eOjngDtAW2jKOaG/650rSZ aOjEAV0258H8BbuIlAkzoUwcsT2A30P9Ayf4aBkYDwDufCoTZ6z8YtuL7 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10455"; a="293989285" X-IronPort-AV: E=Sophos;i="5.93,275,1654585200"; d="scan'208";a="293989285" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2022 10:11:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,275,1654585200"; d="scan'208";a="715389266" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga002.fm.intel.com with ESMTP; 30 Aug 2022 10:11:41 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id A01AF19D; Tue, 30 Aug 2022 20:11:56 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Hans de Goede , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Len Brown , Andy Shevchenko , Mika Westerberg Subject: [PATCH v2 3/3] ACPI: PMIC: Convert pr_*() to dev_*() printing macros Date: Tue, 30 Aug 2022 20:11:55 +0300 Message-Id: <20220830171155.42962-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220830171155.42962-1-andriy.shevchenko@linux.intel.com> References: <20220830171155.42962-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Since we have a device pointer in the regmap, use it for error messages. Signed-off-by: Andy Shevchenko --- v2: new patch drivers/acpi/pmic/intel_pmic_chtwc.c | 5 +++-- drivers/acpi/pmic/intel_pmic_xpower.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/pmic/intel_pmic_chtwc.c b/drivers/acpi/pmic/intel_pmic_chtwc.c index f2c42f4c79ca..25aa3e33b09a 100644 --- a/drivers/acpi/pmic/intel_pmic_chtwc.c +++ b/drivers/acpi/pmic/intel_pmic_chtwc.c @@ -236,11 +236,12 @@ static int intel_cht_wc_exec_mipi_pmic_seq_element(struct regmap *regmap, u32 reg_address, u32 value, u32 mask) { + struct device *dev = regmap_get_device(regmap); u32 address; if (i2c_client_address > 0xff || reg_address > 0xff) { - pr_warn("%s warning addresses too big client 0x%x reg 0x%x\n", - __func__, i2c_client_address, reg_address); + dev_warn(dev, "warning addresses too big client 0x%x reg 0x%x\n", + i2c_client_address, reg_address); return -ERANGE; } diff --git a/drivers/acpi/pmic/intel_pmic_xpower.c b/drivers/acpi/pmic/intel_pmic_xpower.c index 3c7380ec8203..a6dc8dd0d191 100644 --- a/drivers/acpi/pmic/intel_pmic_xpower.c +++ b/drivers/acpi/pmic/intel_pmic_xpower.c @@ -278,11 +278,12 @@ static int intel_xpower_exec_mipi_pmic_seq_element(struct regmap *regmap, u16 i2c_address, u32 reg_address, u32 value, u32 mask) { + struct device *dev = regmap_get_device(regmap); int ret; if (i2c_address != 0x34) { - pr_err("%s: Unexpected i2c-addr: 0x%02x (reg-addr 0x%x value 0x%x mask 0x%x)\n", - __func__, i2c_address, reg_address, value, mask); + dev_err(dev, "Unexpected i2c-addr: 0x%02x (reg-addr 0x%x value 0x%x mask 0x%x)\n", + i2c_address, reg_address, value, mask); return -ENXIO; }