From patchwork Tue Jun 18 16:06:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Farouk Bouabid X-Patchwork-Id: 13702579 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6A680C41513 for ; Tue, 18 Jun 2024 16:11:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=1Zu6XY/Yn3b/7aAvIDNI5sdaPIJgUPqjEAa8hyv+j3c=; b=PoBNtA5kU25dlrxeANVGGz78aM mBDwXGZMBNgsb5cuIwnYWjmV/38eVSg/gitk/HTRvh+F1vX5xZNU98XzXyamIwkSHMu+8reMbIpKu anEHtHwUCeK+KkJoBHqkqI+vR9kpe0zHuOImaPNZ3jd10yYyauQmFJX00kb4CnwE9z3jnwu7Z29xH 8WIHG9d83nSfilVBYznlaYr3S/7uPQuAcM+Np5LSe2kjLoIyfcvB8tMX3xQ/kO7zdL+hFjFyEizPL 3OMG9fWnSoYhqECaAbp//yh7XTNwMFpon/7Pt/kuqPdZZviYM+reGD+V5ixneSyiUM7r9CkziZyLL FufRh8lw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJbQ9-0000000Fm0C-3pdJ; Tue, 18 Jun 2024 16:10:57 +0000 Received: from mail-am6eur05on20719.outbound.protection.outlook.com ([2a01:111:f403:2612::719] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJbPL-0000000FlMl-1oQW; Tue, 18 Jun 2024 16:10:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JjLSlvE1CSB6oF6LbzoXYnaL78ccbTir5K+iXJhqmMOEUVQ78O4P6F6Vfgcu01NowazbKF/cYrMd1LWr/Nf39jBl/VrRoHC/bOVS/txSw0fmrvULXNY2WHetGlKDnru2AKClpioCADY1jWCaiwrLEvnOzgvernrTxWDDorgHpicLzyjhLR6IGBVA/amhj8NHBoCpSvsIyBduqHduvHFutfO9l3Vnw+T5C7KbQJCP2HWAUqzrvLKnT4FVNV8IXmFl7ctLSIrEGfOLn0YaYVzab7+cSHjr/HfPZsn49NgLvO6mbZP0BTAu1lH/F0n532aivHVfrw2t0kpG+XGrG/kOHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JbH/oOXAHGDDIyZmStMPkQp0S13FGoi5kTrrdXpMzQc=; b=X73gm/q8tZKxt8JMGi56KOE9xYj6G86xmm/TjVnZZaXkNaCCnhT84Fl5M3eogW2Afq5q1niR9o7npfem3Ah/JWOMk40qPu6wbDNv1iP8oKqfp01XUEeyVJzi4rZdDtT6di7qKVAkhqLrwnpPv30txhqhttfRGltzediQ+/oHml4ayR6hbnqykGD6I+QT/q+wyK2dAxLxfmBm4id2WTAiscp6EPimcgkxMQ9xTkgGA9uiYDcxt3QsTkU+M1f7bOe62PZrZi6Otl/HFGp3SRIX3K4ClXKwyEmrRnk16vyBqgZhd8ZyCX+It4ZeAkJg4h1acRW574LXB0I8P+orV8UT3Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cherry.de; dmarc=pass action=none header.from=cherry.de; dkim=pass header.d=cherry.de; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cherry.de; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JbH/oOXAHGDDIyZmStMPkQp0S13FGoi5kTrrdXpMzQc=; b=n8ZaK3ZTGGoAcjoDWNsLF2tileQPX+l/rJYw1vfcj8dp3fbPSJVBcKmpjmGwUVgUew3N+vqu6u2m8QWUTfqyqdQajc9MUgAV2+zasWbcWV4YGKaJmuTibEglS3/gjdllmThlB98oK65D8s8Pu82YFhOAUz8wAhZ3gjvl6MEhT48= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=cherry.de; Received: from VE1PR04MB6382.eurprd04.prod.outlook.com (2603:10a6:803:122::31) by VI2PR04MB10642.eurprd04.prod.outlook.com (2603:10a6:800:27f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Tue, 18 Jun 2024 16:09:49 +0000 Received: from VE1PR04MB6382.eurprd04.prod.outlook.com ([fe80::2a24:328:711:5cd6]) by VE1PR04MB6382.eurprd04.prod.outlook.com ([fe80::2a24:328:711:5cd6%5]) with mapi id 15.20.7677.030; Tue, 18 Jun 2024 16:09:49 +0000 From: Farouk Bouabid Date: Tue, 18 Jun 2024 18:06:44 +0200 Subject: [PATCH v4 2/9] hwmon: (amc6821) dev_err using amc6821 device struct Message-Id: <20240618-dev-mule-i2c-mux-v4-2-5462d28354c8@cherry.de> References: <20240618-dev-mule-i2c-mux-v4-0-5462d28354c8@cherry.de> In-Reply-To: <20240618-dev-mule-i2c-mux-v4-0-5462d28354c8@cherry.de> To: Jean Delvare , Guenter Roeck , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lee Jones , Farouk Bouabid , Quentin Schulz , Peter Rosin , Heiko Stuebner Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.0 X-ClientProxiedBy: VI1PR07CA0286.eurprd07.prod.outlook.com (2603:10a6:800:130::14) To VE1PR04MB6382.eurprd04.prod.outlook.com (2603:10a6:803:122::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6382:EE_|VI2PR04MB10642:EE_ X-MS-Office365-Filtering-Correlation-Id: 95f61f70-7e7a-43ba-9572-08dc8fb113cf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|52116011|7416011|376011|366013|1800799021|38350700011|921017; X-Microsoft-Antispam-Message-Info: =?utf-8?q?3Qj2IoohvshEpGAx/cha66DTXb6WBqc?= =?utf-8?q?aLvIwKLemylFNoRAgDF7Fhe9ah1mBorDTG4EjTa7c0xcFWeTkXqkbK+/6ijcDawjj?= =?utf-8?q?/CNQCeIUD7CFWySZ8/sMekC41OhpsJfj3SAKekKdneiI7acrlEfeSUBJfKG+qO4n4?= =?utf-8?q?uen2UnV+NcTq2CdAqLMAH/DVKJ4bP69hceXucMjD0uGmuyu6USkc9yH/9cjh55nPU?= =?utf-8?q?2tzYpf0v4peyekISNaRwthCuuc0Yzv2XhBW2zozjy6Ihfk+AgpfwsvvPN87UNyYg5?= =?utf-8?q?cjccMrzTpRosVbRyUTjz3CfzBkwN2MoavExX6/K2ab7ovOwdnc9SuQbMKlaBOWn7w?= =?utf-8?q?KUVhthU7eeoZwqcZxGx85MwU9A6uY/nYxeSMakl7byxQ8Lj3aC165LHNdJ90C51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utf-8?q?6PSEO6j637VkM9bpirIHTEh3A4z3LckyeyBwQZiHpgm6RE8EwL/9lWOseSeMybJ/s?= =?utf-8?q?J543PmLReRLe?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB6382.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230037)(52116011)(7416011)(376011)(366013)(1800799021)(38350700011)(921017);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?qrXZyv5D7oj6H3lxhadYQS7tvpfA?= =?utf-8?q?HIgKSeQLm145IFgwGy4BZIwyqfd2PG7MZH1nKyPGRa3C1a1lpTjgRExE6T9gdKD/I?= =?utf-8?q?pMsyozIenFiy/XN0OjGDH/+wU5bFlvulIY1TXDpUVw+tYths0XTJdcl/Uh5cvYPLr?= =?utf-8?q?Vi9x/HByqaOe0TqLs85ndUoJpWCcwIfmyKVQI3vovIvuP+TJ09IBK7OGGGUB8ieOT?= =?utf-8?q?GvgItqeT0aT+IOMCZVxuQEHXGKsME70Uz8Xvziz3YguriFa+B7yScw0EpzY1TS34I?= =?utf-8?q?m2Kf9iBPPoIt45UcLSfOXsL8ky8/690cP96aucsQRz0FgsbUv7YO2pWm9//uysWDi?= =?utf-8?q?wmHrSTTNPDQJD5q/02+KP1euY1SAIOUinPD6W803I+JGmI+XWRmA/+20iKODLu+Wd?= =?utf-8?q?vz6PofN9JR5P8pCvUJDT4NV2LwN5HcAM7GWG7XbgU70NP8k7YH47aY2F/w7R5vXR4?= =?utf-8?q?nPMt1e18hahJU4lrcF4HEDGdZsXCTU0rgTJWiWVYv0kjDEPtdiJJMxhLAb6NXnpzP?= =?utf-8?q?qZCkE0KwT/+fJozkiDNQKg5ccSHZd97FsMA4OePsPQvZUVH27l8wWN2kdlDSlD27x?= =?utf-8?q?tX4degNo+RCJx86dulGtVwU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8IZXHJ/qI+89ddO+4Hr2EwlCZndtlJGA7DlkixiFIbt?= =?utf-8?q?UIIN0rVgXvrqNh8U5P/6XK7tXCM9IcfBaA=3D=3D?= X-OriginatorOrg: cherry.de X-MS-Exchange-CrossTenant-Network-Message-Id: 95f61f70-7e7a-43ba-9572-08dc8fb113cf X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6382.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2024 16:09:48.5399 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5e0e1b52-21b5-4e7b-83bb-514ec460677e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: KLBJof5A25VOZb534V4uYZkYRKYHr/cExC3MaYtzC2tj69/bYoJm/PPUxb+92GjrkCYQivIQmkNDjOAnDNhO9H9OSfOuhFRYgZEWexUk82g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI2PR04MB10642 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240618_091007_796187_2839DF3F X-CRM114-Status: GOOD ( 12.57 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org If probed as platform device, the i2c_client.dev is the parent device (eg. MFD) and not the actual amc6821 device. Use the latter to log errors instead. Signed-off-by: Farouk Bouabid --- drivers/hwmon/amc6821.c | 62 +++++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c index 464991fd7fc9..17456d7c7cfe 100644 --- a/drivers/hwmon/amc6821.c +++ b/drivers/hwmon/amc6821.c @@ -290,7 +290,7 @@ static ssize_t temp_store(struct device *dev, struct device_attribute *attr, mutex_lock(&data->update_lock); data->temp[ix] = val; if (i2c_smbus_write_byte_data(client, temp_reg[ix], data->temp[ix])) { - dev_err(&client->dev, "Register write error, aborting.\n"); + dev_err(dev, "Register write error, aborting.\n"); count = -EIO; } mutex_unlock(&data->update_lock); @@ -389,10 +389,10 @@ static ssize_t pwm1_enable_store(struct device *dev, mutex_lock(&data->update_lock); config = i2c_smbus_read_byte_data(client, AMC6821_REG_CONF1); if (config < 0) { - dev_err(&client->dev, + dev_err(dev, "Error reading configuration register, aborting.\n"); - count = config; - goto unlock; + count = config; + goto unlock; } switch (val) { @@ -413,9 +413,9 @@ static ssize_t pwm1_enable_store(struct device *dev, goto unlock; } if (i2c_smbus_write_byte_data(client, AMC6821_REG_CONF1, config)) { - dev_err(&client->dev, + dev_err(dev, "Configuration register write error, aborting.\n"); - count = -EIO; + count = -EIO; } unlock: mutex_unlock(&data->update_lock); @@ -459,11 +459,13 @@ static ssize_t pwm1_auto_point_pwm_show(struct device *dev, return sprintf(buf, "%d\n", data->pwm1_auto_point_pwm[ix]); } -static inline ssize_t set_slope_register(struct i2c_client *client, +static inline ssize_t set_slope_register(struct device *dev, u8 reg, u8 dpwm, u8 *ptemp) { + struct amc6821_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->client; int dt; u8 tmp; @@ -475,7 +477,7 @@ static inline ssize_t set_slope_register(struct i2c_client *client, tmp |= (ptemp[1] & 0x7C) << 1; if (i2c_smbus_write_byte_data(client, reg, tmp)) { - dev_err(&client->dev, "Register write error, aborting.\n"); + dev_err(dev, "Register write error, aborting.\n"); return -EIO; } return 0; @@ -525,7 +527,7 @@ static ssize_t temp_auto_point_temp_store(struct device *dev, client, AMC6821_REG_PSV_TEMP, ptemp[0])) { - dev_err(&client->dev, + dev_err(dev, "Register write error, aborting.\n"); count = -EIO; } @@ -544,7 +546,7 @@ static ssize_t temp_auto_point_temp_store(struct device *dev, goto EXIT; } dpwm = data->pwm1_auto_point_pwm[2] - data->pwm1_auto_point_pwm[1]; - if (set_slope_register(client, reg, dpwm, ptemp)) + if (set_slope_register(dev, reg, dpwm, ptemp)) count = -EIO; EXIT: @@ -568,17 +570,17 @@ static ssize_t pwm1_auto_point_pwm_store(struct device *dev, data->pwm1_auto_point_pwm[1] = clamp_val(val, 0, 254); if (i2c_smbus_write_byte_data(client, AMC6821_REG_DCY_LOW_TEMP, data->pwm1_auto_point_pwm[1])) { - dev_err(&client->dev, "Register write error, aborting.\n"); + dev_err(dev, "Register write error, aborting.\n"); count = -EIO; goto EXIT; } dpwm = data->pwm1_auto_point_pwm[2] - data->pwm1_auto_point_pwm[1]; - if (set_slope_register(client, AMC6821_REG_LTEMP_FAN_CTRL, dpwm, + if (set_slope_register(dev, AMC6821_REG_LTEMP_FAN_CTRL, dpwm, data->temp1_auto_point_temp)) { count = -EIO; goto EXIT; } - if (set_slope_register(client, AMC6821_REG_RTEMP_FAN_CTRL, dpwm, + if (set_slope_register(dev, AMC6821_REG_RTEMP_FAN_CTRL, dpwm, data->temp2_auto_point_temp)) { count = -EIO; goto EXIT; @@ -626,13 +628,13 @@ static ssize_t fan_store(struct device *dev, struct device_attribute *attr, data->fan[ix] = (u16) clamp_val(val, 1, 0xFFFF); if (i2c_smbus_write_byte_data(client, fan_reg_low[ix], data->fan[ix] & 0xFF)) { - dev_err(&client->dev, "Register write error, aborting.\n"); + dev_err(dev, "Register write error, aborting.\n"); count = -EIO; goto EXIT; } if (i2c_smbus_write_byte_data(client, fan_reg_hi[ix], data->fan[ix] >> 8)) { - dev_err(&client->dev, "Register write error, aborting.\n"); + dev_err(dev, "Register write error, aborting.\n"); count = -EIO; } EXIT: @@ -661,7 +663,7 @@ static ssize_t fan1_div_store(struct device *dev, mutex_lock(&data->update_lock); config = i2c_smbus_read_byte_data(client, AMC6821_REG_CONF4); if (config < 0) { - dev_err(&client->dev, + dev_err(dev, "Error reading configuration register, aborting.\n"); count = config; goto EXIT; @@ -680,7 +682,7 @@ static ssize_t fan1_div_store(struct device *dev, goto EXIT; } if (i2c_smbus_write_byte_data(client, AMC6821_REG_CONF4, config)) { - dev_err(&client->dev, + dev_err(dev, "Configuration register write error, aborting.\n"); count = -EIO; } @@ -815,7 +817,7 @@ static int amc6821_detect( return 0; } -static int amc6821_init_client(struct i2c_client *client) +static int amc6821_init_client(struct device *dev, struct i2c_client *client) { int config; int err = -EIO; @@ -824,16 +826,16 @@ static int amc6821_init_client(struct i2c_client *client) config = i2c_smbus_read_byte_data(client, AMC6821_REG_CONF4); if (config < 0) { - dev_err(&client->dev, - "Error reading configuration register, aborting.\n"); - return err; + dev_err(dev, + "Error reading configuration register, aborting.\n"); + return err; } config |= AMC6821_CONF4_MODE; if (i2c_smbus_write_byte_data(client, AMC6821_REG_CONF4, config)) { - dev_err(&client->dev, + dev_err(dev, "Configuration register write error, aborting.\n"); return err; } @@ -841,18 +843,18 @@ static int amc6821_init_client(struct i2c_client *client) config = i2c_smbus_read_byte_data(client, AMC6821_REG_CONF3); if (config < 0) { - dev_err(&client->dev, + dev_err(dev, "Error reading configuration register, aborting.\n"); return err; } - dev_info(&client->dev, "Revision %d\n", config & 0x0f); + dev_info(dev, "Revision %d\n", config & 0x0f); config &= ~AMC6821_CONF3_THERM_FAN_EN; if (i2c_smbus_write_byte_data(client, AMC6821_REG_CONF3, config)) { - dev_err(&client->dev, + dev_err(dev, "Configuration register write error, aborting.\n"); return err; } @@ -860,7 +862,7 @@ static int amc6821_init_client(struct i2c_client *client) config = i2c_smbus_read_byte_data(client, AMC6821_REG_CONF2); if (config < 0) { - dev_err(&client->dev, + dev_err(dev, "Error reading configuration register, aborting.\n"); return err; } @@ -870,7 +872,7 @@ static int amc6821_init_client(struct i2c_client *client) config &= ~AMC6821_CONF2_RTOIE; if (i2c_smbus_write_byte_data(client, AMC6821_REG_CONF2, config)) { - dev_err(&client->dev, + dev_err(dev, "Configuration register write error, aborting.\n"); return err; } @@ -878,7 +880,7 @@ static int amc6821_init_client(struct i2c_client *client) config = i2c_smbus_read_byte_data(client, AMC6821_REG_CONF1); if (config < 0) { - dev_err(&client->dev, + dev_err(dev, "Error reading configuration register, aborting.\n"); return err; } @@ -893,7 +895,7 @@ static int amc6821_init_client(struct i2c_client *client) if (i2c_smbus_write_byte_data( client, AMC6821_REG_CONF1, config)) { - dev_err(&client->dev, + dev_err(dev, "Configuration register write error, aborting.\n"); return err; } @@ -917,7 +919,7 @@ static int probe(struct device *dev, struct i2c_client *client) /* * Initialize the amc6821 chip */ - err = amc6821_init_client(client); + err = amc6821_init_client(dev, client); if (err) return err;