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: 1949395 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=cherry.de header.i=@cherry.de header.a=rsa-sha256 header.s=selector1 header.b=n8ZaK3ZT; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.48.161; helo=sy.mirrors.kernel.org; envelope-from=linux-i2c+bounces-4092-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W3XXF0CyJz20KL for ; Wed, 19 Jun 2024 02:39:25 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id DA77FB2A9DD for ; Tue, 18 Jun 2024 16:11:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C3BB1482E6; Tue, 18 Jun 2024 16:10:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=cherry.de header.i=@cherry.de header.b="n8ZaK3ZT" X-Original-To: linux-i2c@vger.kernel.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2123.outbound.protection.outlook.com [40.107.22.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7266413DB98; Tue, 18 Jun 2024 16:10:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.123 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718727005; cv=fail; b=gIQa3xRv0bS2OtyMyBw1nDPMYJGzOZ+gdjoWhvzdJYiagivn0M9rZ0d5CLBLVSEz4Be/EMgw97vIJ5he5occrhOIryYpQl3t1Qy+V3mUBAAdh2ro0O/+0KR8zEfwupRGqnZJRSGhY6A4DJnLbDPLoytn1EszJ0Yew53ICHKlo/k= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718727005; c=relaxed/simple; bh=1zZ5WNyFH/Fv4Uevn7d2BC7kYXf02eiud9FkbAVOCb4=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=r7HFOXrZzDThYw6yPhUjlgHrQoOITKI1pyrQgUKPg2fE1o1MaRMgtsPfln9lrzAwaO48QUqG8zcNWiTIvtf/pmbgAM6ZvlGCSxGvMYOCjsn+Hr+Rn6frrXtnu1s9hjSl+6LY23zbKqdJb31qzPiT62Ec6Xq7e1/CjIACPzjtkek= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=cherry.de; spf=pass smtp.mailfrom=cherry.de; dkim=pass (1024-bit key) header.d=cherry.de header.i=@cherry.de header.b=n8ZaK3ZT; arc=fail smtp.client-ip=40.107.22.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=cherry.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cherry.de 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) Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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/nYxeSMakl7byxQ8Lj3aC165LHNdJ90C51ft?= =?utf-8?q?c2CFhJAGM+hJk0SMEzToKPsbM47VMjkF9FTuOyk6kXGZvbmIi04GmJ9jCB1zF5cbs?= =?utf-8?q?bhVSvIv/7sj9LXEiXPM07xNs9sHslLH2TEAbq/1FqEcVxQ9ANIrg2yamBoxFhLm7q?= =?utf-8?q?ojima1d/6BIG11knC0q8aTe/uooCvnlhOTys8S9pMApv29V1Vq/d+XviDorxgXR4R?= =?utf-8?q?TQGBuqK1fXW2VKMez9BwvxJpGX8tGGqHzoqKM19d4hcIG2WUtLZFMxi+rOGXRp4ix?= =?utf-8?q?PtBtV7y9kF/kQf2p0jTYRT+U7bP7WWg05MELyTG3zna9NWV2fn2dQ05flZxn/t5r8?= =?utf-8?q?/Na87nmR/J1fX6DY979bJNuol0p8Ajz5gzNIlFPAto18IFhzpFZdUyhg43xgw4fpo?= =?utf-8?q?L6jUKogNKUdJXACdNv+1LNtcHF5sUpoeWYDadYpECRUxziQgppRvTMKzdt0MFeCaR?= =?utf-8?q?sc9FLYNr2e/aV4luUY1FOPiPF2SxhhNBfpg5/JhqGVI8xrSGjldM/cj5gPsxt+7B1?= =?utf-8?q?sYgx6bD5H7LAdQ0vSJZxHgdgL+6D3yOwUHpVCHMFoBZau3Zwg6li8ggMROUbYNtaV?= =?utf-8?q?l1E9YLDESxXwOpvPBEhevYKDt/47Qv3yFVo+8Ny79eCr82yvFrCkAqXuCp9JZcrxu?= =?utf-8?q?wlIh90s2zqs5ZFCf0QGh6vp+MyO+F1GYMx3yGiH5qJiE9LTp6y8rNPfw5CF+xmZsw?= =?utf-8?q?BW6I281JQW3i4lmpHwwZcY2xErouuUf/e27VNOMc6vmyxeoQOj5DPHLKmj5bxefaA?= =?utf-8?q?sPC7sBGfan0o22HmUbDhB9/2ILMjM4HnTbfAltGkgkA/5pqmR5FVqSubpBf9+pGzK?= =?utf-8?q?Ghyo+ZesjPJBC8ZKqvubSGULsYwHUTdg/Nhr6HKFMZrGrYdmIkvhrA3jr/3vRUY1A?= =?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+RCJx86dulGtVwUDsWWi13NFfYL93/0NASxEeYmGZXJMlAfkBEJd4BDHf?= =?utf-8?q?iE5ad018nWUIJiEp1tVsn1UzrQoNxwCtl76Hv/E5H3uFIfHRmNfdCUItEMH1VnTqJ?= =?utf-8?q?ShsZ63p+gWb0fTiRXIwVuYqYMGBtz4y6bY7ZzzFTUaiR6n6Htdb74xBLahKQs7n2h?= =?utf-8?q?liV1nhFd57jh9/hoONRN6cgE8jHgfV5p6D+EksNBcKn/TqvDy2Kb1Oz8PGYEBNGKo?= =?utf-8?q?RawFqs5mgL0+7+IbeCDpP/jGnY0uFKiD2nJDN/Bhrlq7/YWsdrRwKhsVZ83PPc9cX?= =?utf-8?q?yBURK3DArmPXzK2C+B70+HwQT8AsrDD90/tAQ0gV/1hxMXkHu0q68mSXWQtzNSfuF?= =?utf-8?q?zpwq2GpB4l7Am0SD0u8e9maXZXcSL0ESSy0QVaPV7aDVTAp89I6oJurO1wj/iY/A8?= =?utf-8?q?Rc2qqbwrO5i/mbB7cqWM3PiIrBmCPrToRUe0r5W4zYB2iHmw5lT4R7tbBoRSCdV0t?= =?utf-8?q?fu40kixdQJK3yR/5CdvSi/ULs0PS7NvsN9Vkw5MdZ3xLJ+qHxrEpzc5WANl25U82e?= =?utf-8?q?RytTq926n1fS8j667kHgNXsZtL9iOZHMNh3aFDBpFkx7sLGqBApgRTW7QPWFAaGF8?= =?utf-8?q?/K6rPawJAlIb9yCs1/XTU7mNKGddzLluvwhM9oFP8r1T/q/Lume3n4PStcQt2SPcR?= =?utf-8?q?Tap9EmvOXidYKtyOgl1FARSJ9mxCXRA0vBm6XZuNsYccVXDVZVrXnfUF3Y6qZjW8G?= =?utf-8?q?IRm/9XEN02ztG1CMr76/2XGjbp36LHH4UPHRsNaOi+GP0ekfIEzQeVczmw1J2JRpy?= =?utf-8?q?1CWTrjnQWJKgh0cLc2uGH0pjCrHR238k3ibaSZaDby5jqLxy8kGF1lzqbUlMvuAa1?= =?utf-8?q?4CXvkKUZaQMgwTARROofaE8IZXHJ/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 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;