Skip to content

Commit 649b419

Browse files
committed
hwmon: (pmbus/core) Fix various coding style issues
Checkpatch reports bad multi-line comments, bad multi-line alignments, missing blank lines after variable declarations, unnecessary empty lines, unnecessary spaces, and unnecessary braces. Fix most of the reported problems except for some multi-line alignment problems. Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent e6b082d commit 649b419

1 file changed

Lines changed: 17 additions & 24 deletions

File tree

drivers/hwmon/pmbus/pmbus_core.c

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ struct pmbus_sensor {
4444
enum pmbus_sensor_classes class; /* sensor class */
4545
bool update; /* runtime sensor update needed */
4646
bool convert; /* Whether or not to apply linear/vid/direct */
47-
int data; /* Sensor data.
48-
Negative if there was a read error */
47+
int data; /* Sensor data; negative if there was a read error */
4948
};
5049
#define to_pmbus_sensor(_attr) \
5150
container_of(_attr, struct pmbus_sensor, attribute)
@@ -192,11 +191,10 @@ static void pmbus_update_ts(struct i2c_client *client, bool write_op)
192191
struct pmbus_data *data = i2c_get_clientdata(client);
193192
const struct pmbus_driver_info *info = data->info;
194193

195-
if (info->access_delay) {
194+
if (info->access_delay)
196195
data->access_time = ktime_get();
197-
} else if (info->write_delay && write_op) {
196+
else if (info->write_delay && write_op)
198197
data->write_time = ktime_get();
199-
}
200198
}
201199

202200
int pmbus_set_page(struct i2c_client *client, int page, int phase)
@@ -292,7 +290,6 @@ int pmbus_write_word_data(struct i2c_client *client, int page, u8 reg,
292290
}
293291
EXPORT_SYMBOL_NS_GPL(pmbus_write_word_data, "PMBUS");
294292

295-
296293
static int pmbus_write_virt_reg(struct i2c_client *client, int page, int reg,
297294
u16 word)
298295
{
@@ -381,14 +378,14 @@ int pmbus_update_fan(struct i2c_client *client, int page, int id,
381378
u8 to;
382379

383380
from = _pmbus_read_byte_data(client, page,
384-
pmbus_fan_config_registers[id]);
381+
pmbus_fan_config_registers[id]);
385382
if (from < 0)
386383
return from;
387384

388385
to = (from & ~mask) | (config & mask);
389386
if (to != from) {
390387
rv = _pmbus_write_byte_data(client, page,
391-
pmbus_fan_config_registers[id], to);
388+
pmbus_fan_config_registers[id], to);
392389
if (rv < 0)
393390
return rv;
394391
}
@@ -563,7 +560,7 @@ static int pmbus_get_fan_rate(struct i2c_client *client, int page, int id,
563560
}
564561

565562
config = _pmbus_read_byte_data(client, page,
566-
pmbus_fan_config_registers[id]);
563+
pmbus_fan_config_registers[id]);
567564
if (config < 0)
568565
return config;
569566

@@ -788,7 +785,7 @@ static s64 pmbus_reg2data_linear(struct pmbus_data *data,
788785

789786
if (sensor->class == PSC_VOLTAGE_OUT) { /* LINEAR16 */
790787
exponent = data->exponent[sensor->page];
791-
mantissa = (u16) sensor->data;
788+
mantissa = (u16)sensor->data;
792789
} else { /* LINEAR11 */
793790
exponent = ((s16)sensor->data) >> 11;
794791
mantissa = ((s16)((sensor->data & 0x7ff) << 5)) >> 5;
@@ -1173,7 +1170,6 @@ static int pmbus_get_boolean(struct i2c_client *client, struct pmbus_boolean *b,
11731170
} else {
11741171
pmbus_clear_fault_page(client, page);
11751172
}
1176-
11771173
}
11781174
if (s1 && s2) {
11791175
s64 v1, v2;
@@ -1499,8 +1495,7 @@ struct pmbus_limit_attr {
14991495
u16 reg; /* Limit register */
15001496
u16 sbit; /* Alarm attribute status bit */
15011497
bool update; /* True if register needs updates */
1502-
bool low; /* True if low limit; for limits with compare
1503-
functions only */
1498+
bool low; /* True if low limit; for limits with compare functions only */
15041499
const char *attr; /* Attribute name */
15051500
const char *alarm; /* Alarm attribute name */
15061501
};
@@ -2211,8 +2206,8 @@ static const u32 pmbus_fan_status_flags[] = {
22112206

22122207
/* Precondition: FAN_CONFIG_x_y and FAN_COMMAND_x must exist for the fan ID */
22132208
static int pmbus_add_fan_ctrl(struct i2c_client *client,
2214-
struct pmbus_data *data, int index, int page, int id,
2215-
u8 config)
2209+
struct pmbus_data *data, int index, int page,
2210+
int id, u8 config)
22162211
{
22172212
struct pmbus_sensor *sensor;
22182213

@@ -2224,7 +2219,7 @@ static int pmbus_add_fan_ctrl(struct i2c_client *client,
22242219
return -ENOMEM;
22252220

22262221
if (!((data->info->func[page] & PMBUS_HAVE_PWM12) ||
2227-
(data->info->func[page] & PMBUS_HAVE_PWM34)))
2222+
(data->info->func[page] & PMBUS_HAVE_PWM34)))
22282223
return 0;
22292224

22302225
sensor = pmbus_add_sensor(data, "pwm", NULL, index, page,
@@ -2934,7 +2929,7 @@ static void pmbus_notify(struct pmbus_data *data, int page, int reg, int flags)
29342929
}
29352930

29362931
static int _pmbus_get_flags(struct pmbus_data *data, u8 page, unsigned int *flags,
2937-
unsigned int *event, bool notify)
2932+
unsigned int *event, bool notify)
29382933
{
29392934
int i, status;
29402935
const struct pmbus_status_category *cat;
@@ -2963,7 +2958,6 @@ static int _pmbus_get_flags(struct pmbus_data *data, u8 page, unsigned int *flag
29632958

29642959
if (notify && status)
29652960
pmbus_notify(data, page, cat->reg, status);
2966-
29672961
}
29682962

29692963
/*
@@ -3014,7 +3008,6 @@ static int _pmbus_get_flags(struct pmbus_data *data, u8 page, unsigned int *flag
30143008
*event |= REGULATOR_EVENT_OVER_TEMP_WARN;
30153009
}
30163010

3017-
30183011
return 0;
30193012
}
30203013

@@ -3227,7 +3220,7 @@ static int pmbus_regulator_set_voltage(struct regulator_dev *rdev, int min_uv,
32273220
}
32283221

32293222
static int pmbus_regulator_list_voltage(struct regulator_dev *rdev,
3230-
unsigned int selector)
3223+
unsigned int selector)
32313224
{
32323225
struct device *dev = rdev_get_dev(rdev);
32333226
struct i2c_client *client = to_i2c_client(dev->parent);
@@ -3362,8 +3355,8 @@ static irqreturn_t pmbus_fault_handler(int irq, void *pdata)
33623355
{
33633356
struct pmbus_data *data = pdata;
33643357
struct i2c_client *client = to_i2c_client(data->dev);
3365-
33663358
int i, status, event;
3359+
33673360
mutex_lock(&data->update_lock);
33683361
for (i = 0; i < data->info->pages; i++) {
33693362
_pmbus_get_flags(data, i, &status, &event, true);
@@ -3471,7 +3464,7 @@ DEFINE_DEBUGFS_ATTRIBUTE(pmbus_debugfs_ops_status, pmbus_debugfs_get_status,
34713464
NULL, "0x%04llx\n");
34723465

34733466
static ssize_t pmbus_debugfs_mfr_read(struct file *file, char __user *buf,
3474-
size_t count, loff_t *ppos)
3467+
size_t count, loff_t *ppos)
34753468
{
34763469
int rc;
34773470
struct pmbus_debugfs_entry *entry = file->private_data;
@@ -3799,8 +3792,8 @@ int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info)
37993792

38003793
data->groups[0] = &data->group;
38013794
memcpy(data->groups + 1, info->groups, sizeof(void *) * groups_num);
3802-
data->hwmon_dev = devm_hwmon_device_register_with_groups(dev,
3803-
name, data, data->groups);
3795+
data->hwmon_dev = devm_hwmon_device_register_with_groups(dev, name,
3796+
data, data->groups);
38043797
if (IS_ERR(data->hwmon_dev)) {
38053798
dev_err(dev, "Failed to register hwmon device\n");
38063799
return PTR_ERR(data->hwmon_dev);

0 commit comments

Comments
 (0)