From patchwork Thu Mar 23 13:03:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Huewe X-Patchwork-Id: 9641041 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0275F602CA for ; Thu, 23 Mar 2017 13:02:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E87BF28514 for ; Thu, 23 Mar 2017 13:02:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D7C0428504; Thu, 23 Mar 2017 13:02:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 202EF28510 for ; Thu, 23 Mar 2017 13:02:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753418AbdCWNBi (ORCPT ); Thu, 23 Mar 2017 09:01:38 -0400 Received: from mout.gmx.net ([212.227.17.21]:55837 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934117AbdCWNBd (ORCPT ); Thu, 23 Mar 2017 09:01:33 -0400 Received: from lamerx.fritz.box ([79.249.178.48]) by mail.gmx.com (mrgmx103 [212.227.17.168]) with ESMTPSA (Nemesis) id 0LaoMe-1cSk9O0f4C-00kQb8; Thu, 23 Mar 2017 14:00:38 +0100 From: Peter Huewe To: Guenter Roeck Cc: Jean Delvare , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Huewe Subject: [PATCH 3/5] w83627ehf: Minor readability fixes Date: Thu, 23 Mar 2017 14:03:06 +0100 Message-Id: <20170323130308.29166-3-peterhuewe@gmx.de> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170323130308.29166-1-peterhuewe@gmx.de> References: <20170323130308.29166-1-peterhuewe@gmx.de> X-Provags-ID: V03:K0:CifZ9GtEhDBQtRU3gXRI5dKksrMUC06hThdLiO33gl+9LdTC1Nr dG+p3diW267rwMLqvWMYQi+o6+xx9UvlxTxfHr2iMbLJ7j0roTYSipR8zgJEHq3UWHWLaOE vcRbIvFBn7IYhSm2znOAiBPWYkx6k+OcLLfIIC94oTeUltNupoO+3hH5ab7dX0FeBFhQJor HRZYo6Lx5XlGfhw4mmBVA== X-UI-Out-Filterresults: notjunk:1; V01:K0:mpfqsCCOPac=:EZkxjmnrrWOgWdoVsnaDCu C1QxWB1N478i9mCErAB5/BxzGaTRb2d94WbPio5hSeLIn+eJkptuH4zR7xUQoST5JWRqx3Rc9 +twVLNoES9bhxKqeiu5tl+B7cC1+ZO4v+pS1sCJSPdUmGJmycEsGu8bykX/qk+0fX9X/kg/72 ay4xfkuMO/b/7pwlQ1WeG8QZdneaY4cnNzfKLWXmz7YYZpnEBG/M2UAas3UbLUxV9hj9cFh7h 8DM2OXhsdOqam8doIJPJ7qtlt3ASZSk6DjqtR9HEPU/z0uz09UpKCVhD1JafB8atztMTKgKUD qimtL3v96M+kZkV7AqV++RQqUAh5svN2L3Mtfe+hgg/wU4SmwRUjfXrcebBb//X9mvJNLCjQd n9wWwVGdlaMVKDf8FRT5bj/1/gahn2GyRgeo9LYhLcklJqSH3i4kYMiC10I+AdJrgPjbMWbNA 6c6N9pkjEhRz17bZFoAc9kGzpn+/XXXFdgxkk3bhSGTRPgqkk/gR8pwBe/04jAnHkQhSKJRjr wFt5rYIWUjoG5sMT25jHlcLpSpcSsPf8b4Ld90ziIB6CjPhnKyzxOmJx1ukk1r0GK4gKoSU6X 3AjzlDLdzLcmipPTkcEOPzVNsqgxVjDZyJUwrUewQdWDis+PSHQperqQxgahtTP9zTESMZuN6 wWJkk+Lj8WoDn1I+Q1mwBCNdyxYNB8PBbqcEUgDiLzZ7xdqDCZyQbcbY5r3gNC3eK/WrmGQiZ BFJzYPsNC7PXlBKQlg5H87lnsaAfi4NY3V7LNbgUeGipMabC4j96oYnx/CE= Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP just some cosmetics for better readability, proposed by Lindent/checkpatch Signed-off-by: Peter Huewe --- drivers/hwmon/w83627ehf.c | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index 0acadeece509..a6f56b12727b 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c @@ -410,6 +410,7 @@ div_from_reg(u8 reg) static const u16 scale_in_common[10] = { 800, 800, 1600, 1600, 800, 800, 800, 1600, 1600, 800 }; + static const u16 scale_in_w83627uhg[9] = { 800, 800, 3328, 3424, 800, 800, 0, 3328, 3400 }; @@ -432,7 +433,6 @@ struct w83627ehf_sio_data { enum kinds kind; }; - struct w83627ehf_data { int addr; /* IO base of hw monitor block */ const char *name; @@ -532,6 +532,7 @@ struct w83627ehf_data { static inline void w83627ehf_set_bank(struct w83627ehf_data *data, u16 reg) { u8 bank = reg >> 8; + if (data->bank != bank) { outb_p(W83627EHF_REG_BANK, data->addr + ADDR_REG_OFFSET); outb_p(bank, data->addr + DATA_REG_OFFSET); @@ -549,8 +550,7 @@ static u16 w83627ehf_read_value(struct w83627ehf_data *data, u16 reg) outb_p(reg & 0xff, data->addr + ADDR_REG_OFFSET); res = inb_p(data->addr + DATA_REG_OFFSET); if (word_sized) { - outb_p((reg & 0xff) + 1, - data->addr + ADDR_REG_OFFSET); + outb_p((reg & 0xff) + 1, data->addr + ADDR_REG_OFFSET); res = (res << 8) + inb_p(data->addr + DATA_REG_OFFSET); } @@ -569,8 +569,7 @@ static int w83627ehf_write_value(struct w83627ehf_data *data, u16 reg, outb_p(reg & 0xff, data->addr + ADDR_REG_OFFSET); if (word_sized) { outb_p(value >> 8, data->addr + DATA_REG_OFFSET); - outb_p((reg & 0xff) + 1, - data->addr + ADDR_REG_OFFSET); + outb_p((reg & 0xff) + 1, data->addr + ADDR_REG_OFFSET); } outb_p(value & 0xff, data->addr + DATA_REG_OFFSET); @@ -590,8 +589,7 @@ static u16 w83627ehf_read_temp(struct w83627ehf_data *data, u16 reg) return res; } -static int w83627ehf_write_temp(struct w83627ehf_data *data, u16 reg, - u16 value) +static int w83627ehf_write_temp(struct w83627ehf_data *data, u16 reg, u16 value) { if (!is_word_sized(reg)) value >>= 8; @@ -700,7 +698,7 @@ static void nct6775_update_fan_div(struct w83627ehf_data *data) data->fan_div[1] = (i & 0x70) >> 4; i = w83627ehf_read_value(data, NCT6775_REG_FANDIV2); data->fan_div[2] = i & 0x7; - if (data->has_fan & (1<<3)) + if (data->has_fan & (1 << 3)) data->fan_div[3] = (i & 0x70) >> 4; } @@ -935,9 +933,7 @@ static struct w83627ehf_data *w83627ehf_update_device(struct device *dev) return data; } - -static void -store_fan_min(struct device *dev, u32 channel, unsigned long val) +static void store_fan_min(struct device *dev, u32 channel, unsigned long val) { struct w83627ehf_data *data = dev_get_drvdata(dev); int nr = channel; @@ -1014,10 +1010,8 @@ store_fan_min(struct device *dev, u32 channel, unsigned long val) data->last_updated = jiffies; } done: - w83627ehf_write_value(data, data->REG_FAN_MIN[nr], - data->fan_min[nr]); + w83627ehf_write_value(data, data->REG_FAN_MIN[nr], data->fan_min[nr]); mutex_unlock(&data->update_lock); - } #define show_tol_temp(reg) \ @@ -1036,7 +1030,7 @@ show_tol_temp(target_temp) static ssize_t store_target_temp(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) + const char *buf, size_t count) { struct w83627ehf_data *data = dev_get_drvdata(dev); struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); @@ -1059,7 +1053,7 @@ store_target_temp(struct device *dev, struct device_attribute *attr, static ssize_t store_tolerance(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) + const char *buf, size_t count) { struct w83627ehf_data *data = dev_get_drvdata(dev); struct w83627ehf_sio_data *sio_data = data->sio_data; @@ -1243,6 +1237,7 @@ static ssize_t cpu0_vid_show(struct device *dev, struct device_attribute *attr, char *buf) { struct w83627ehf_data *data = dev_get_drvdata(dev); + return sprintf(buf, "%d\n", vid_from_reg(data->vid, data->vrm)); } static DEVICE_ATTR_RO(cpu0_vid); @@ -1486,8 +1481,7 @@ static inline void w83627ehf_init_device(struct w83627ehf_data *data, /* Start monitoring is needed */ tmp = w83627ehf_read_value(data, W83627EHF_REG_CONFIG); if (!(tmp & 0x01)) - w83627ehf_write_value(data, W83627EHF_REG_CONFIG, - tmp | 0x01); + w83627ehf_write_value(data, W83627EHF_REG_CONFIG, tmp | 0x01); /* Enable temperature sensors if needed */ for (i = 0; i < NUM_REG_TEMP; i++) { @@ -1495,8 +1489,7 @@ static inline void w83627ehf_init_device(struct w83627ehf_data *data, continue; if (!data->reg_temp_config[i]) continue; - tmp = w83627ehf_read_value(data, - data->reg_temp_config[i]); + tmp = w83627ehf_read_value(data, data->reg_temp_config[i]); if (tmp & 0x01) w83627ehf_write_value(data, data->reg_temp_config[i], @@ -1537,8 +1530,7 @@ static inline void w83627ehf_init_device(struct w83627ehf_data *data, } } -static void w82627ehf_swap_tempreg(struct w83627ehf_data *data, - int r1, int r2) +static void w82627ehf_swap_tempreg(struct w83627ehf_data *data, int r1, int r2) { swap(data->temp_src[r1], data->temp_src[r2]); swap(data->reg_temp[r1], data->reg_temp[r2]); @@ -1547,8 +1539,7 @@ static void w82627ehf_swap_tempreg(struct w83627ehf_data *data, swap(data->reg_temp_config[r1], data->reg_temp_config[r2]); } -static void -w83627ehf_set_temp_reg_ehf(struct w83627ehf_data *data, int n_temp) +static void w83627ehf_set_temp_reg_ehf(struct w83627ehf_data *data, int n_temp) { int i;