Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 088ce2ac authored by Guenter Roeck's avatar Guenter Roeck
Browse files

hwmon: Fix CamelCase checkpatch warnings

parent 236d9039
Loading
Loading
Loading
Loading
+21 −21
Original line number Diff line number Diff line
@@ -40,25 +40,25 @@
 * the instruction byte
 */
/*Instruction Bit masks*/
#define INST_MODE_bm	(1<<7)
#define INST_READ_bm	(1<<6)
#define INST_16BIT_bm	(1<<5)
#define INST_MODE_BM	(1 << 7)
#define INST_READ_BM	(1 << 6)
#define INST_16BIT_BM	(1 << 5)

/*From figure 18 in the datasheet*/
/*bit masks for Rev/Oscillator Control Register*/
#define MUX_CNV_bv	7
#define MUX_CNV_bm	(1<<MUX_CNV_bv)
#define MUX_M3_bm	(1<<3) /*M3 selects single ended*/
#define MUX_G_bv	4 /*allows for reg = (gain << MUX_G_bv) | ...*/
#define MUX_CNV_BV	7
#define MUX_CNV_BM	(1 << MUX_CNV_BV)
#define MUX_M3_BM	(1 << 3) /*M3 selects single ended*/
#define MUX_G_BV	4 /*allows for reg = (gain << MUX_G_BV) | ...*/

/*From figure 18 in the datasheet*/
/*bit masks for Rev/Oscillator Control Register*/
#define OSC_OSCR_bm	(1<<5)
#define OSC_OSCE_bm	(1<<4)
#define OSC_REFE_bm	(1<<3)
#define OSC_BUFE_bm	(1<<2)
#define OSC_R2V_bm	(1<<1)
#define OSC_RBG_bm	(1<<0)
#define OSC_OSCR_BM	(1 << 5)
#define OSC_OSCE_BM	(1 << 4)
#define OSC_REFE_BM	(1 << 3)
#define OSC_BUFE_BM	(1 << 2)
#define OSC_R2V_BM	(1 << 1)
#define OSC_RBG_BM	(1 << 0)

#include <linux/module.h>
#include <linux/init.h>
@@ -79,7 +79,7 @@ struct ads7871_data {
static int ads7871_read_reg8(struct spi_device *spi, int reg)
{
	int ret;
	reg = reg | INST_READ_bm;
	reg = reg | INST_READ_BM;
	ret = spi_w8r8(spi, reg);
	return ret;
}
@@ -87,7 +87,7 @@ static int ads7871_read_reg8(struct spi_device *spi, int reg)
static int ads7871_read_reg16(struct spi_device *spi, int reg)
{
	int ret;
	reg = reg | INST_READ_bm | INST_16BIT_bm;
	reg = reg | INST_READ_BM | INST_16BIT_BM;
	ret = spi_w8r16(spi, reg);
	return ret;
}
@@ -111,13 +111,13 @@ static ssize_t show_voltage(struct device *dev,
	 * TODO: add support for conversions
	 * other than single ended with a gain of 1
	 */
	/*MUX_M3_bm forces single ended*/
	/*MUX_M3_BM forces single ended*/
	/*This is also where the gain of the PGA would be set*/
	ads7871_write_reg8(spi, REG_GAIN_MUX,
		(MUX_CNV_bm | MUX_M3_bm | channel));
		(MUX_CNV_BM | MUX_M3_BM | channel));

	ret = ads7871_read_reg8(spi, REG_GAIN_MUX);
	mux_cnv = ((ret & MUX_CNV_bm)>>MUX_CNV_bv);
	mux_cnv = ((ret & MUX_CNV_BM) >> MUX_CNV_BV);
	/*
	 * on 400MHz arm9 platform the conversion
	 * is already done when we do this test
@@ -125,7 +125,7 @@ static ssize_t show_voltage(struct device *dev,
	while ((i < 2) && mux_cnv) {
		i++;
		ret = ads7871_read_reg8(spi, REG_GAIN_MUX);
		mux_cnv = ((ret & MUX_CNV_bm)>>MUX_CNV_bv);
		mux_cnv = ((ret & MUX_CNV_BM) >> MUX_CNV_BV);
		msleep_interruptible(1);
	}

@@ -189,7 +189,7 @@ static int ads7871_probe(struct spi_device *spi)
	ads7871_write_reg8(spi, REG_SER_CONTROL, 0);
	ads7871_write_reg8(spi, REG_AD_CONTROL, 0);

	val = (OSC_OSCR_bm | OSC_OSCE_bm | OSC_REFE_bm | OSC_BUFE_bm);
	val = (OSC_OSCR_BM | OSC_OSCE_BM | OSC_REFE_BM | OSC_BUFE_BM);
	ads7871_write_reg8(spi, REG_OSC_CONTROL, val);
	ret = ads7871_read_reg8(spi, REG_OSC_CONTROL);

+28 −28
Original line number Diff line number Diff line
@@ -159,12 +159,12 @@ static inline int write_byte(struct i2c_client *client, u8 reg, u8 data)
 * and retrieval of like parameters.
 */

#define SETUP_SHOW_data_param(d, a) \
#define SETUP_SHOW_DATA_PARAM(d, a) \
	struct sensor_device_attribute *sda = to_sensor_dev_attr(a); \
	struct asc7621_data *data = asc7621_update_device(d); \
	struct asc7621_param *param = to_asc7621_param(sda)

#define SETUP_STORE_data_param(d, a) \
#define SETUP_STORE_DATA_PARAM(d, a) \
	struct sensor_device_attribute *sda = to_sensor_dev_attr(a); \
	struct i2c_client *client = to_i2c_client(d); \
	struct asc7621_data *data = i2c_get_clientdata(client); \
@@ -177,7 +177,7 @@ static inline int write_byte(struct i2c_client *client, u8 reg, u8 data)
static ssize_t show_u8(struct device *dev, struct device_attribute *attr,
		       char *buf)
{
	SETUP_SHOW_data_param(dev, attr);
	SETUP_SHOW_DATA_PARAM(dev, attr);

	return sprintf(buf, "%u\n", data->reg[param->msb[0]]);
}
@@ -185,7 +185,7 @@ static ssize_t show_u8(struct device *dev, struct device_attribute *attr,
static ssize_t store_u8(struct device *dev, struct device_attribute *attr,
			const char *buf, size_t count)
{
	SETUP_STORE_data_param(dev, attr);
	SETUP_STORE_DATA_PARAM(dev, attr);
	long reqval;

	if (kstrtol(buf, 10, &reqval))
@@ -206,7 +206,7 @@ static ssize_t store_u8(struct device *dev, struct device_attribute *attr,
static ssize_t show_bitmask(struct device *dev,
			    struct device_attribute *attr, char *buf)
{
	SETUP_SHOW_data_param(dev, attr);
	SETUP_SHOW_DATA_PARAM(dev, attr);

	return sprintf(buf, "%u\n",
		       (data->reg[param->msb[0]] >> param->
@@ -217,7 +217,7 @@ static ssize_t store_bitmask(struct device *dev,
			     struct device_attribute *attr,
			     const char *buf, size_t count)
{
	SETUP_STORE_data_param(dev, attr);
	SETUP_STORE_DATA_PARAM(dev, attr);
	long reqval;
	u8 currval;

@@ -246,7 +246,7 @@ static ssize_t store_bitmask(struct device *dev,
static ssize_t show_fan16(struct device *dev,
			  struct device_attribute *attr, char *buf)
{
	SETUP_SHOW_data_param(dev, attr);
	SETUP_SHOW_DATA_PARAM(dev, attr);
	u16 regval;

	mutex_lock(&data->update_lock);
@@ -262,7 +262,7 @@ static ssize_t store_fan16(struct device *dev,
			   struct device_attribute *attr, const char *buf,
			   size_t count)
{
	SETUP_STORE_data_param(dev, attr);
	SETUP_STORE_DATA_PARAM(dev, attr);
	long reqval;

	if (kstrtol(buf, 10, &reqval))
@@ -307,7 +307,7 @@ static int asc7621_in_scaling[] = {
static ssize_t show_in10(struct device *dev, struct device_attribute *attr,
			 char *buf)
{
	SETUP_SHOW_data_param(dev, attr);
	SETUP_SHOW_DATA_PARAM(dev, attr);
	u16 regval;
	u8 nr = sda->index;

@@ -325,7 +325,7 @@ static ssize_t show_in10(struct device *dev, struct device_attribute *attr,
static ssize_t show_in8(struct device *dev, struct device_attribute *attr,
			char *buf)
{
	SETUP_SHOW_data_param(dev, attr);
	SETUP_SHOW_DATA_PARAM(dev, attr);
	u8 nr = sda->index;

	return sprintf(buf, "%u\n",
@@ -336,7 +336,7 @@ static ssize_t show_in8(struct device *dev, struct device_attribute *attr,
static ssize_t store_in8(struct device *dev, struct device_attribute *attr,
			 const char *buf, size_t count)
{
	SETUP_STORE_data_param(dev, attr);
	SETUP_STORE_DATA_PARAM(dev, attr);
	long reqval;
	u8 nr = sda->index;

@@ -360,7 +360,7 @@ static ssize_t store_in8(struct device *dev, struct device_attribute *attr,
static ssize_t show_temp8(struct device *dev,
			  struct device_attribute *attr, char *buf)
{
	SETUP_SHOW_data_param(dev, attr);
	SETUP_SHOW_DATA_PARAM(dev, attr);

	return sprintf(buf, "%d\n", ((s8) data->reg[param->msb[0]]) * 1000);
}
@@ -369,7 +369,7 @@ static ssize_t store_temp8(struct device *dev,
			   struct device_attribute *attr, const char *buf,
			   size_t count)
{
	SETUP_STORE_data_param(dev, attr);
	SETUP_STORE_DATA_PARAM(dev, attr);
	long reqval;
	s8 temp;

@@ -397,7 +397,7 @@ static ssize_t store_temp8(struct device *dev,
static ssize_t show_temp10(struct device *dev,
			   struct device_attribute *attr, char *buf)
{
	SETUP_SHOW_data_param(dev, attr);
	SETUP_SHOW_DATA_PARAM(dev, attr);
	u8 msb, lsb;
	int temp;

@@ -414,7 +414,7 @@ static ssize_t show_temp10(struct device *dev,
static ssize_t show_temp62(struct device *dev,
			   struct device_attribute *attr, char *buf)
{
	SETUP_SHOW_data_param(dev, attr);
	SETUP_SHOW_DATA_PARAM(dev, attr);
	u8 regval = data->reg[param->msb[0]];
	int temp = ((s8) (regval & 0xfc) * 1000) + ((regval & 0x03) * 250);

@@ -425,7 +425,7 @@ static ssize_t store_temp62(struct device *dev,
			    struct device_attribute *attr, const char *buf,
			    size_t count)
{
	SETUP_STORE_data_param(dev, attr);
	SETUP_STORE_DATA_PARAM(dev, attr);
	long reqval, i, f;
	s8 temp;

@@ -459,7 +459,7 @@ static u32 asc7621_range_map[] = {
static ssize_t show_ap2_temp(struct device *dev,
			     struct device_attribute *attr, char *buf)
{
	SETUP_SHOW_data_param(dev, attr);
	SETUP_SHOW_DATA_PARAM(dev, attr);
	long auto_point1;
	u8 regval;
	int temp;
@@ -479,7 +479,7 @@ static ssize_t store_ap2_temp(struct device *dev,
			      struct device_attribute *attr,
			      const char *buf, size_t count)
{
	SETUP_STORE_data_param(dev, attr);
	SETUP_STORE_DATA_PARAM(dev, attr);
	long reqval, auto_point1;
	int i;
	u8 currval, newval = 0;
@@ -510,7 +510,7 @@ static ssize_t store_ap2_temp(struct device *dev,
static ssize_t show_pwm_ac(struct device *dev,
			   struct device_attribute *attr, char *buf)
{
	SETUP_SHOW_data_param(dev, attr);
	SETUP_SHOW_DATA_PARAM(dev, attr);
	u8 config, altbit, regval;
	u8 map[] = {
		0x01, 0x02, 0x04, 0x1f, 0x00, 0x06, 0x07, 0x10,
@@ -530,7 +530,7 @@ static ssize_t store_pwm_ac(struct device *dev,
			    struct device_attribute *attr,
			    const char *buf, size_t count)
{
	SETUP_STORE_data_param(dev, attr);
	SETUP_STORE_DATA_PARAM(dev, attr);
	unsigned long reqval;
	u8 currval, config, altbit, newval;
	u16 map[] = {
@@ -569,7 +569,7 @@ static ssize_t store_pwm_ac(struct device *dev,
static ssize_t show_pwm_enable(struct device *dev,
			       struct device_attribute *attr, char *buf)
{
	SETUP_SHOW_data_param(dev, attr);
	SETUP_SHOW_DATA_PARAM(dev, attr);
	u8 config, altbit, minoff, val, newval;

	mutex_lock(&data->update_lock);
@@ -599,7 +599,7 @@ static ssize_t store_pwm_enable(struct device *dev,
				struct device_attribute *attr,
				const char *buf, size_t count)
{
	SETUP_STORE_data_param(dev, attr);
	SETUP_STORE_DATA_PARAM(dev, attr);
	long reqval;
	u8 currval, config, altbit, newval, minoff = 255;

@@ -659,7 +659,7 @@ static u32 asc7621_pwm_freq_map[] = {
static ssize_t show_pwm_freq(struct device *dev,
			     struct device_attribute *attr, char *buf)
{
	SETUP_SHOW_data_param(dev, attr);
	SETUP_SHOW_DATA_PARAM(dev, attr);
	u8 regval =
	    (data->reg[param->msb[0]] >> param->shift[0]) & param->mask[0];

@@ -672,7 +672,7 @@ static ssize_t store_pwm_freq(struct device *dev,
			      struct device_attribute *attr,
			      const char *buf, size_t count)
{
	SETUP_STORE_data_param(dev, attr);
	SETUP_STORE_DATA_PARAM(dev, attr);
	unsigned long reqval;
	u8 currval, newval = 255;
	int i;
@@ -707,7 +707,7 @@ static u32 asc7621_pwm_auto_spinup_map[] = {
static ssize_t show_pwm_ast(struct device *dev,
			    struct device_attribute *attr, char *buf)
{
	SETUP_SHOW_data_param(dev, attr);
	SETUP_SHOW_DATA_PARAM(dev, attr);
	u8 regval =
	    (data->reg[param->msb[0]] >> param->shift[0]) & param->mask[0];

@@ -721,7 +721,7 @@ static ssize_t store_pwm_ast(struct device *dev,
			     struct device_attribute *attr,
			     const char *buf, size_t count)
{
	SETUP_STORE_data_param(dev, attr);
	SETUP_STORE_DATA_PARAM(dev, attr);
	long reqval;
	u8 currval, newval = 255;
	u32 i;
@@ -756,7 +756,7 @@ static u32 asc7621_temp_smoothing_time_map[] = {
static ssize_t show_temp_st(struct device *dev,
			    struct device_attribute *attr, char *buf)
{
	SETUP_SHOW_data_param(dev, attr);
	SETUP_SHOW_DATA_PARAM(dev, attr);
	u8 regval =
	    (data->reg[param->msb[0]] >> param->shift[0]) & param->mask[0];
	regval = clamp_val(regval, 0, 7);
@@ -768,7 +768,7 @@ static ssize_t store_temp_st(struct device *dev,
			     struct device_attribute *attr,
			     const char *buf, size_t count)
{
	SETUP_STORE_data_param(dev, attr);
	SETUP_STORE_DATA_PARAM(dev, attr);
	long reqval;
	u8 currval, newval = 255;
	u32 i;
+7 −7
Original line number Diff line number Diff line
@@ -43,19 +43,19 @@ static const char * const input_names[] = {
};

/* Conversion function for VDDOUT and VBAT */
static inline int volt_reg_to_mV(int value)
static inline int volt_reg_to_mv(int value)
{
	return DIV_ROUND_CLOSEST(value * 1000, 512) + 2500;
}

/* Conversion function for ADC channels 4, 5 and 6 */
static inline int input_reg_to_mV(int value)
static inline int input_reg_to_mv(int value)
{
	return DIV_ROUND_CLOSEST(value * 2500, 1023);
}

/* Conversion function for VBBAT */
static inline int vbbat_reg_to_mV(int value)
static inline int vbbat_reg_to_mv(int value)
{
	return DIV_ROUND_CLOSEST(value * 2500, 512);
}
@@ -96,7 +96,7 @@ static ssize_t da9052_read_vddout(struct device *dev,
		goto hwmon_err;

	mutex_unlock(&hwmon->hwmon_lock);
	return sprintf(buf, "%d\n", volt_reg_to_mV(vdd));
	return sprintf(buf, "%d\n", volt_reg_to_mv(vdd));

hwmon_err_release:
	da9052_disable_vddout_channel(hwmon->da9052);
@@ -137,7 +137,7 @@ static ssize_t da9052_read_vbat(struct device *dev,
	if (ret < 0)
		return ret;

	return sprintf(buf, "%d\n", volt_reg_to_mV(ret));
	return sprintf(buf, "%d\n", volt_reg_to_mv(ret));
}

static ssize_t da9052_read_misc_channel(struct device *dev,
@@ -152,7 +152,7 @@ static ssize_t da9052_read_misc_channel(struct device *dev,
	if (ret < 0)
		return ret;

	return sprintf(buf, "%d\n", input_reg_to_mV(ret));
	return sprintf(buf, "%d\n", input_reg_to_mv(ret));
}

static ssize_t da9052_read_tjunc(struct device *dev,
@@ -187,7 +187,7 @@ static ssize_t da9052_read_vbbat(struct device *dev,
	if (ret < 0)
		return ret;

	return sprintf(buf, "%d\n", vbbat_reg_to_mV(ret));
	return sprintf(buf, "%d\n", vbbat_reg_to_mv(ret));
}

static ssize_t da9052_hwmon_show_name(struct device *dev,
+2 −2
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ static irqreturn_t da9055_auxadc_irq(int irq, void *irq_data)
}

/* Conversion function for VSYS and ADCINx */
static inline int volt_reg_to_mV(int value, int channel)
static inline int volt_reg_to_mv(int value, int channel)
{
	if (channel == DA9055_ADC_VSYS)
		return DIV_ROUND_CLOSEST(value * 1000, DA9055_VSYS_DIV) + 2500;
@@ -168,7 +168,7 @@ static ssize_t da9055_read_auto_ch(struct device *dev,

	mutex_unlock(&hwmon->hwmon_lock);

	return sprintf(buf, "%d\n", volt_reg_to_mV(adc, channel));
	return sprintf(buf, "%d\n", volt_reg_to_mv(adc, channel));

hwmon_err_release:
	da9055_disable_auto_mode(hwmon->da9055, channel);
+12 −12
Original line number Diff line number Diff line
@@ -1778,7 +1778,7 @@ static int __init it87_find(unsigned short *address,
		superio_select(5);
		sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f;
	} else if (sio_data->type == it8783) {
		int reg25, reg27, reg2A, reg2C, regEF;
		int reg25, reg27, reg2a, reg2c, regef;

		sio_data->skip_vid = 1;	/* No VID */

@@ -1786,15 +1786,15 @@ static int __init it87_find(unsigned short *address,

		reg25 = superio_inb(IT87_SIO_GPIO1_REG);
		reg27 = superio_inb(IT87_SIO_GPIO3_REG);
		reg2A = superio_inb(IT87_SIO_PINX1_REG);
		reg2C = superio_inb(IT87_SIO_PINX2_REG);
		regEF = superio_inb(IT87_SIO_SPI_REG);
		reg2a = superio_inb(IT87_SIO_PINX1_REG);
		reg2c = superio_inb(IT87_SIO_PINX2_REG);
		regef = superio_inb(IT87_SIO_SPI_REG);

		/* Check if fan3 is there or not */
		if ((reg27 & (1 << 0)) || !(reg2C & (1 << 2)))
		if ((reg27 & (1 << 0)) || !(reg2c & (1 << 2)))
			sio_data->skip_fan |= (1 << 2);
		if ((reg25 & (1 << 4))
		    || (!(reg2A & (1 << 1)) && (regEF & (1 << 0))))
		    || (!(reg2a & (1 << 1)) && (regef & (1 << 0))))
			sio_data->skip_pwm |= (1 << 2);

		/* Check if fan2 is there or not */
@@ -1804,7 +1804,7 @@ static int __init it87_find(unsigned short *address,
			sio_data->skip_pwm |= (1 << 1);

		/* VIN5 */
		if ((reg27 & (1 << 0)) || (reg2C & (1 << 2)))
		if ((reg27 & (1 << 0)) || (reg2c & (1 << 2)))
			sio_data->skip_in |= (1 << 5); /* No VIN5 */

		/* VIN6 */
@@ -1829,18 +1829,18 @@ static int __init it87_find(unsigned short *address,
			 * not the case, and ask the user to report if the
			 * resulting voltage is sane.
			 */
			if (!(reg2C & (1 << 1))) {
				reg2C |= (1 << 1);
				superio_outb(IT87_SIO_PINX2_REG, reg2C);
			if (!(reg2c & (1 << 1))) {
				reg2c |= (1 << 1);
				superio_outb(IT87_SIO_PINX2_REG, reg2c);
				pr_notice("Routing internal VCCH5V to in7.\n");
			}
			pr_notice("in7 routed to internal voltage divider, with external pin disabled.\n");
			pr_notice("Please report if it displays a reasonable voltage.\n");
		}

		if (reg2C & (1 << 0))
		if (reg2c & (1 << 0))
			sio_data->internal |= (1 << 0);
		if (reg2C & (1 << 1))
		if (reg2c & (1 << 1))
			sio_data->internal |= (1 << 1);

		sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f;
Loading