2016-12-25 19:42:05

by Scott Matheina

[permalink] [raw]
Subject: [PATCHv4 0/8] Checkpatch fixes to driver/staging/iio/addac

*** BLURB HERE ***

Scott Matheina (8):
fixed long description text exceeding 80 characters
Fixed variables not being consistently lower case
Fix camel case issues
Fix braces not present on all arms of if else statement
Remove line after closing braces
Fixed code wrap alignment with preceding (.
Changed code to align with coding style of using octat
Fixes style issues due to mis-aligned carry over lines

drivers/staging/iio/addac/adt7316.c | 850 +++++++++++++++++-------------------
1 file changed, 397 insertions(+), 453 deletions(-)

--
2.7.4


2016-12-25 19:42:18

by Scott Matheina

[permalink] [raw]
Subject: [PATCHv4 1/8] fixed long description text exceeding 80 characters

The description was split into 2 lines due to the line greatly
exceeding the 80 character soft limit.

Signed-off-by: Scott Matheina <[email protected]>
---
drivers/staging/iio/addac/adt7316.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c
index a7d90c8..08413a8 100644
--- a/drivers/staging/iio/addac/adt7316.c
+++ b/drivers/staging/iio/addac/adt7316.c
@@ -2181,5 +2181,6 @@ int adt7316_probe(struct device *dev, struct adt7316_bus *bus,
EXPORT_SYMBOL(adt7316_probe);

MODULE_AUTHOR("Sonic Zhang <[email protected]>");
-MODULE_DESCRIPTION("Analog Devices ADT7316/7/8 and ADT7516/7/9 digital temperature sensor, ADC and DAC driver");
+MODULE_DESCRIPTION("Analog Devices ADT7316/7/8 and ADT7516/7/9 digital\n"
+ "temperature sensor, ADC and DAC driver");
MODULE_LICENSE("GPL v2");
--
2.7.4

2016-12-25 19:42:27

by Scott Matheina

[permalink] [raw]
Subject: [PATCHv4 2/8] Fixed variables not being consistently lower case

Across the file, variables were sometimes upper case, some times
lower case, this fix addresses a few of the instances with this
inconsistency.

Signed-off-by: Scott Matheina <[email protected]>
---
drivers/staging/iio/addac/adt7316.c | 48 ++++++++++++++++++-------------------
1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c
index 08413a8..13d9ed2 100644
--- a/drivers/staging/iio/addac/adt7316.c
+++ b/drivers/staging/iio/addac/adt7316.c
@@ -1755,55 +1755,55 @@ static irqreturn_t adt7316_event_handler(int irq, void *private)
time = iio_get_time_ns(indio_dev);
if (stat1 & BIT(0))
iio_push_event(indio_dev,
- IIO_UNMOD_EVENT_CODE(IIO_TEMP, 0,
- IIO_EV_TYPE_THRESH,
- IIO_EV_DIR_RISING),
+ iio_unmod_event_code(iio_temp, 0,
+ iio_ev_type_thresh,
+ iio_ev_dir_rising),
time);
if (stat1 & BIT(1))
iio_push_event(indio_dev,
- IIO_UNMOD_EVENT_CODE(IIO_TEMP, 0,
- IIO_EV_TYPE_THRESH,
- IIO_EV_DIR_FALLING),
+ iio_unmod_event_code(iio_temp, 0,
+ iio_ev_type_thresh,
+ iio_ev_dir_falling),
time);
if (stat1 & BIT(2))
iio_push_event(indio_dev,
- IIO_UNMOD_EVENT_CODE(IIO_TEMP, 1,
- IIO_EV_TYPE_THRESH,
- IIO_EV_DIR_RISING),
+ iio_unmod_event_code(iio_temp, 1,
+ iio_ev_type_thresh,
+ iio_ev_dir_rising),
time);
if (stat1 & BIT(3))
iio_push_event(indio_dev,
- IIO_UNMOD_EVENT_CODE(IIO_TEMP, 1,
- IIO_EV_TYPE_THRESH,
- IIO_EV_DIR_FALLING),
+ iio_unmod_event_code(iio_temp, 1,
+ iio_ev_type_thresh,
+ iio_ev_dir_falling),
time);
if (stat1 & BIT(5))
iio_push_event(indio_dev,
- IIO_UNMOD_EVENT_CODE(IIO_VOLTAGE, 1,
- IIO_EV_TYPE_THRESH,
- IIO_EV_DIR_EITHER),
+ iio_unmod_event_code(iio_voltage, 1,
+ iio_ev_type_thresh,
+ iio_ev_dir_either),
time);
if (stat1 & BIT(6))
iio_push_event(indio_dev,
- IIO_UNMOD_EVENT_CODE(IIO_VOLTAGE, 2,
- IIO_EV_TYPE_THRESH,
- IIO_EV_DIR_EITHER),
+ iio_unmod_event_code(iio_voltage, 2,
+ iio_ev_type_thresh,
+ iio_ev_dir_either),
time);
if (stat1 & BIT(7))
iio_push_event(indio_dev,
- IIO_UNMOD_EVENT_CODE(IIO_VOLTAGE, 3,
- IIO_EV_TYPE_THRESH,
- IIO_EV_DIR_EITHER),
+ iio_unmod_event_code(iio_voltage, 3,
+ iio_ev_type_thresh,
+ iio_ev_dir_either),
time);
}
ret = chip->bus.read(chip->bus.client, ADT7316_INT_STAT2, &stat2);
if (!ret) {
if (stat2 & ADT7316_INT_MASK2_VDD)
iio_push_event(indio_dev,
- IIO_UNMOD_EVENT_CODE(IIO_VOLTAGE,
+ iio_unmod_event_code(iio_voltage,
0,
- IIO_EV_TYPE_THRESH,
- IIO_EV_DIR_RISING),
+ iio_ev_type_thresh,
+ iio_ev_dir_rising),
iio_get_time_ns(indio_dev));
}

--
2.7.4

2016-12-25 19:42:39

by Scott Matheina

[permalink] [raw]
Subject: [PATCHv4 5/8] Remove line after closing braces

There was an additional line which was un-needed, removed that line.

Signed-off-by: Scott Matheina <[email protected]>
---
drivers/staging/iio/addac/adt7316.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c
index e78d302..4678a64 100644
--- a/drivers/staging/iio/addac/adt7316.c
+++ b/drivers/staging/iio/addac/adt7316.c
@@ -434,7 +434,6 @@ static ssize_t adt7316_store_ad_channel(struct device *dev,
config2 = chip->config2 & (~ADT7316_AD_SINGLE_CH_MASK);
}

-
config2 |= data;

ret = chip->bus.write(chip->bus.client, ADT7316_CONFIG2, config2);
--
2.7.4

2016-12-25 19:42:30

by Scott Matheina

[permalink] [raw]
Subject: [PATCHv4 3/8] Fix camel case issues

Cases of camel case were fixed by making variables lower case throughout
the file.

Signed-off-by: Scott Matheina <[email protected]>
---
drivers/staging/iio/addac/adt7316.c | 82 ++++++++++++++++++-------------------
1 file changed, 41 insertions(+), 41 deletions(-)

diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c
index 13d9ed2..2b584a0 100644
--- a/drivers/staging/iio/addac/adt7316.c
+++ b/drivers/staging/iio/addac/adt7316.c
@@ -1485,7 +1485,7 @@ static ssize_t adt7316_show_DAC_A(struct device *dev,
struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7316_chip_info *chip = iio_priv(dev_info);

- return adt7316_show_DAC(chip, 0, buf);
+ return adt7316_show_dac(chip, 0, buf);
}

static ssize_t adt7316_store_DAC_A(struct device *dev,
@@ -1496,7 +1496,7 @@ static ssize_t adt7316_store_DAC_A(struct device *dev,
struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7316_chip_info *chip = iio_priv(dev_info);

- return adt7316_store_DAC(chip, 0, buf, len);
+ return adt7316_store_dac(chip, 0, buf, len);
}

static IIO_DEVICE_ATTR(DAC_A, S_IRUGO | S_IWUSR, adt7316_show_DAC_A,
@@ -1509,7 +1509,7 @@ static ssize_t adt7316_show_DAC_B(struct device *dev,
struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7316_chip_info *chip = iio_priv(dev_info);

- return adt7316_show_DAC(chip, 1, buf);
+ return adt7316_show_dac(chip, 1, buf);
}

static ssize_t adt7316_store_DAC_B(struct device *dev,
@@ -1520,7 +1520,7 @@ static ssize_t adt7316_store_DAC_B(struct device *dev,
struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7316_chip_info *chip = iio_priv(dev_info);

- return adt7316_store_DAC(chip, 1, buf, len);
+ return adt7316_store_dac(chip, 1, buf, len);
}

static IIO_DEVICE_ATTR(DAC_B, S_IRUGO | S_IWUSR, adt7316_show_DAC_B,
@@ -1533,7 +1533,7 @@ static ssize_t adt7316_show_DAC_C(struct device *dev,
struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7316_chip_info *chip = iio_priv(dev_info);

- return adt7316_show_DAC(chip, 2, buf);
+ return adt7316_show_dac(chip, 2, buf);
}

static ssize_t adt7316_store_DAC_C(struct device *dev,
@@ -1544,7 +1544,7 @@ static ssize_t adt7316_store_DAC_C(struct device *dev,
struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7316_chip_info *chip = iio_priv(dev_info);

- return adt7316_store_DAC(chip, 2, buf, len);
+ return adt7316_store_dac(chip, 2, buf, len);
}

static IIO_DEVICE_ATTR(DAC_C, S_IRUGO | S_IWUSR, adt7316_show_DAC_C,
@@ -1557,7 +1557,7 @@ static ssize_t adt7316_show_DAC_D(struct device *dev,
struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7316_chip_info *chip = iio_priv(dev_info);

- return adt7316_show_DAC(chip, 3, buf);
+ return adt7316_show_dac(chip, 3, buf);
}

static ssize_t adt7316_store_DAC_D(struct device *dev,
@@ -1568,7 +1568,7 @@ static ssize_t adt7316_store_DAC_D(struct device *dev,
struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7316_chip_info *chip = iio_priv(dev_info);

- return adt7316_store_DAC(chip, 3, buf, len);
+ return adt7316_store_dac(chip, 3, buf, len);
}

static IIO_DEVICE_ATTR(DAC_D, S_IRUGO | S_IWUSR, adt7316_show_DAC_D,
@@ -1661,26 +1661,26 @@ static struct attribute *adt7316_attributes[] = {
&iio_dev_attr_powerdown.dev_attr.attr,
&iio_dev_attr_fast_ad_clock.dev_attr.attr,
&iio_dev_attr_da_high_resolution.dev_attr.attr,
- &iio_dev_attr_enable_proportion_DACA.dev_attr.attr,
- &iio_dev_attr_enable_proportion_DACB.dev_attr.attr,
- &iio_dev_attr_DAC_2Vref_channels_mask.dev_attr.attr,
- &iio_dev_attr_DAC_update_mode.dev_attr.attr,
- &iio_dev_attr_all_DAC_update_modes.dev_attr.attr,
- &iio_dev_attr_update_DAC.dev_attr.attr,
- &iio_dev_attr_DA_AB_Vref_bypass.dev_attr.attr,
- &iio_dev_attr_DA_CD_Vref_bypass.dev_attr.attr,
- &iio_dev_attr_DAC_internal_Vref.dev_attr.attr,
- &iio_dev_attr_VDD.dev_attr.attr,
+ &iio_dev_attr_enable_proportion_daca.dev_attr.attr,
+ &iio_dev_attr_enable_proportion_dacb.dev_attr.attr,
+ &iio_dev_attr_dac_2vref_channels_mask.dev_attr.attr,
+ &iio_dev_attr_dac_internal_vref.dev_attr.attr,
+ &iio_dev_attr_all_dac_update_modes.dev_attr.attr,
+ &iio_dev_attr_update_dac.dev_attr.attr,
+ &iio_dev_attr_da_ab_vref_bypass.dev_attr.attr,
+ &iio_dev_attr_da_cd_vref_bypass.dev_attr.attr,
+ &iio_dev_attr_dac_internal_vref.dev_attr.attr,
+ &iio_dev_attr_vdd.dev_attr.attr,
&iio_dev_attr_in_temp.dev_attr.attr,
&iio_dev_attr_ex_temp.dev_attr.attr,
&iio_dev_attr_in_temp_offset.dev_attr.attr,
&iio_dev_attr_ex_temp_offset.dev_attr.attr,
&iio_dev_attr_in_analog_temp_offset.dev_attr.attr,
&iio_dev_attr_ex_analog_temp_offset.dev_attr.attr,
- &iio_dev_attr_DAC_A.dev_attr.attr,
- &iio_dev_attr_DAC_B.dev_attr.attr,
- &iio_dev_attr_DAC_C.dev_attr.attr,
- &iio_dev_attr_DAC_D.dev_attr.attr,
+ &iio_dev_attr_dac_a.dev_attr.attr,
+ &iio_dev_attr_dac_b.dev_attr.attr,
+ &iio_dev_attr_dac_c.dev_attr.attr,
+ &iio_dev_attr_dac_d.dev_attr.attr,
&iio_dev_attr_device_id.dev_attr.attr,
&iio_dev_attr_manufactorer_id.dev_attr.attr,
&iio_dev_attr_device_rev.dev_attr.attr,
@@ -1703,31 +1703,31 @@ static struct attribute *adt7516_attributes[] = {
&iio_dev_attr_enable_smbus_timeout.dev_attr.attr,
&iio_dev_attr_powerdown.dev_attr.attr,
&iio_dev_attr_fast_ad_clock.dev_attr.attr,
- &iio_dev_attr_AIN_internal_Vref.dev_attr.attr,
+ &iio_dev_attr_ain_internal_vref.dev_attr.attr,
&iio_dev_attr_da_high_resolution.dev_attr.attr,
- &iio_dev_attr_enable_proportion_DACA.dev_attr.attr,
- &iio_dev_attr_enable_proportion_DACB.dev_attr.attr,
- &iio_dev_attr_DAC_2Vref_channels_mask.dev_attr.attr,
- &iio_dev_attr_DAC_update_mode.dev_attr.attr,
- &iio_dev_attr_all_DAC_update_modes.dev_attr.attr,
- &iio_dev_attr_update_DAC.dev_attr.attr,
- &iio_dev_attr_DA_AB_Vref_bypass.dev_attr.attr,
- &iio_dev_attr_DA_CD_Vref_bypass.dev_attr.attr,
- &iio_dev_attr_DAC_internal_Vref.dev_attr.attr,
- &iio_dev_attr_VDD.dev_attr.attr,
+ &iio_dev_attr_enable_proportion_daca.dev_attr.attr,
+ &iio_dev_attr_enable_proportion_dacb.dev_attr.attr,
+ &iio_dev_attr_dac_2vref_channels_mask.dev_attr.attr,
+ &iio_dev_attr_dac_update_mode.dev_attr.attr,
+ &iio_dev_attr_all_dac_update_modes.dev_attr.attr,
+ &iio_dev_attr_update_dac.dev_attr.attr,
+ &iio_dev_attr_da_ab_vref_bypass.dev_attr.attr,
+ &iio_dev_attr_da_cd_vref_bypass.dev_attr.attr,
+ &iio_dev_attr_dac_internal_vref.dev_attr.attr,
+ &iio_dev_attr_vdd.dev_attr.attr,
&iio_dev_attr_in_temp.dev_attr.attr,
- &iio_dev_attr_ex_temp_AIN1.dev_attr.attr,
- &iio_dev_attr_AIN2.dev_attr.attr,
- &iio_dev_attr_AIN3.dev_attr.attr,
- &iio_dev_attr_AIN4.dev_attr.attr,
+ &iio_dev_attr_ex_temp_ain1.dev_attr.attr,
+ &iio_dev_attr_ain2.dev_attr.attr,
+ &iio_dev_attr_ain3.dev_attr.attr,
+ &iio_dev_attr_ain4.dev_attr.attr,
&iio_dev_attr_in_temp_offset.dev_attr.attr,
&iio_dev_attr_ex_temp_offset.dev_attr.attr,
&iio_dev_attr_in_analog_temp_offset.dev_attr.attr,
&iio_dev_attr_ex_analog_temp_offset.dev_attr.attr,
- &iio_dev_attr_DAC_A.dev_attr.attr,
- &iio_dev_attr_DAC_B.dev_attr.attr,
- &iio_dev_attr_DAC_C.dev_attr.attr,
- &iio_dev_attr_DAC_D.dev_attr.attr,
+ &iio_dev_attr_dac_a.dev_attr.attr,
+ &iio_dev_attr_dac_b.dev_attr.attr,
+ &iio_dev_attr_dac_c.dev_attr.attr,
+ &iio_dev_attr_dac_d.dev_attr.attr,
&iio_dev_attr_device_id.dev_attr.attr,
&iio_dev_attr_manufactorer_id.dev_attr.attr,
&iio_dev_attr_device_rev.dev_attr.attr,
--
2.7.4

2016-12-25 19:42:43

by Scott Matheina

[permalink] [raw]
Subject: [PATCHv4 4/8] Fix braces not present on all arms of if else statement

Adds braces to second arm of if else statement.

Signed-off-by: Scott Matheina <[email protected]>
---
drivers/staging/iio/addac/adt7316.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c
index 2b584a0..e78d302 100644
--- a/drivers/staging/iio/addac/adt7316.c
+++ b/drivers/staging/iio/addac/adt7316.c
@@ -661,8 +661,9 @@ static ssize_t adt7316_store_da_high_resolution(struct device *dev,
chip->dac_bits = 12;
else if (chip->id == ID_ADT7317 || chip->id == ID_ADT7517)
chip->dac_bits = 10;
- } else
+ } else {
config3 = chip->config3 & (~ADT7316_DA_HIGH_RESOLUTION);
+ }

ret = chip->bus.write(chip->bus.client, ADT7316_CONFIG3, config3);
if (ret)
--
2.7.4

2016-12-25 19:43:02

by Scott Matheina

[permalink] [raw]
Subject: [PATCHv4 7/8] Changed code to align with coding style of using octat

The permmission code was changed to reflect octat (0644/0444) for required permissions.

Signed-off-by: Scott Matheina <[email protected]>
---
drivers/staging/iio/addac/adt7316.c | 264 ++++++++++++++----------------------
1 file changed, 101 insertions(+), 163 deletions(-)

diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c
index 91ac222..e8e58d5 100644
--- a/drivers/staging/iio/addac/adt7316.c
+++ b/drivers/staging/iio/addac/adt7316.c
@@ -267,10 +267,8 @@ static ssize_t adt7316_store_enabled(struct device *dev,
return len;
}

-static IIO_DEVICE_ATTR(enabled, S_IRUGO | S_IWUSR,
- adt7316_show_enabled,
- adt7316_store_enabled,
- 0);
+static iio_device_attr(enabled, 0644, adt7316_show_enabled,
+ adt7316_store_enabled, 0);

static ssize_t adt7316_show_select_ex_temp(struct device *dev,
struct device_attribute *attr,
@@ -311,10 +309,8 @@ static ssize_t adt7316_store_select_ex_temp(struct device *dev,
return len;
}

-static IIO_DEVICE_ATTR(select_ex_temp, S_IRUGO | S_IWUSR,
- adt7316_show_select_ex_temp,
- adt7316_store_select_ex_temp,
- 0);
+static iio_device_attr(select_ex_temp, 0644, adt7316_show_select_ex_temp,
+ adt7316_store_select_ex_temp, 0);

static ssize_t adt7316_show_mode(struct device *dev,
struct device_attribute *attr,
@@ -352,10 +348,7 @@ static ssize_t adt7316_store_mode(struct device *dev,
return len;
}

-static IIO_DEVICE_ATTR(mode, S_IRUGO | S_IWUSR,
- adt7316_show_mode,
- adt7316_store_mode,
- 0);
+static iio_device_attr(mode, 0644, adt7316_show_mode, adt7316_store_mode, 0);

static ssize_t adt7316_show_all_modes(struct device *dev,
struct device_attribute *attr,
@@ -364,7 +357,7 @@ static ssize_t adt7316_show_all_modes(struct device *dev,
return sprintf(buf, "single_channel\nround_robin\n");
}

-static IIO_DEVICE_ATTR(all_modes, S_IRUGO, adt7316_show_all_modes, NULL, 0);
+static iio_device_attr(all_modes, 0444, adt7316_show_all_modes, NULL, 0);

static ssize_t adt7316_show_ad_channel(struct device *dev,
struct device_attribute *attr,
@@ -445,10 +438,8 @@ static ssize_t adt7316_store_ad_channel(struct device *dev,
return len;
}

-static IIO_DEVICE_ATTR(ad_channel, S_IRUGO | S_IWUSR,
- adt7316_show_ad_channel,
- adt7316_store_ad_channel,
- 0);
+static iio_device_attr(ad_channel, 0644, adt7316_show_ad_channel,
+ adt7316_store_ad_channel, 0);

static ssize_t adt7316_show_all_ad_channels(struct device *dev,
struct device_attribute *attr,
@@ -468,8 +459,8 @@ static ssize_t adt7316_show_all_ad_channels(struct device *dev,
"2 - External Temperature\n");
}

-static IIO_DEVICE_ATTR(all_ad_channels, S_IRUGO,
- adt7316_show_all_ad_channels, NULL, 0);
+static iio_device_attr(all_ad_channels, 0444, adt7316_show_all_ad_channels,
+ NULL, 0);

static ssize_t adt7316_show_disable_averaging(struct device *dev,
struct device_attribute *attr,
@@ -505,10 +496,8 @@ static ssize_t adt7316_store_disable_averaging(struct device *dev,
return len;
}

-static IIO_DEVICE_ATTR(disable_averaging, S_IRUGO | S_IWUSR,
- adt7316_show_disable_averaging,
- adt7316_store_disable_averaging,
- 0);
+static iio_device_attr(disable_averaging, 0644, adt7316_show_disable_averaging,
+ adt7316_store_disable_averaging, 0);

static ssize_t adt7316_show_enable_smbus_timeout(struct device *dev,
struct device_attribute *attr,
@@ -544,10 +533,9 @@ static ssize_t adt7316_store_enable_smbus_timeout(struct device *dev,
return len;
}

-static IIO_DEVICE_ATTR(enable_smbus_timeout, S_IRUGO | S_IWUSR,
- adt7316_show_enable_smbus_timeout,
- adt7316_store_enable_smbus_timeout,
- 0);
+static iio_device_attr(enable_smbus_timeout, 0644,
+ adt7316_show_enable_smbus_timeout,
+ adt7316_store_enable_smbus_timeout, 0);

static ssize_t adt7316_show_powerdown(struct device *dev,
struct device_attribute *attr,
@@ -582,10 +570,8 @@ static ssize_t adt7316_store_powerdown(struct device *dev,
return len;
}

-static IIO_DEVICE_ATTR(powerdown, S_IRUGO | S_IWUSR,
- adt7316_show_powerdown,
- adt7316_store_powerdown,
- 0);
+static iio_device_attr(powerdown, 0644, adt7316_show_powerdown,
+ adt7316_store_powerdown, 0);

static ssize_t adt7316_show_fast_ad_clock(struct device *dev,
struct device_attribute *attr,
@@ -620,10 +606,8 @@ static ssize_t adt7316_store_fast_ad_clock(struct device *dev,
return len;
}

-static IIO_DEVICE_ATTR(fast_ad_clock, S_IRUGO | S_IWUSR,
- adt7316_show_fast_ad_clock,
- adt7316_store_fast_ad_clock,
- 0);
+static iio_device_attr(fast_ad_clock, 0644, adt7316_show_fast_ad_clock,
+ adt7316_store_fast_ad_clock, 0);

static ssize_t adt7316_show_da_high_resolution(struct device *dev,
struct device_attribute *attr,
@@ -673,10 +657,9 @@ static ssize_t adt7316_store_da_high_resolution(struct device *dev,
return len;
}

-static IIO_DEVICE_ATTR(da_high_resolution, S_IRUGO | S_IWUSR,
- adt7316_show_da_high_resolution,
- adt7316_store_da_high_resolution,
- 0);
+static iio_device_attr(da_high_resolution, 0644,
+ adt7316_show_da_high_resolution,
+ adt7316_store_da_high_resolution, 0);

static ssize_t adt7316_show_AIN_internal_Vref(struct device *dev,
struct device_attribute *attr,
@@ -719,10 +702,9 @@ static ssize_t adt7316_store_AIN_internal_Vref(struct device *dev,
return len;
}

-static IIO_DEVICE_ATTR(AIN_internal_Vref, S_IRUGO | S_IWUSR,
- adt7316_show_AIN_internal_Vref,
- adt7316_store_AIN_internal_Vref,
- 0);
+static iio_device_attr(ain_internal_vref, 0644,
+ adt7316_show_ain_internal_vref,
+ adt7316_store_ain_internal_vref, 0);


static ssize_t adt7316_show_enable_prop_DACA(struct device *dev,
@@ -759,10 +741,9 @@ static ssize_t adt7316_store_enable_prop_DACA(struct device *dev,
return len;
}

-static IIO_DEVICE_ATTR(enable_proportion_DACA, S_IRUGO | S_IWUSR,
- adt7316_show_enable_prop_DACA,
- adt7316_store_enable_prop_DACA,
- 0);
+static iio_device_attr(enable_proportion_daca, 0644,
+ adt7316_show_enable_prop_daca,
+ adt7316_store_enable_prop_daca, 0);

static ssize_t adt7316_show_enable_prop_DACB(struct device *dev,
struct device_attribute *attr,
@@ -798,10 +779,9 @@ static ssize_t adt7316_store_enable_prop_DACB(struct device *dev,
return len;
}

-static IIO_DEVICE_ATTR(enable_proportion_DACB, S_IRUGO | S_IWUSR,
- adt7316_show_enable_prop_DACB,
- adt7316_store_enable_prop_DACB,
- 0);
+static iio_device_attr(enable_proportion_dacb, 0644,
+ adt7316_show_enable_prop_dacb,
+ adt7316_store_enable_prop_dacb, 0);

static ssize_t adt7316_show_DAC_2Vref_ch_mask(struct device *dev,
struct device_attribute *attr,
@@ -841,10 +821,9 @@ static ssize_t adt7316_store_DAC_2Vref_ch_mask(struct device *dev,
return len;
}

-static IIO_DEVICE_ATTR(DAC_2Vref_channels_mask, S_IRUGO | S_IWUSR,
- adt7316_show_DAC_2Vref_ch_mask,
- adt7316_store_DAC_2Vref_ch_mask,
- 0);
+static iio_device_attr(dac_2vref_channels_mask, 0644,
+ adt7316_show_dac_2vref_ch_mask,
+ adt7316_store_dac_2vref_ch_mask, 0);

static ssize_t adt7316_show_DAC_update_mode(struct device *dev,
struct device_attribute *attr,
@@ -901,10 +880,8 @@ static ssize_t adt7316_store_DAC_update_mode(struct device *dev,
return len;
}

-static IIO_DEVICE_ATTR(DAC_update_mode, S_IRUGO | S_IWUSR,
- adt7316_show_DAC_update_mode,
- adt7316_store_DAC_update_mode,
- 0);
+static iio_device_attr(DAC_update_mode, 0644, adt7316_show_dac_update_mode,
+ adt7316_store_dac_update_mode, 0);

static ssize_t adt7316_show_all_DAC_update_modes(struct device *dev,
struct device_attribute *attr,
@@ -921,9 +898,8 @@ static ssize_t adt7316_show_all_DAC_update_modes(struct device *dev,
return sprintf(buf, "manual\n");
}

-static IIO_DEVICE_ATTR(all_DAC_update_modes, S_IRUGO,
- adt7316_show_all_DAC_update_modes, NULL, 0);
-
+static iio_device_attr(all_dac_update_modes, 0444,
+ adt7316_show_all_dac_update_modes, NULL, 0);

static ssize_t adt7316_store_update_DAC(struct device *dev,
struct device_attribute *attr,
@@ -960,10 +936,7 @@ static ssize_t adt7316_store_update_DAC(struct device *dev,
return len;
}

-static IIO_DEVICE_ATTR(update_DAC, S_IRUGO | S_IWUSR,
- NULL,
- adt7316_store_update_DAC,
- 0);
+static iio_device_attr(update_dac, 0644, NULL, adt7316_store_update_dac, 0);

static ssize_t adt7316_show_DA_AB_Vref_bypass(struct device *dev,
struct device_attribute *attr,
@@ -1005,10 +978,8 @@ static ssize_t adt7316_store_DA_AB_Vref_bypass(struct device *dev,
return len;
}

-static IIO_DEVICE_ATTR(DA_AB_Vref_bypass, S_IRUGO | S_IWUSR,
- adt7316_show_DA_AB_Vref_bypass,
- adt7316_store_DA_AB_Vref_bypass,
- 0);
+static iio_device_attr(da_ab_vref_bypass, 0644, adt7316_show_da_ab_vref_bypass,
+ adt7316_store_da_ab_vref_bypass, 0);

static ssize_t adt7316_show_DA_CD_Vref_bypass(struct device *dev,
struct device_attribute *attr,
@@ -1050,10 +1021,8 @@ static ssize_t adt7316_store_DA_CD_Vref_bypass(struct device *dev,
return len;
}

-static IIO_DEVICE_ATTR(DA_CD_Vref_bypass, S_IRUGO | S_IWUSR,
- adt7316_show_DA_CD_Vref_bypass,
- adt7316_store_DA_CD_Vref_bypass,
- 0);
+static iio_device_attr(da_cd_vref_bypass, 0644, adt7316_show_da_cd_vref_bypass,
+ adt7316_store_da_cd_vref_bypass, 0);

static ssize_t adt7316_show_DAC_internal_Vref(struct device *dev,
struct device_attribute *attr,
@@ -1111,10 +1080,8 @@ static ssize_t adt7316_store_DAC_internal_Vref(struct device *dev,
return len;
}

-static IIO_DEVICE_ATTR(DAC_internal_Vref, S_IRUGO | S_IWUSR,
- adt7316_show_DAC_internal_Vref,
- adt7316_store_DAC_internal_Vref,
- 0);
+static iio_device_attr(dac_internal_vref, 0644, adt7316_show_dac_internal_vref,
+ adt7316_store_dac_internal_vref, 0);

static ssize_t adt7316_show_ad(struct adt7316_chip_info *chip,
int channel, char *buf)
@@ -1200,7 +1167,8 @@ static ssize_t adt7316_show_VDD(struct device *dev,

return adt7316_show_ad(chip, ADT7316_AD_SINGLE_CH_VDD, buf);
}
-static IIO_DEVICE_ATTR(VDD, S_IRUGO, adt7316_show_VDD, NULL, 0);
+
+static iio_device_attr(VDD, 0444, adt7316_show_VDD, NULL, 0);

static ssize_t adt7316_show_in_temp(struct device *dev,
struct device_attribute *attr,
@@ -1212,7 +1180,7 @@ static ssize_t adt7316_show_in_temp(struct device *dev,
return adt7316_show_ad(chip, ADT7316_AD_SINGLE_CH_IN, buf);
}

-static IIO_DEVICE_ATTR(in_temp, S_IRUGO, adt7316_show_in_temp, NULL, 0);
+static iio_device_attr(in_temp, 0444, adt7316_show_in_temp, NULL, 0);

static ssize_t adt7316_show_ex_temp_AIN1(struct device *dev,
struct device_attribute *attr,
@@ -1224,9 +1192,9 @@ static ssize_t adt7316_show_ex_temp_AIN1(struct device *dev,
return adt7316_show_ad(chip, ADT7316_AD_SINGLE_CH_EX, buf);
}

-static IIO_DEVICE_ATTR(ex_temp_AIN1, S_IRUGO, adt7316_show_ex_temp_AIN1,
- NULL, 0);
-static IIO_DEVICE_ATTR(ex_temp, S_IRUGO, adt7316_show_ex_temp_AIN1, NULL, 0);
+static iio_device_attr(ex_temp_ain1, 0444, adt7316_show_ex_temp_ain1, NULL, 0);
+
+static iio_device_attr(ex_temp, 0444, adt7316_show_ex_temp_ain1, NULL, 0);

static ssize_t adt7316_show_AIN2(struct device *dev,
struct device_attribute *attr,
@@ -1237,29 +1205,32 @@ static ssize_t adt7316_show_AIN2(struct device *dev,

return adt7316_show_ad(chip, ADT7516_AD_SINGLE_CH_AIN2, buf);
}
-static IIO_DEVICE_ATTR(AIN2, S_IRUGO, adt7316_show_AIN2, NULL, 0);

-static ssize_t adt7316_show_AIN3(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static iio_device_attr(ain2, 0444, adt7316_show_AIN2, NULL, 0);
+
+static ssize_t adt7316_show_ain3(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
{
struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7316_chip_info *chip = iio_priv(dev_info);

return adt7316_show_ad(chip, ADT7516_AD_SINGLE_CH_AIN3, buf);
}
-static IIO_DEVICE_ATTR(AIN3, S_IRUGO, adt7316_show_AIN3, NULL, 0);

-static ssize_t adt7316_show_AIN4(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static iio_device_attr(ain3, 0444, adt7316_show_ain3, NULL, 0);
+
+static ssize_t adt7316_show_ain4(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
{
struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7316_chip_info *chip = iio_priv(dev_info);

return adt7316_show_ad(chip, ADT7516_AD_SINGLE_CH_AIN4, buf);
}
-static IIO_DEVICE_ATTR(AIN4, S_IRUGO, adt7316_show_AIN4, NULL, 0);
+
+static iio_device_attr(ain4, 0444, adt7316_show_ain4, NULL, 0);

static ssize_t adt7316_show_temp_offset(struct adt7316_chip_info *chip,
int offset_addr, char *buf)
@@ -1324,9 +1295,8 @@ static ssize_t adt7316_store_in_temp_offset(struct device *dev,
len);
}

-static IIO_DEVICE_ATTR(in_temp_offset, S_IRUGO | S_IWUSR,
- adt7316_show_in_temp_offset,
- adt7316_store_in_temp_offset, 0);
+static iio_device_attr(in_temp_offset, 0644, adt7316_show_in_temp_offset,
+ adt7316_store_in_temp_offset, 0);

static ssize_t adt7316_show_ex_temp_offset(struct device *dev,
struct device_attribute *attr,
@@ -1404,7 +1374,7 @@ static ssize_t adt7316_store_ex_analog_temp_offset(struct device *dev,
ADT7316_EX_ANALOG_TEMP_OFFSET, buf, len);
}

-static IIO_DEVICE_ATTR(ex_analog_temp_offset, S_IRUGO | S_IWUSR,
+static iio_device_attr(ex_analog_temp_offset, 0644,
adt7316_show_ex_analog_temp_offset,
adt7316_store_ex_analog_temp_offset, 0);

@@ -1499,8 +1469,7 @@ static ssize_t adt7316_store_DAC_A(struct device *dev,
return adt7316_store_dac(chip, 0, buf, len);
}

-static IIO_DEVICE_ATTR(DAC_A, S_IRUGO | S_IWUSR, adt7316_show_DAC_A,
- adt7316_store_DAC_A, 0);
+static iio_device_attr(dac_a, 0644, adt7316_show_dac_a, adt7316_store_dac_a, 0);

static ssize_t adt7316_show_DAC_B(struct device *dev,
struct device_attribute *attr,
@@ -1523,8 +1492,7 @@ static ssize_t adt7316_store_DAC_B(struct device *dev,
return adt7316_store_dac(chip, 1, buf, len);
}

-static IIO_DEVICE_ATTR(DAC_B, S_IRUGO | S_IWUSR, adt7316_show_DAC_B,
- adt7316_store_DAC_B, 0);
+static iio_device_attr(dac_b, 0644, adt7316_show_dac_b, adt7316_store_dac_b, 0);

static ssize_t adt7316_show_DAC_C(struct device *dev,
struct device_attribute *attr,
@@ -1547,8 +1515,7 @@ static ssize_t adt7316_store_DAC_C(struct device *dev,
return adt7316_store_dac(chip, 2, buf, len);
}

-static IIO_DEVICE_ATTR(DAC_C, S_IRUGO | S_IWUSR, adt7316_show_DAC_C,
- adt7316_store_DAC_C, 0);
+static iio_device_attr(DAC_C, 0644, adt7316_show_dac_c, adt7316_store_dac_c, 0);

static ssize_t adt7316_show_DAC_D(struct device *dev,
struct device_attribute *attr,
@@ -1571,8 +1538,7 @@ static ssize_t adt7316_store_DAC_D(struct device *dev,
return adt7316_store_dac(chip, 3, buf, len);
}

-static IIO_DEVICE_ATTR(DAC_D, S_IRUGO | S_IWUSR, adt7316_show_DAC_D,
- adt7316_store_DAC_D, 0);
+static iio_device_attr(DAC_D, 0644, adt7316_show_dac_d, adt7316_store_dac_d, 0);

static ssize_t adt7316_show_device_id(struct device *dev,
struct device_attribute *attr,
@@ -1608,8 +1574,8 @@ static ssize_t adt7316_show_manufactorer_id(struct device *dev,
return sprintf(buf, "%d\n", id);
}

-static IIO_DEVICE_ATTR(manufactorer_id, S_IRUGO,
- adt7316_show_manufactorer_id, NULL, 0);
+static iio_device_attr(manufactorer_id, 0444, adt7316_show_manufactorer_id,
+ NULL, 0);

static ssize_t adt7316_show_device_rev(struct device *dev,
struct device_attribute *attr,
@@ -1627,7 +1593,7 @@ static ssize_t adt7316_show_device_rev(struct device *dev,
return sprintf(buf, "%d\n", rev);
}

-static IIO_DEVICE_ATTR(device_rev, S_IRUGO, adt7316_show_device_rev, NULL, 0);
+static iio_device_attr(device_rev, 0444, adt7316_show_device_rev, NULL, 0);

static ssize_t adt7316_show_bus_type(struct device *dev,
struct device_attribute *attr,
@@ -1648,7 +1614,7 @@ static ssize_t adt7316_show_bus_type(struct device *dev,
return sprintf(buf, "i2c\n");
}

-static IIO_DEVICE_ATTR(bus_type, S_IRUGO, adt7316_show_bus_type, NULL, 0);
+static iio_device_attr(bus_type, 0444, adt7316_show_bus_type, NULL, 0);

static struct attribute *adt7316_attributes[] = {
&iio_dev_attr_all_modes.dev_attr.attr,
@@ -1970,63 +1936,35 @@ static ssize_t adt7316_set_int_enabled(struct device *dev,
return len;
}

-static IIO_DEVICE_ATTR(int_mask,
- S_IRUGO | S_IWUSR,
- adt7316_show_int_mask, adt7316_set_int_mask,
- 0);
-static IIO_DEVICE_ATTR(in_temp_high_value,
- S_IRUGO | S_IWUSR,
- adt7316_show_ad_bound, adt7316_set_ad_bound,
- ADT7316_IN_TEMP_HIGH);
-static IIO_DEVICE_ATTR(in_temp_low_value,
- S_IRUGO | S_IWUSR,
- adt7316_show_ad_bound, adt7316_set_ad_bound,
- ADT7316_IN_TEMP_LOW);
-static IIO_DEVICE_ATTR(ex_temp_high_value,
- S_IRUGO | S_IWUSR,
- adt7316_show_ad_bound, adt7316_set_ad_bound,
- ADT7316_EX_TEMP_HIGH);
-static IIO_DEVICE_ATTR(ex_temp_low_value,
- S_IRUGO | S_IWUSR,
- adt7316_show_ad_bound, adt7316_set_ad_bound,
- ADT7316_EX_TEMP_LOW);
+static iio_device_attr(int_mask, 0644, adt7316_show_int_mask,
+ adt7316_set_int_mask, 0);
+static iio_device_attr(in_temp_high_value, 0644, adt7316_show_ad_bound,
+ adt7316_set_ad_bound, ADT7316_IN_TEMP_HIGH);
+static iio_device_attr(in_temp_low_value, 0644, adt7316_show_ad_bound,
+ adt7316_set_ad_bound, ADT7316_IN_TEMP_LOW);
+static iio_device_attr(ex_temp_high_value, 0644, adt7316_show_ad_bound,
+ adt7316_set_ad_bound, ADT7316_EX_TEMP_HIGH);
+static iio_device_attr(ex_temp_low_value, 0644, adt7316_show_ad_bound,
+ adt7316_set_ad_bound, ADT7316_EX_TEMP_LOW);

/* NASTY duplication to be fixed */
-static IIO_DEVICE_ATTR(ex_temp_ain1_high_value,
- S_IRUGO | S_IWUSR,
- adt7316_show_ad_bound, adt7316_set_ad_bound,
- ADT7316_EX_TEMP_HIGH);
-static IIO_DEVICE_ATTR(ex_temp_ain1_low_value,
- S_IRUGO | S_IWUSR,
- adt7316_show_ad_bound, adt7316_set_ad_bound,
- ADT7316_EX_TEMP_LOW);
-static IIO_DEVICE_ATTR(ain2_high_value,
- S_IRUGO | S_IWUSR,
- adt7316_show_ad_bound, adt7316_set_ad_bound,
- ADT7516_AIN2_HIGH);
-static IIO_DEVICE_ATTR(ain2_low_value,
- S_IRUGO | S_IWUSR,
- adt7316_show_ad_bound, adt7316_set_ad_bound,
- ADT7516_AIN2_LOW);
-static IIO_DEVICE_ATTR(ain3_high_value,
- S_IRUGO | S_IWUSR,
- adt7316_show_ad_bound, adt7316_set_ad_bound,
- ADT7516_AIN3_HIGH);
-static IIO_DEVICE_ATTR(ain3_low_value,
- S_IRUGO | S_IWUSR,
- adt7316_show_ad_bound, adt7316_set_ad_bound,
- ADT7516_AIN3_LOW);
-static IIO_DEVICE_ATTR(ain4_high_value,
- S_IRUGO | S_IWUSR,
- adt7316_show_ad_bound, adt7316_set_ad_bound,
- ADT7516_AIN4_HIGH);
-static IIO_DEVICE_ATTR(ain4_low_value,
- S_IRUGO | S_IWUSR,
- adt7316_show_ad_bound, adt7316_set_ad_bound,
- ADT7516_AIN4_LOW);
-static IIO_DEVICE_ATTR(int_enabled,
- S_IRUGO | S_IWUSR,
- adt7316_show_int_enabled,
+static iio_device_attr(ex_temp_ain1_high_value, 0644, adt7316_show_ad_bound,
+ adt7316_set_ad_bound, ADT7316_EX_TEMP_HIGH);
+static iio_device_attr(ex_temp_ain1_low_value, 0644, adt7316_show_ad_bound,
+ adt7316_set_ad_bound, ADT7316_EX_TEMP_LOW);
+static iio_device_attr(ain2_high_value, 0644, adt7316_show_ad_bound,
+ adt7316_set_ad_bound, ADT7516_AIN2_HIGH);
+static iio_device_attr(ain2_low_value, 0644, adt7316_show_ad_bound,
+ adt7316_set_ad_bound, ADT7516_AIN2_LOW);
+static iio_device_attr(ain3_high_value, 0644, adt7316_show_ad_bound,
+ adt7316_set_ad_bound, ADT7516_AIN3_HIGH);
+static iio_device_attr(ain3_low_value, 0644, adt7316_show_ad_bound,
+ adt7316_set_ad_bound, ADT7516_AIN3_LOW);
+static iio_device_attr(ain4_high_value, 0644, adt7316_show_ad_bound,
+ adt7316_set_ad_bound, ADT7516_AIN4_HIGH);
+static iio_device_attr(ain4_low_value, 0644, adt7316_show_ad_bound,
+ adt7316_set_ad_bound, ADT7516_AIN4_LOW);
+static iio_device_attr(int_enabled, 0644, adt7316_show_int_enabled,
adt7316_set_int_enabled, 0);

static struct attribute *adt7316_event_attributes[] = {
--
2.7.4

2016-12-25 20:14:15

by Al Viro

[permalink] [raw]
Subject: Re: [PATCHv4 2/8] Fixed variables not being consistently lower case

On Sun, Dec 25, 2016 at 01:41:06PM -0600, Scott Matheina wrote:
> Across the file, variables were sometimes upper case, some times
> lower case, this fix addresses a few of the instances with this
> inconsistency.

NAK. Go learn C and don't come back until you've done that. If somebody
has told you that you can contribute without knowing the language, they'd
lied - you really can't. And I would *STRONGLY* recommend to stay away
from drivers/staging while you are learning C - it's like trying to use
a public restroom wall as a sex-ed textbook.

While we are at it, it might be a good idea to check if the kernel
builds after your changes and see what errors are produced.

2016-12-25 22:35:03

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCHv4 2/8] Fixed variables not being consistently lower case



On 25 December 2016 20:14:09 GMT+00:00, Al Viro <[email protected]> wrote:
>On Sun, Dec 25, 2016 at 01:41:06PM -0600, Scott Matheina wrote:
>> Across the file, variables were sometimes upper case, some times
>> lower case, this fix addresses a few of the instances with this
>> inconsistency.
>
>NAK. Go learn C and don't come back until you've done that. If
>somebody
>has told you that you can contribute without knowing the language,
>they'd
>lied - you really can't. And I would *STRONGLY* recommend to stay away
>from drivers/staging while you are learning C - it's like trying to use
>a public restroom wall as a sex-ed textbook.

Please can we keep things polite.

Jonathan
>
>While we are at it, it might be a good idea to check if the kernel
>builds after your changes and see what errors are produced.

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

2016-12-26 00:14:04

by Al Viro

[permalink] [raw]
Subject: Re: [PATCHv4 2/8] Fixed variables not being consistently lower case

On Sun, Dec 25, 2016 at 10:34:54PM +0000, Jonathan Cameron wrote:
>
>
> On 25 December 2016 20:14:09 GMT+00:00, Al Viro <[email protected]> wrote:
> >On Sun, Dec 25, 2016 at 01:41:06PM -0600, Scott Matheina wrote:
> >> Across the file, variables were sometimes upper case, some times
> >> lower case, this fix addresses a few of the instances with this
> >> inconsistency.
> >
> >NAK. Go learn C and don't come back until you've done that. If
> >somebody
> >has told you that you can contribute without knowing the language,
> >they'd
> >lied - you really can't. And I would *STRONGLY* recommend to stay away
> >from drivers/staging while you are learning C - it's like trying to use
> >a public restroom wall as a sex-ed textbook.
>
> Please can we keep things polite.

In case you have not realized it,
* Scott is -><- that close to joining the select group of kooks who
get filtered out within days of getting a new account. At this point he
probably still can spend a while learning what needs to be learnt and
reappear with less inane patches after a while, with everything getting
forgotten. A week more of the same kind of postings will almost certainly
cement the reputation of clue-resistant noise source beyond any chance of
repair.
* I am 100% sure that he has not learnt C - hadn't even started doing
so. This, BTW, is not a value judgement of any kind; it's just a highly
likely conclusion based on what he'd been posting. This particular patch,
for example, changes identifiers in a bunch of places, none of which happens
to be a declaration. The reasons why that cannot be correct become obvious
to anyone who had opened _any_ textbook after a few pages. Or tried to
write and run any program in C. Again, it's not "should" - it's really one
of the first things that gets learnt ("you need to declare all variables
explicitly and the names are case-sensitive").
* One really cannot produce any useful patches without understanding
the language. As this (and previous) patch series sent by Scott has
demonstrated, BTW. Learning C is a hard prerequisite for doing any development
in a project written in C, including the kernel. Fortunately, it is not
hard to do.
* Trying to do that purely by osmosis is not the best way, but it's
doable. HOWEVER, trying to do that by osmosis when swimming in drivers/staging
is really on par with using a WC wall as sex ed tutorial. Results will be
awkward, painful and won't satisfy anybody. Very odd ideas of how the things
work are also practically guaranteed.

drivers/staging can serve as a playground for learning how to
produce patches, but only if you already know the language. Otherwise
it really, really must be avoided - it's full of unidiomatic and very
badly written C. It serves as quarantine barracks for much more serious
reasons than anything checkpatch.pl is capable of picking. Directing the
folks new to kernel development towards that pile of code is not particularly
kind, but potentially useful. Doing that to those who are still learning C
goes far beyond "not kind". I can't stress it enough - don't go there if
you are still learning the language.