Skip to contentSkip to conversation

staging: iio: adc: fix multiple checkpatch issues

PATCH Superseded Ioana Ciornei 2 participants 19 messages Oct 6, 2015 – Oct 7, 2015

Subsystems (6)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover staging: iio: adc: fix multiple checkpatch issues

This patchset fixes multiple checkpatch issues.
Patch 2/10 introduces some lines over 800 characters, thus some other checkpatch warnings, but the readability of the entire core is improved by aligning the arguments and the parameters of the functions to match the open bracket.

Ioana Ciornei (10):
staging: iio: adc: use kernel types u32 and u64
staging: iio: adc: properly indent to match open paranthesis
staging: iio: adc: remove explicit comparison to NULL
staging: iio: adc: remove space after cast
staging: iio: adc: add spaces around binary operators
staging: iio: adc: add blank line after declarations
staging: iio: adc: remove multiple blank lines
staging: iio: adc: remove the use of CamelCase
staging: iio: adc: use BIT macro
staging: iio: adc: properly indent block comments

 drivers/staging/iio/adc/ad7192.c      |  93 +++++++++--------
 drivers/staging/iio/adc/ad7192.h      |   2 +-
 drivers/staging/iio/adc/ad7280a.c     | 186 +++++++++++++++++-----------------
 drivers/staging/iio/adc/ad7606_core.c |  21 ++--
 drivers/staging/iio/adc/ad7606_par.c  |  15 +--
 drivers/staging/iio/adc/ad7606_spi.c  |   5 +-
 drivers/staging/iio/adc/ad7780.c      |   9 +-
 drivers/staging/iio/adc/ad7816.c      |  53 +++++-----
 drivers/staging/iio/adc/lpc32xx_adc.c |  20 ++--
 drivers/staging/iio/adc/mxs-lradc.c   | 170 +++++++++++++++----------------
 drivers/staging/iio/adc/spear_adc.c   |   4 +-
 11 files changed, 292 insertions(+), 286 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/10 staging: iio: adc: use kernel types u32 and u64

Convert uint32_t to u32 and uint64_t to u64 in order to follow the kernel best practice

---
 drivers/staging/iio/adc/mxs-lradc.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)
drivers/staging/iio/adc/mxs-lradc.c +15 -15
index 3f7715c..d88d85b 100644
@@ -108,12 +108,12 @@ static const char * const mx28_lradc_irq_names[] = {
 struct mxs_lradc_of_config {
 	const int		irq_count;
 	const char * const	*irq_name;
-	const uint32_t		*vref_mv;
+	const u32		*vref_mv;
 };
 
 #define VREF_MV_BASE 1850
 
-static const uint32_t mx23_vref_mv[LRADC_MAX_TOTAL_CHANS] = {
+static const u32 mx23_vref_mv[LRADC_MAX_TOTAL_CHANS] = {
 	VREF_MV_BASE,		/* CH0 */
 	VREF_MV_BASE,		/* CH1 */
 	VREF_MV_BASE,		/* CH2 */
@@ -132,7 +132,7 @@ static const uint32_t mx23_vref_mv[LRADC_MAX_TOTAL_CHANS] = {
 	VREF_MV_BASE * 4,	/* CH15 VDD5V */
 };
 
-static const uint32_t mx28_vref_mv[LRADC_MAX_TOTAL_CHANS] = {
+static const u32 mx28_vref_mv[LRADC_MAX_TOTAL_CHANS] = {
 	VREF_MV_BASE,		/* CH0 */
 	VREF_MV_BASE,		/* CH1 */
 	VREF_MV_BASE,		/* CH2 */
@@ -198,14 +198,14 @@ struct mxs_lradc {
 
 	struct clk		*clk;
 
-	uint32_t		*buffer;
+	u32			*buffer;
 	struct iio_trigger	*trig;
 
 	struct mutex		lock;
 
 	struct completion	completion;
 
-	const uint32_t		*vref_mv;
+	const u32		*vref_mv;
 	struct mxs_lradc_scale	scale_avail[LRADC_MAX_TOTAL_CHANS][2];
 	unsigned long		is_divided;
 
@@ -1138,8 +1138,8 @@ static irqreturn_t mxs_lradc_handle_irq(int irq, void *data)
 	struct iio_dev *iio = data;
 	struct mxs_lradc *lradc = iio_priv(iio);
 	unsigned long reg = readl(lradc->base + LRADC_CTRL1);
-	uint32_t clr_irq = mxs_lradc_irq_mask(lradc);
-	const uint32_t ts_irq_mask =
+	u32 clr_irq = mxs_lradc_irq_mask(lradc);
+	const u32 ts_irq_mask =
 		LRADC_CTRL1_TOUCH_DETECT_IRQ |
 		LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1) |
 		LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2);
@@ -1175,7 +1175,7 @@ static irqreturn_t mxs_lradc_trigger_handler(int irq, void *p)
 	struct iio_poll_func *pf = p;
 	struct iio_dev *iio = pf->indio_dev;
 	struct mxs_lradc *lradc = iio_priv(iio);
-	const uint32_t chan_value = LRADC_CH_ACCUMULATE |
+	const u32 chan_value = LRADC_CH_ACCUMULATE |
 		((LRADC_DELAY_TIMER_LOOP - 1) << LRADC_CH_NUM_SAMPLES_OFFSET);
 	unsigned int i, j = 0;
 
@@ -1198,7 +1198,7 @@ static int mxs_lradc_configure_trigger(struct iio_trigger *trig, bool state)
 {
 	struct iio_dev *iio = iio_trigger_get_drvdata(trig);
 	struct mxs_lradc *lradc = iio_priv(iio);
-	const uint32_t st = state ? STMP_OFFSET_REG_SET : STMP_OFFSET_REG_CLR;
+	const u32 st = state ? STMP_OFFSET_REG_SET : STMP_OFFSET_REG_CLR;
 
 	mxs_lradc_reg_wrt(lradc, LRADC_DELAY_KICK, LRADC_DELAY(0) + st);
 
@@ -1248,10 +1248,10 @@ static int mxs_lradc_buffer_preenable(struct iio_dev *iio)
 	struct mxs_lradc *lradc = iio_priv(iio);
 	int ret = 0, chan, ofs = 0;
 	unsigned long enable = 0;
-	uint32_t ctrl4_set = 0;
-	uint32_t ctrl4_clr = 0;
-	uint32_t ctrl1_irq = 0;
-	const uint32_t chan_value = LRADC_CH_ACCUMULATE |
+	u32 ctrl4_set = 0;
+	u32 ctrl4_clr = 0;
+	u32 ctrl1_irq = 0;
+	const u32 chan_value = LRADC_CH_ACCUMULATE |
 		((LRADC_DELAY_TIMER_LOOP - 1) << LRADC_CH_NUM_SAMPLES_OFFSET);
 	const int len = bitmap_weight(iio->active_scan_mask,
 			LRADC_MAX_TOTAL_CHANS);
@@ -1456,7 +1456,7 @@ static const struct iio_chan_spec mx28_lradc_chan_spec[] = {
 static int mxs_lradc_hw_init(struct mxs_lradc *lradc)
 {
 	/* The ADC always uses DELAY CHANNEL 0. */
-	const uint32_t adc_cfg =
+	const u32 adc_cfg =
 		(1 << (LRADC_DELAY_TRIGGER_DELAYS_OFFSET + 0)) |
 		(LRADC_DELAY_TIMER_PER << LRADC_DELAY_DELAY_OFFSET);
 
@@ -1583,7 +1583,7 @@ static int mxs_lradc_probe(struct platform_device *pdev)
 	struct resource *iores;
 	int ret = 0, touch_ret;
 	int i, s;
-	uint64_t scale_uv;
+	u64 scale_uv;
 
 	/* Allocate the IIO device. */
 	iio = devm_iio_device_alloc(dev, sizeof(*lradc));
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/10 staging: iio: adc: properly indent to match open paranthesis

In reply to Ioana Ciornei

Indent parameters ansd arguments passed to function calls to match open paranthesis

---
 drivers/staging/iio/adc/ad7192.c      |  44 +++++-----
 drivers/staging/iio/adc/ad7280a.c     | 153 +++++++++++++++++-----------------
 drivers/staging/iio/adc/ad7606_core.c |  19 +++--
 drivers/staging/iio/adc/ad7606_par.c  |  10 +--
 drivers/staging/iio/adc/ad7606_spi.c  |   4 +-
 drivers/staging/iio/adc/ad7780.c      |   8 +-
 drivers/staging/iio/adc/ad7816.c      |  48 +++++------
 drivers/staging/iio/adc/lpc32xx_adc.c |  14 ++--
 drivers/staging/iio/adc/mxs-lradc.c   | 136 +++++++++++++++---------------
 drivers/staging/iio/adc/spear_adc.c   |   4 +-
 10 files changed, 220 insertions(+), 220 deletions(-)
drivers/staging/iio/adc/ad7192.c +22 -22
index fe56fb6..21d83c5 100644
@@ -201,7 +201,7 @@ static int ad7192_calibrate_all(struct ad7192_state *st)
 }
 
 static int ad7192_setup(struct ad7192_state *st,
-	const struct ad7192_platform_data *pdata)
+			const struct ad7192_platform_data *pdata)
 {
 	struct iio_dev *indio_dev = spi_get_drvdata(st->sd.spi);
 	unsigned long long scale_uv;
@@ -224,7 +224,7 @@ static int ad7192_setup(struct ad7192_state *st,
 
 	if (id != st->devid)
 		dev_warn(&st->sd.spi->dev, "device ID query failed (0x%X)\n",
-			id);
+			 id);
 
 	switch (pdata->clock_source_sel) {
 	case AD7192_CLK_EXT_MCLK1_2:
@@ -307,8 +307,8 @@ out:
 }
 
 static ssize_t ad7192_read_frequency(struct device *dev,
-		struct device_attribute *attr,
-		char *buf)
+				     struct device_attribute *attr,
+				     char *buf)
 {
 	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct ad7192_state *st = iio_priv(indio_dev);
@@ -318,9 +318,9 @@ static ssize_t ad7192_read_frequency(struct device *dev,
 }
 
 static ssize_t ad7192_write_frequency(struct device *dev,
-		struct device_attribute *attr,
-		const char *buf,
-		size_t len)
+				      struct device_attribute *attr,
+				      const char *buf,
+				      size_t len)
 {
 	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct ad7192_state *st = iio_priv(indio_dev);
@@ -360,7 +360,7 @@ static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO,
 		ad7192_write_frequency);
 
 static ssize_t ad7192_show_scale_available(struct device *dev,
-			struct device_attribute *attr, char *buf)
+					   struct device_attribute *attr, char *buf)
 {
 	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct ad7192_state *st = iio_priv(indio_dev);
@@ -383,8 +383,8 @@ static IIO_DEVICE_ATTR(in_voltage_scale_available, S_IRUGO,
 		       ad7192_show_scale_available, NULL, 0);
 
 static ssize_t ad7192_show_ac_excitation(struct device *dev,
-		struct device_attribute *attr,
-		char *buf)
+					 struct device_attribute *attr,
+					 char *buf)
 {
 	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct ad7192_state *st = iio_priv(indio_dev);
@@ -393,8 +393,8 @@ static ssize_t ad7192_show_ac_excitation(struct device *dev,
 }
 
 static ssize_t ad7192_show_bridge_switch(struct device *dev,
-		struct device_attribute *attr,
-		char *buf)
+					 struct device_attribute *attr,
+					 char *buf)
 {
 	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct ad7192_state *st = iio_priv(indio_dev);
@@ -403,9 +403,9 @@ static ssize_t ad7192_show_bridge_switch(struct device *dev,
 }
 
 static ssize_t ad7192_set(struct device *dev,
-		struct device_attribute *attr,
-		const char *buf,
-		size_t len)
+			  struct device_attribute *attr,
+			  const char *buf,
+			  size_t len)
 {
 	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct ad7192_state *st = iio_priv(indio_dev);
@@ -529,10 +529,10 @@ static int ad7192_read_raw(struct iio_dev *indio_dev,
 }
 
 static int ad7192_write_raw(struct iio_dev *indio_dev,
-			       struct iio_chan_spec const *chan,
-			       int val,
-			       int val2,
-			       long mask)
+			    struct iio_chan_spec const *chan,
+			    int val,
+			    int val2,
+			    long mask)
 {
 	struct ad7192_state *st = iio_priv(indio_dev);
 	int ret, i;
@@ -556,7 +556,7 @@ static int ad7192_write_raw(struct iio_dev *indio_dev,
 				if (tmp == st->conf)
 					break;
 				ad_sd_write_reg(&st->sd, AD7192_REG_CONF,
-						 3, st->conf);
+						3, st->conf);
 				ad7192_calibrate_all(st);
 				break;
 			}
@@ -571,8 +571,8 @@ static int ad7192_write_raw(struct iio_dev *indio_dev,
 }
 
 static int ad7192_write_raw_get_fmt(struct iio_dev *indio_dev,
-			       struct iio_chan_spec const *chan,
-			       long mask)
+				    struct iio_chan_spec const *chan,
+				    long mask)
 {
 	return IIO_VAL_INT_PLUS_NANO;
 }
drivers/staging/iio/adc/ad7280a.c +76 -77

287 lines not on this page · raw message

drivers/staging/iio/adc/ad7606_core.c +10 -9
index bf2c801..6dc7413 100644
@@ -108,7 +108,7 @@ static int ad7606_read_raw(struct iio_dev *indio_dev,
 }
 
 static ssize_t ad7606_show_range(struct device *dev,
-			struct device_attribute *attr, char *buf)
+				 struct device_attribute *attr, char *buf)
 {
 	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct ad7606_state *st = iio_priv(indio_dev);
@@ -117,7 +117,7 @@ static ssize_t ad7606_show_range(struct device *dev,
 }
 
 static ssize_t ad7606_store_range(struct device *dev,
-		struct device_attribute *attr, const char *buf, size_t count)
+				  struct device_attribute *attr, const char *buf, size_t count)
 {
 	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct ad7606_state *st = iio_priv(indio_dev);
@@ -145,7 +145,7 @@ static IIO_DEVICE_ATTR(in_voltage_range, S_IRUGO | S_IWUSR,
 static IIO_CONST_ATTR(in_voltage_range_available, "5000 10000");
 
 static ssize_t ad7606_show_oversampling_ratio(struct device *dev,
-			struct device_attribute *attr, char *buf)
+					      struct device_attribute *attr, char *buf)
 {
 	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct ad7606_state *st = iio_priv(indio_dev);
@@ -166,7 +166,8 @@ static int ad7606_oversampling_get_index(unsigned val)
 }
 
 static ssize_t ad7606_store_oversampling_ratio(struct device *dev,
-		struct device_attribute *attr, const char *buf, size_t count)
+					       struct device_attribute *attr,
+					       const char *buf, size_t count)
 {
 	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct ad7606_state *st = iio_priv(indio_dev);
@@ -460,9 +461,9 @@ static const struct iio_info ad7606_info_range = {
 };
 
 struct iio_dev *ad7606_probe(struct device *dev, int irq,
-			      void __iomem *base_address,
-			      unsigned id,
-			      const struct ad7606_bus_ops *bops)
+			     void __iomem *base_address,
+			     unsigned id,
+			     const struct ad7606_bus_ops *bops)
 {
 	struct ad7606_platform_data *pdata = dev->platform_data;
 	struct ad7606_state *st;
@@ -529,7 +530,7 @@ struct iio_dev *ad7606_probe(struct device *dev, int irq,
 		dev_warn(st->dev, "failed to RESET: no RESET GPIO specified\n");
 
 	ret = request_irq(irq, ad7606_interrupt,
-		IRQF_TRIGGER_FALLING, st->chip_info->name, indio_dev);
+			  IRQF_TRIGGER_FALLING, st->chip_info->name, indio_dev);
 	if (ret)
 		goto error_free_gpios;
 
@@ -591,7 +592,7 @@ void ad7606_resume(struct iio_dev *indio_dev)
 	if (gpio_is_valid(st->pdata->gpio_stby)) {
 		if (gpio_is_valid(st->pdata->gpio_range))
 			gpio_set_value(st->pdata->gpio_range,
-					st->range == 10000);
+				       st->range == 10000);
 
 		gpio_set_value(st->pdata->gpio_stby, 1);
 		ad7606_reset(st);
drivers/staging/iio/adc/ad7606_par.c +5 -5
index 1d48ae3..fbe8237 100644
@@ -16,7 +16,7 @@
 #include "ad7606.h"
 
 static int ad7606_par16_read_block(struct device *dev,
-				 int count, void *buf)
+				   int count, void *buf)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct iio_dev *indio_dev = platform_get_drvdata(pdev);
@@ -32,7 +32,7 @@ static const struct ad7606_bus_ops ad7606_par16_bops = {
 };
 
 static int ad7606_par8_read_block(struct device *dev,
-				 int count, void *buf)
+				  int count, void *buf)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct iio_dev *indio_dev = platform_get_drvdata(pdev);
@@ -69,9 +69,9 @@ static int ad7606_par_probe(struct platform_device *pdev)
 	remap_size = resource_size(res);
 
 	indio_dev = ad7606_probe(&pdev->dev, irq, addr,
-			  platform_get_device_id(pdev)->driver_data,
-			  remap_size > 1 ? &ad7606_par16_bops :
-			  &ad7606_par8_bops);
+				 platform_get_device_id(pdev)->driver_data,
+				 remap_size > 1 ? &ad7606_par16_bops :
+				 &ad7606_par8_bops);
 
 	if (IS_ERR(indio_dev))
 		return PTR_ERR(indio_dev);
drivers/staging/iio/adc/ad7606_spi.c +2 -2
index 7303983..9c62e94 100644
@@ -44,8 +44,8 @@ static int ad7606_spi_probe(struct spi_device *spi)
 	struct iio_dev *indio_dev;
 
 	indio_dev = ad7606_probe(&spi->dev, spi->irq, NULL,
-			   spi_get_device_id(spi)->driver_data,
-			   &ad7606_spi_bops);
+				 spi_get_device_id(spi)->driver_data,
+				 &ad7606_spi_bops);
 
 	if (IS_ERR(indio_dev))
 		return PTR_ERR(indio_dev);
drivers/staging/iio/adc/ad7780.c +4 -4
index 9f03fe3..501dc9f 100644
@@ -62,7 +62,7 @@ static struct ad7780_state *ad_sigma_delta_to_ad7780(struct ad_sigma_delta *sd)
 }
 
 static int ad7780_set_mode(struct ad_sigma_delta *sigma_delta,
-	enum ad_sigma_delta_mode mode)
+			   enum ad_sigma_delta_mode mode)
 {
 	struct ad7780_state *st = ad_sigma_delta_to_ad7780(sigma_delta);
 	unsigned val;
@@ -107,13 +107,13 @@ static int ad7780_read_raw(struct iio_dev *indio_dev,
 }
 
 static int ad7780_postprocess_sample(struct ad_sigma_delta *sigma_delta,
-	unsigned int raw_sample)
+				     unsigned int raw_sample)
 {
 	struct ad7780_state *st = ad_sigma_delta_to_ad7780(sigma_delta);
 	const struct ad7780_chip_info *chip_info = st->chip_info;
 
 	if ((raw_sample & AD7780_ERR) ||
-		((raw_sample & chip_info->pattern_mask) != chip_info->pattern))
+	    ((raw_sample & chip_info->pattern_mask) != chip_info->pattern))
 		return -EIO;
 
 	if (raw_sample & AD7780_GAIN)
@@ -208,7 +208,7 @@ static int ad7780_probe(struct spi_device *spi)
 	if (pdata && gpio_is_valid(pdata->gpio_pdrst)) {
 
 		ret = devm_gpio_request_one(&spi->dev, pdata->gpio_pdrst,
-					GPIOF_OUT_INIT_LOW, "AD7780 /PDRST");
+					    GPIOF_OUT_INIT_LOW, "AD7780 /PDRST");
 		if (ret) {
 			dev_err(&spi->dev, "failed to request GPIO PDRST\n");
 			goto error_disable_reg;
drivers/staging/iio/adc/ad7816.c +24 -24

126 lines not on this page · raw message

drivers/staging/iio/adc/lpc32xx_adc.c +7 -7
index bcf4ebb..d11c54b 100644
@@ -67,10 +67,10 @@ struct lpc32xx_adc_info {
 };
 
 static int lpc32xx_read_raw(struct iio_dev *indio_dev,
-				struct iio_chan_spec const *chan,
-				int *val,
-				int *val2,
-				long mask)
+			    struct iio_chan_spec const *chan,
+			    int *val,
+			    int *val2,
+			    long mask)
 {
 	struct lpc32xx_adc_info *info = iio_priv(indio_dev);
 
@@ -79,10 +79,10 @@ static int lpc32xx_read_raw(struct iio_dev *indio_dev,
 		clk_enable(info->clk);
 		/* Measurement setup */
 		__raw_writel(AD_INTERNAL | (chan->address) | AD_REFp | AD_REFm,
-			LPC32XX_ADC_SELECT(info->adc_base));
+			     LPC32XX_ADC_SELECT(info->adc_base));
 		/* Trigger conversion */
 		__raw_writel(AD_PDN_CTRL | AD_STROBE,
-			LPC32XX_ADC_CTRL(info->adc_base));
+			     LPC32XX_ADC_CTRL(info->adc_base));
 		wait_for_completion(&info->completion); /* set by ISR */
 		clk_disable(info->clk);
 		*val = info->value;
@@ -166,7 +166,7 @@ static int lpc32xx_adc_probe(struct platform_device *pdev)
 	}
 
 	retval = devm_request_irq(&pdev->dev, irq, lpc32xx_adc_isr, 0,
-								MOD_NAME, info);
+				  MOD_NAME, info);
 	if (retval < 0) {
 		dev_err(&pdev->dev, "failed requesting interrupt\n");
 		return retval;
drivers/staging/iio/adc/mxs-lradc.c +68 -68

343 lines not on this page · raw message

drivers/staging/iio/adc/spear_adc.c +2 -2
index c538237..712cae0 100644
@@ -191,8 +191,8 @@ static int spear_adc_write_raw(struct iio_dev *indio_dev,
 	mutex_lock(&indio_dev->mlock);
 
 	if ((val < SPEAR_ADC_CLK_MIN) ||
-		(val > SPEAR_ADC_CLK_MAX) ||
-		(val2 != 0)) {
+	    (val > SPEAR_ADC_CLK_MAX) ||
+	    (val2 != 0)) {
 		ret = -EINVAL;
 		goto out;
 	}
Signature · 1 line
2.1.4
#3 lore raw

PATCH 3/10 staging: iio: adc: remove explicit comparison to NULL

In reply to Ioana Ciornei

Use !condition instead off condition == NULL when comparing with NULL

---
 drivers/staging/iio/adc/ad7192.c    | 2 +-
 drivers/staging/iio/adc/ad7280a.c   | 8 ++++----
 drivers/staging/iio/adc/mxs-lradc.c | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/iio/adc/ad7192.c +1 -1
index 21d83c5..22b4bf5 100644
@@ -625,7 +625,7 @@ static int ad7192_probe(struct spi_device *spi)
 	}
 
 	indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
-	if (indio_dev == NULL)
+	if (!indio_dev)
 		return -ENOMEM;
 
 	st = iio_priv(indio_dev);
drivers/staging/iio/adc/ad7280a.c +4 -4
index 26c9c12..9fb664c 100644
@@ -488,7 +488,7 @@ static int ad7280_channel_init(struct ad7280_state *st)
 
 	st->channels = kcalloc((st->slave_num + 1) * 12 + 2,
 			       sizeof(*st->channels), GFP_KERNEL);
-	if (st->channels == NULL)
+	if (!st->channels)
 		return -ENOMEM;
 
 	for (dev = 0, cnt = 0; dev <= st->slave_num; dev++)
@@ -549,7 +549,7 @@ static int ad7280_attr_init(struct ad7280_state *st)
 	st->iio_attr = kcalloc(2, sizeof(*st->iio_attr) *
 			       (st->slave_num + 1) * AD7280A_CELLS_PER_DEV,
 			       GFP_KERNEL);
-	if (st->iio_attr == NULL)
+	if (!st->iio_attr)
 		return -ENOMEM;
 
 	for (dev = 0, cnt = 0; dev <= st->slave_num; dev++)
@@ -685,7 +685,7 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
 	int i, ret;
 
 	channels = kcalloc(st->scan_cnt, sizeof(*channels), GFP_KERNEL);
-	if (channels == NULL)
+	if (!channels)
 		return IRQ_HANDLED;
 
 	ret = ad7280_read_all_channels(st, st->scan_cnt, channels);
@@ -838,7 +838,7 @@ static int ad7280_probe(struct spi_device *spi)
 	struct iio_dev *indio_dev;
 
 	indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
-	if (indio_dev == NULL)
+	if (!indio_dev)
 		return -ENOMEM;
 
 	st = iio_priv(indio_dev);
drivers/staging/iio/adc/mxs-lradc.c +1 -1
index 208f928..cde7b3a 100644
@@ -1217,7 +1217,7 @@ static int mxs_lradc_trigger_init(struct iio_dev *iio)
 	struct mxs_lradc *lradc = iio_priv(iio);
 
 	trig = iio_trigger_alloc("%s-dev%i", iio->name, iio->id);
-	if (trig == NULL)
+	if (!trig)
 		return -ENOMEM;
 
 	trig->dev.parent = lradc->dev;
Signature · 1 line
2.1.4
#4 lore raw

PATCH 4/10 staging: iio: adc: remove space after cast

In reply to Ioana Ciornei

Remove the space after an explicit cast because there is no point in having it

---
 drivers/staging/iio/adc/ad7192.c      | 2 +-
 drivers/staging/iio/adc/ad7280a.c     | 6 +++---
 drivers/staging/iio/adc/ad7606_core.c | 2 +-
 drivers/staging/iio/adc/ad7606_par.c  | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)
drivers/staging/iio/adc/ad7192.c +1 -1
index 22b4bf5..ab87724 100644
@@ -423,7 +423,7 @@ static ssize_t ad7192_set(struct device *dev,
 		return -EBUSY;
 	}
 
-	switch ((u32) this_attr->address) {
+	switch ((u32)this_attr->address) {
 	case AD7192_REG_GPOCON:
 		if (val)
 			st->gpocon |= AD7192_GPOCON_BPDSW;
drivers/staging/iio/adc/ad7280a.c +3 -3
index 9fb664c..ad1a44f 100644
@@ -602,7 +602,7 @@ static ssize_t ad7280_read_channel_config(struct device *dev,
 	struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
 	unsigned val;
 
-	switch ((u32) this_attr->address) {
+	switch ((u32)this_attr->address) {
 	case AD7280A_CELL_OVERVOLTAGE:
 		val = 1000 + (st->cell_threshhigh * 1568) / 100;
 		break;
@@ -638,7 +638,7 @@ static ssize_t ad7280_write_channel_config(struct device *dev,
 	if (ret)
 		return ret;
 
-	switch ((u32) this_attr->address) {
+	switch ((u32)this_attr->address) {
 	case AD7280A_CELL_OVERVOLTAGE:
 	case AD7280A_CELL_UNDERVOLTAGE:
 		val = ((val - 1000) * 100) / 1568; /* LSB 15.68mV */
@@ -654,7 +654,7 @@ static ssize_t ad7280_write_channel_config(struct device *dev,
 	val = clamp(val, 0L, 0xFFL);
 
 	mutex_lock(&indio_dev->mlock);
-	switch ((u32) this_attr->address) {
+	switch ((u32)this_attr->address) {
 	case AD7280A_CELL_OVERVOLTAGE:
 		st->cell_threshhigh = val;
 		break;
drivers/staging/iio/adc/ad7606_core.c +1 -1
index 6dc7413..eb890b6 100644
@@ -97,7 +97,7 @@ static int ad7606_read_raw(struct iio_dev *indio_dev,
 
 		if (ret < 0)
 			return ret;
-		*val = (short) ret;
+		*val = (short)ret;
 		return IIO_VAL_INT;
 	case IIO_CHAN_INFO_SCALE:
 		*val = st->range * 2;
drivers/staging/iio/adc/ad7606_par.c +2 -2
index fbe8237..3537a78 100644
@@ -22,7 +22,7 @@ static int ad7606_par16_read_block(struct device *dev,
 	struct iio_dev *indio_dev = platform_get_drvdata(pdev);
 	struct ad7606_state *st = iio_priv(indio_dev);
 
-	insw((unsigned long) st->base_address, buf, count);
+	insw((unsigned long)st->base_address, buf, count);
 
 	return 0;
 }
@@ -38,7 +38,7 @@ static int ad7606_par8_read_block(struct device *dev,
 	struct iio_dev *indio_dev = platform_get_drvdata(pdev);
 	struct ad7606_state *st = iio_priv(indio_dev);
 
-	insb((unsigned long) st->base_address, buf, count * 2);
+	insb((unsigned long)st->base_address, buf, count * 2);
 
 	return 0;
 }
Signature · 1 line
2.1.4
#5 lore raw

PATCH 5/10 staging: iio: adc: add spaces around binary operators

In reply to Ioana Ciornei

Add spaces around binary operators like -, +, * etc in order to improve readability

---
 drivers/staging/iio/adc/ad7192.c  | 2 +-
 drivers/staging/iio/adc/ad7280a.c | 4 ++--
 drivers/staging/iio/adc/ad7816.c  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/iio/adc/ad7192.c +1 -1
index ab87724..495ddb6 100644
@@ -376,7 +376,7 @@ static ssize_t ad7192_show_scale_available(struct device *dev,
 }
 
 static IIO_DEVICE_ATTR_NAMED(in_v_m_v_scale_available,
-			     in_voltage-voltage_scale_available,
+			     in_voltage - voltage_scale_available,
 			     S_IRUGO, ad7192_show_scale_available, NULL, 0);
 
 static IIO_DEVICE_ATTR(in_voltage_scale_available, S_IRUGO,
drivers/staging/iio/adc/ad7280a.c +2 -2
index ad1a44f..8d9e7f7 100644
@@ -740,14 +740,14 @@ out:
 }
 
 static IIO_DEVICE_ATTR_NAMED(in_thresh_low_value,
-		in_voltage-voltage_thresh_low_value,
+		in_voltage - voltage_thresh_low_value,
 		S_IRUGO | S_IWUSR,
 		ad7280_read_channel_config,
 		ad7280_write_channel_config,
 		AD7280A_CELL_UNDERVOLTAGE);
 
 static IIO_DEVICE_ATTR_NAMED(in_thresh_high_value,
-		in_voltage-voltage_thresh_high_value,
+		in_voltage - voltage_thresh_high_value,
 		S_IRUGO | S_IWUSR,
 		ad7280_read_channel_config,
 		ad7280_write_channel_config,
drivers/staging/iio/adc/ad7816.c +1 -1
index 4e954d2..6636087 100644
@@ -48,7 +48,7 @@ struct ad7816_chip_info {
 	u16 rdwr_pin;
 	u16 convert_pin;
 	u16 busy_pin;
-	u8  oti_data[AD7816_CS_MAX+1];
+	u8  oti_data[AD7816_CS_MAX + 1];
 	u8  channel_id;	/* 0 always be temperature */
 	u8  mode;
 };
Signature · 1 line
2.1.4
#6 lore raw

PATCH 6/10 staging: iio: adc: add blank line after declarations

In reply to Ioana Ciornei

Insert a blank line after declarations

---
 drivers/staging/iio/adc/ad7606_par.c | 1 +
 drivers/staging/iio/adc/ad7606_spi.c | 1 +
 2 files changed, 2 insertions(+)
drivers/staging/iio/adc/ad7606_par.c +1 -0
index 3537a78..adc370e 100644
@@ -113,6 +113,7 @@ static const struct dev_pm_ops ad7606_pm_ops = {
 	.suspend = ad7606_par_suspend,
 	.resume  = ad7606_par_resume,
 };
+
 #define AD7606_PAR_PM_OPS (&ad7606_pm_ops)
 
 #else
drivers/staging/iio/adc/ad7606_spi.c +1 -0
index 9c62e94..b88f882 100644
@@ -85,6 +85,7 @@ static const struct dev_pm_ops ad7606_pm_ops = {
 	.suspend = ad7606_spi_suspend,
 	.resume  = ad7606_spi_resume,
 };
+
 #define AD7606_SPI_PM_OPS (&ad7606_pm_ops)
 
 #else
Signature · 1 line
2.1.4
#7 lore raw

PATCH 7/10 staging: iio: adc: remove multiple blank lines

In reply to Ioana Ciornei

Remove multiple blank lines since there is no practical reason to have it

---
 drivers/staging/iio/adc/ad7192.c  | 1 -
 drivers/staging/iio/adc/ad7280a.c | 1 -
 drivers/staging/iio/adc/ad7780.c  | 1 -
 drivers/staging/iio/adc/ad7816.c  | 3 ---
 4 files changed, 6 deletions(-)
drivers/staging/iio/adc/ad7192.c +0 -1
index 495ddb6..f293dbd 100644
@@ -88,7 +88,6 @@
 #define AD7192_CLK_INT_CO		3 /* Internal 4.92 MHz Clock available
 					   * at the MCLK2 pin */
 
-
 /* Configuration Register Bit Designations (AD7192_REG_CONF) */
 
 #define AD7192_CONF_CHOP	BIT(23) /* CHOP enable */
drivers/staging/iio/adc/ad7280a.c +0 -1
index 8d9e7f7..828bd57 100644
@@ -765,7 +765,6 @@ static IIO_DEVICE_ATTR(in_temp_thresh_high_value,
 		ad7280_write_channel_config,
 		AD7280A_AUX_ADC_OVERVOLTAGE);
 
-
 static struct attribute *ad7280_event_attributes[] = {
 	&iio_dev_attr_in_thresh_low_value.dev_attr.attr,
 	&iio_dev_attr_in_thresh_high_value.dev_attr.attr,
drivers/staging/iio/adc/ad7780.c +0 -1
index 501dc9f..6be979a 100644
@@ -206,7 +206,6 @@ static int ad7780_probe(struct spi_device *spi)
 	indio_dev->info = &ad7780_info;
 
 	if (pdata && gpio_is_valid(pdata->gpio_pdrst)) {
-
 		ret = devm_gpio_request_one(&spi->dev, pdata->gpio_pdrst,
 					    GPIOF_OUT_INIT_LOW, "AD7780 /PDRST");
 		if (ret) {
drivers/staging/iio/adc/ad7816.c +0 -3
index 6636087..b3dec706 100644
@@ -38,7 +38,6 @@
 #define AD7816_TEMP_FLOAT_OFFSET	2
 #define AD7816_TEMP_FLOAT_MASK		0x3
 
-
 /*
  * struct ad7816_chip_info - chip specific information
  */
@@ -70,7 +69,6 @@ static int ad7816_spi_read(struct ad7816_chip_info *chip, u16 *data)
 	}
 	gpio_set_value(chip->rdwr_pin, 1);
 
-
 	if (chip->mode == AD7816_PD) { /* operating mode 2 */
 		gpio_set_value(chip->convert_pin, 1);
 		gpio_set_value(chip->convert_pin, 0);
@@ -203,7 +201,6 @@ static IIO_DEVICE_ATTR(channel, S_IRUGO | S_IWUSR,
 		ad7816_store_channel,
 		0);
 
-
 static ssize_t ad7816_show_value(struct device *dev,
 				 struct device_attribute *attr,
 				 char *buf)
Signature · 1 line
2.1.4
#8 lore raw

PATCH 8/10 staging: iio: adc: remove the use of CamelCase

In reply to Ioana Ciornei

Remove the use of CamelCase to follow the kernel naming conventions

---
 drivers/staging/iio/adc/ad7192.c      | 12 ++++++------
 drivers/staging/iio/adc/ad7192.h      |  2 +-
 drivers/staging/iio/adc/ad7280a.c     | 14 +++++++-------
 drivers/staging/iio/adc/lpc32xx_adc.c |  6 +++---
 4 files changed, 17 insertions(+), 17 deletions(-)
drivers/staging/iio/adc/ad7192.c +6 -6
index f293dbd..f1d4911 100644
@@ -118,13 +118,13 @@
 /* GPOCON Register Bit Designations (AD7192_REG_GPOCON) */
 #define AD7192_GPOCON_BPDSW	BIT(6) /* Bridge power-down switch enable */
 #define AD7192_GPOCON_GP32EN	BIT(5) /* Digital Output P3 and P2 enable */
-#define AD7192_GPOCON_GP10EN	BIT(4) /* Digital Output P1 and P0 enable */
+#define AD7193_GPOCON_GP10EN	BIT(4) /* Digital Output P1 and P0 enable */
 #define AD7192_GPOCON_P3DAT	BIT(3) /* P3 state */
 #define AD7192_GPOCON_P2DAT	BIT(2) /* P2 state */
 #define AD7192_GPOCON_P1DAT	BIT(1) /* P1 state */
 #define AD7192_GPOCON_P0DAT	BIT(0) /* P0 state */
 
-#define AD7192_INT_FREQ_MHz	4915200
+#define AD7192_INT_FREQ_MHZ	4915200
 
 /* NOTE:
  * The AD7190/2/5 features a dual use data out ready DOUT/RDY output.
@@ -228,14 +228,14 @@ static int ad7192_setup(struct ad7192_state *st,
 	switch (pdata->clock_source_sel) {
 	case AD7192_CLK_EXT_MCLK1_2:
 	case AD7192_CLK_EXT_MCLK2:
-		st->mclk = AD7192_INT_FREQ_MHz;
+		st->mclk = AD7192_INT_FREQ_MHZ;
 		break;
 	case AD7192_CLK_INT:
 	case AD7192_CLK_INT_CO:
-		if (pdata->ext_clk_Hz)
-			st->mclk = pdata->ext_clk_Hz;
+		if (pdata->ext_clk_hz)
+			st->mclk = pdata->ext_clk_hz;
 		else
-			st->mclk = AD7192_INT_FREQ_MHz;
+			st->mclk = AD7192_INT_FREQ_MHZ;
 			break;
 	default:
 		ret = -EINVAL;
drivers/staging/iio/adc/ad7192.h +1 -1
index a0a5b61..7433a43 100644
@@ -34,7 +34,7 @@
 struct ad7192_platform_data {
 	u16		vref_mv;
 	u8		clock_source_sel;
-	u32		ext_clk_Hz;
+	u32		ext_clk_hz;
 	bool		refin2_en;
 	bool		rej60_en;
 	bool		sinc3_en;
drivers/staging/iio/adc/ad7280a.c +7 -7
index 828bd57..5ae9455 100644
@@ -89,7 +89,7 @@
 
 #define AD7280A_ALL_CELLS				(0xAD << 16)
 
-#define AD7280A_MAX_SPI_CLK_Hz		700000 /* < 1MHz */
+#define AD7280A_MAX_SPI_CLK_HZ		700000 /* < 1MHz */
 #define AD7280A_MAX_CHAIN		8
 #define AD7280A_CELLS_PER_DEV		6
 #define AD7280A_BITS			12
@@ -832,8 +832,8 @@ static int ad7280_probe(struct spi_device *spi)
 	const struct ad7280_platform_data *pdata = spi->dev.platform_data;
 	struct ad7280_state *st;
 	int ret;
-	const unsigned short tACQ_ns[4] = {465, 1010, 1460, 1890};
-	const unsigned short nAVG[4] = {1, 2, 4, 8};
+	const unsigned short tacq_ns[4] = {465, 1010, 1460, 1890};
+	const unsigned short navg[4] = {1, 2, 4, 8};
 	struct iio_dev *indio_dev;
 
 	indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
@@ -849,7 +849,7 @@ static int ad7280_probe(struct spi_device *spi)
 
 	ad7280_crc8_build_table(st->crc_tab);
 
-	st->spi->max_speed_hz = AD7280A_MAX_SPI_CLK_Hz;
+	st->spi->max_speed_hz = AD7280A_MAX_SPI_CLK_HZ;
 	st->spi->mode = SPI_MODE_1;
 	spi_setup(st->spi);
 
@@ -876,9 +876,9 @@ static int ad7280_probe(struct spi_device *spi)
 	 */
 
 	st->readback_delay_us =
-		((tACQ_ns[pdata->acquisition_time & 0x3] + 695) *
-		(AD7280A_NUM_CH * nAVG[pdata->conversion_averaging & 0x3]))
-		- tACQ_ns[pdata->acquisition_time & 0x3] +
+		((tacq_ns[pdata->acquisition_time & 0x3] + 695) *
+		(AD7280A_NUM_CH * navg[pdata->conversion_averaging & 0x3]))
+		- tacq_ns[pdata->acquisition_time & 0x3] +
 		st->slave_num * 250;
 
 	/* Convert to usecs */
drivers/staging/iio/adc/lpc32xx_adc.c +3 -3
index d11c54b..b411e0b 100644
@@ -43,8 +43,8 @@
 #define LPC32XX_ADC_VALUE(x)	((x) + 0x48)
 
 /* Bit definitions for LPC32XX_ADC_SELECT: */
-#define AD_REFm         0x00000200 /* constant, always write this value! */
-#define AD_REFp		0x00000080 /* constant, always write this value! */
+#define AD_REFM         0x00000200 /* constant, always write this value! */
+#define AD_REFP		0x00000080 /* constant, always write this value! */
 #define AD_IN		0x00000010 /* multiple of this is the */
 				   /* channel number: 0, 1, 2 */
 #define AD_INTERNAL	0x00000004 /* constant, always write this value! */
@@ -78,7 +78,7 @@ static int lpc32xx_read_raw(struct iio_dev *indio_dev,
 		mutex_lock(&indio_dev->mlock);
 		clk_enable(info->clk);
 		/* Measurement setup */
-		__raw_writel(AD_INTERNAL | (chan->address) | AD_REFp | AD_REFm,
+		__raw_writel(AD_INTERNAL | (chan->address) | AD_REFP | AD_REFM,
 			     LPC32XX_ADC_SELECT(info->adc_base));
 		/* Trigger conversion */
 		__raw_writel(AD_PDN_CTRL | AD_STROBE,
Signature · 1 line
2.1.4
#9 lore raw

Re: [Outreachy kernel] [PATCH 08/10] staging: iio: adc: remove the use of CamelCase

Quoted 15 lines · Ioana Ciornei

Remove the use of CamelCase to follow the kernel naming conventions

---
 drivers/staging/iio/adc/ad7192.c      | 12 ++++++------
 drivers/staging/iio/adc/ad7192.h      |  2 +-
 drivers/staging/iio/adc/ad7280a.c     | 14 +++++++-------
 drivers/staging/iio/adc/lpc32xx_adc.c |  6 +++---
 4 files changed, 17 insertions(+), 17 deletions(-)
drivers/staging/iio/adc/ad7192.c +0 -0
index f293dbd..f1d4911 100644

drivers/staging/iio/adc/ad7192.c line 121

Quoted 5 lines
drivers/staging/iio/adc/ad7192.c +1 -1
@@ -118,13 +118,13 @@
 /* GPOCON Register Bit Designations (AD7192_REG_GPOCON) */
 #define AD7192_GPOCON_BPDSW	BIT(6) /* Bridge power-down switch enable */
 #define AD7192_GPOCON_GP32EN	BIT(5) /* Digital Output P3 and P2 enable */
-#define AD7192_GPOCON_GP10EN	BIT(4) /* Digital Output P1 and P0 enable */
+#define AD7193_GPOCON_GP10EN	BIT(4) /* Digital Output P1 and P0 enable */

Why did you change AD7192_GPOCON_GP10EN to AD7193_GPOCON_GP10EN?

And I donot see any camelcase here, not even in the next few conversions.

regards
sudip

#10 lore raw

Re: [Outreachy kernel] [PATCH 08/10] staging: iio: adc: remove the use of CamelCase

Quoted 12 lines · Sudip Mukherjee
Quoted 10 lines · Ioana Ciornei

Remove the use of CamelCase to follow the kernel naming conventions

---
 drivers/staging/iio/adc/ad7192.c      | 12 ++++++------
 drivers/staging/iio/adc/ad7192.h      |  2 +-
 drivers/staging/iio/adc/ad7280a.c     | 14 +++++++-------
 drivers/staging/iio/adc/lpc32xx_adc.c |  6 +++---
 4 files changed, 17 insertions(+), 17 deletions(-)
Quoted 1 line

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/staging/iio/adc/ad7192.c

Quoted 6 lines

drivers/staging/iio/adc/ad7192.c line 119

Quoted 6 lines

index f293dbd..f1d4911 100644

drivers/staging/iio/adc/ad7192.c +0 -0
@@ -118,13 +118,13 @@
 /* GPOCON Register Bit Designations (AD7192_REG_GPOCON) */
 #define AD7192_GPOCON_BPDSW  BIT(6) /* Bridge power-down switch enable

*/

Quoted 1 line

drivers/staging/iio/adc/ad7192.c line 120

Quoted 1 line
drivers/staging/iio/adc/ad7192.c +0 -0
 #define AD7192_GPOCON_GP32EN BIT(5) /* Digital Output P3 and P2 enable

*/

Quoted 1 line

drivers/staging/iio/adc/ad7192.c line 121

Quoted 1 line
drivers/staging/iio/adc/ad7192.c +0 -1
-#define AD7192_GPOCON_GP10EN BIT(4) /* Digital Output P1 and P0 enable

*/

Quoted 1 line

drivers/staging/iio/adc/ad7192.c line 121

Quoted 1 line
drivers/staging/iio/adc/ad7192.c +1 -0
+#define AD7193_GPOCON_GP10EN BIT(4) /* Digital Output P1 and P0 enable

*/

Quoted 5 lines

Why did you change AD7192_GPOCON_GP10EN to AD7193_GPOCON_GP10EN?

And I donot see any camelcase here, not even in the next few conversions.

Sorry for that change from 92 to 93. My mistake. I will send a v2. Regarding the other changes, should I just revert them? Do you consider there is no point in converting them?

Thanks,

Ioana

#11 lore raw

Re: [Outreachy kernel] [PATCH 08/10] staging: iio: adc: remove the use of CamelCase

Quoted 5 lines · Ioana Ciornei
Quoted 3 lines · Sudip Mukherjee
Quoted 1 line · Ioana Ciornei

Remove the use of CamelCase to follow the kernel naming conventions

<snip>

Quoted 9 lines
Quoted 5 lines

Why did you change AD7192_GPOCON_GP10EN to AD7193_GPOCON_GP10EN?

And I donot see any camelcase here, not even in the next few conversions.

Sorry for that change from 92 to 93. My mistake. I will send a v2. Regarding the other changes, should I just revert them? Do you consider there is no point in converting them?

Had a closer look. Only this AD7192_GPOCON_GP10EN to AD7193_GPOCON_GP10EN is not camelcase conversion. Remaining all are. Just leave this one out.

And in a later patch you can even remove this
#define AD7192_GPOCON_GP10EN BIT(4) /* Digital Output P1 and P0 enable */

This one is not used any where and that is the reason you did not see a build failure with this patch.

regards
sudip

#12 lore raw

Re: [Outreachy kernel] [PATCH 08/10] staging: iio: adc: remove the use of CamelCase

Quoted 14 lines · Sudip Mukherjee
Quoted 5 lines · Ioana Ciornei
Quoted 3 lines · Sudip Mukherjee
Quoted 1 line · Ioana Ciornei

Remove the use of CamelCase to follow the kernel naming conventions

<snip>

Quoted 6 lines
Quoted 5 lines

Why did you change AD7192_GPOCON_GP10EN to AD7193_GPOCON_GP10EN?

And I donot see any camelcase here, not even in the next few conversions.

Quoted 7 lines
Quoted 3 lines

Sorry for that change from 92 to 93. My mistake. I will send a v2. Regarding the other changes, should I just revert them? Do you consider there is no point in converting them?

Had a closer look. Only this AD7192_GPOCON_GP10EN to AD7193_GPOCON_GP10EN is not camelcase conversion. Remaining all are. Just leave this one out.

Ok.

Quoted 3 lines

And in a later patch you can even remove this
#define AD7192_GPOCON_GP10EN BIT(4) /* Digital Output P1 and P0 enable */

Sure.

Quoted 4 lines

This one is not used any where and that is the reason you did not see a build failure with this patch.

I will update the patchset and send a v2 with all the modifications.

Thanks,

Ioana

#13 lore raw

PATCH 9/10 staging: iio: adc: use BIT macro

In reply to Ioana Ciornei

Use BIT macro instead of shifting operator in order to improve readability

---
 drivers/staging/iio/adc/mxs-lradc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/iio/adc/mxs-lradc.c +1 -1
index cde7b3a..aae1b0a 100644
@@ -324,7 +324,7 @@ struct mxs_lradc {
 #define	LRADC_DELAY_TRIGGER(x) \
 				(((x) << LRADC_DELAY_TRIGGER_LRADCS_OFFSET) & \
 				LRADC_DELAY_TRIGGER_LRADCS_MASK)
-#define	LRADC_DELAY_KICK			(1 << 20)
+#define	LRADC_DELAY_KICK			BIT(20)
 #define	LRADC_DELAY_TRIGGER_DELAYS_MASK		(0xf << 16)
 #define	LRADC_DELAY_TRIGGER_DELAYS_OFFSET	16
 #define	LRADC_DELAY_TRIGGER_DELAYS(x) \
Signature · 1 line
2.1.4
#14 lore raw

Re: [Outreachy kernel] [PATCH 09/10] staging: iio: adc: use BIT macro

Quoted 5 lines · Ioana Ciornei

Use BIT macro instead of shifting operator in order to improve readability

---

This is introducing build warnings:

drivers/staging/iio/adc/mxs-lradc.c: In function ‘mxs_lradc_complete_touch_event’:
drivers/staging/iio/adc/mxs-lradc.c:728:6: warning: large integer implicitly truncated to unsigned type [-Woverflow]

      LRADC_DELAY(2));
      ^
drivers/staging/iio/adc/mxs-lradc.c: In function ‘mxs_lradc_buffer_preenable’:
drivers/staging/iio/adc/mxs-lradc.c:1292:8: warning: large integer implicitly truncated to unsigned type [-Woverflow]
        LRADC_DELAY_KICK, LRADC_DELAY(0));
        ^
drivers/staging/iio/adc/mxs-lradc.c: In function ‘mxs_lradc_buffer_postdisable’:
drivers/staging/iio/adc/mxs-lradc.c:1311:8: warning: large integer implicitly truncated to unsigned type [-Woverflow]
        LRADC_DELAY_KICK, LRADC_DELAY(0));
        ^

regards
sudip

#15 lore raw

Re: [Outreachy kernel] [PATCH 09/10] staging: iio: adc: use BIT macro

Quoted 11 lines · Sudip Mukherjee
Quoted 5 lines · Ioana Ciornei

Use BIT macro instead of shifting operator in order to improve readability

---

This is introducing build warnings:

drivers/staging/iio/adc/mxs-lradc.c: In function ‘mxs_lradc_complete_touch_event’:
drivers/staging/iio/adc/mxs-lradc.c:728:6: warning: large integer implicitly truncated to unsigned type [-Woverflow]

Quoted 11 lines
      LRADC_DELAY(2));
      ^
drivers/staging/iio/adc/mxs-lradc.c: In function ‘mxs_lradc_buffer_preenable’:
drivers/staging/iio/adc/mxs-lradc.c:1292:8: warning: large integer implicitly truncated to unsigned type [-Woverflow]
        LRADC_DELAY_KICK, LRADC_DELAY(0));
        ^
drivers/staging/iio/adc/mxs-lradc.c: In function ‘mxs_lradc_buffer_postdisable’:
drivers/staging/iio/adc/mxs-lradc.c:1311:8: warning: large integer implicitly truncated to unsigned type [-Woverflow]
        LRADC_DELAY_KICK, LRADC_DELAY(0));
        ^

I did saw the build warnings when I build tested them but I really do not know what should I do in this case.
The problems appear because 1UL' replaces '1' when using the BIT macro. In this case, should it be appropriate to just drop this patch and create a new patchset with just 9 patches?

Thanks,

Ioana

#16 lore raw

Re: [Outreachy kernel] [PATCH 09/10] staging: iio: adc: use BIT macro

Quoted 25 lines · Ioana Ciornei
Quoted 11 lines · Sudip Mukherjee
Quoted 5 lines · Ioana Ciornei

Use BIT macro instead of shifting operator in order to improve readability

---

This is introducing build warnings:

drivers/staging/iio/adc/mxs-lradc.c: In function ‘mxs_lradc_complete_touch_event’:
drivers/staging/iio/adc/mxs-lradc.c:728:6: warning: large integer implicitly truncated to unsigned type [-Woverflow]

Quoted 11 lines
      LRADC_DELAY(2));
      ^
drivers/staging/iio/adc/mxs-lradc.c: In function ‘mxs_lradc_buffer_preenable’:
drivers/staging/iio/adc/mxs-lradc.c:1292:8: warning: large integer implicitly truncated to unsigned type [-Woverflow]
        LRADC_DELAY_KICK, LRADC_DELAY(0));
        ^
drivers/staging/iio/adc/mxs-lradc.c: In function ‘mxs_lradc_buffer_postdisable’:
drivers/staging/iio/adc/mxs-lradc.c:1311:8: warning: large integer implicitly truncated to unsigned type [-Woverflow]
        LRADC_DELAY_KICK, LRADC_DELAY(0));
        ^
Quoted 5 lines

I did saw the build warnings when I build tested them but I really do not know what should I do in this case.
The problems appear because 1UL' replaces '1' when using the BIT macro. In this case, should it be appropriate to just drop this patch and create a new patchset with just 9 patches?

Never send a patch which introduces build warnings. Better send the series with the other 9 patches and meanwhile try to see if you can find any possible solution to this problem. When you find the solution then send that particular patch as a single patch.

regards
sudip

#17 lore raw

Re: [Outreachy kernel] [PATCH 09/10] staging: iio: adc: use BIT macro

Quoted 31 lines · Sudip Mukherjee
Quoted 25 lines · Ioana Ciornei
Quoted 11 lines · Sudip Mukherjee
Quoted 5 lines · Ioana Ciornei

Use BIT macro instead of shifting operator in order to improve readability

---

This is introducing build warnings:

drivers/staging/iio/adc/mxs-lradc.c: In function ‘mxs_lradc_complete_touch_event’:
drivers/staging/iio/adc/mxs-lradc.c:728:6: warning: large integer implicitly truncated to unsigned type [-Woverflow]

Quoted 11 lines
      LRADC_DELAY(2));
      ^
drivers/staging/iio/adc/mxs-lradc.c: In function ‘mxs_lradc_buffer_preenable’:
drivers/staging/iio/adc/mxs-lradc.c:1292:8: warning: large integer implicitly truncated to unsigned type [-Woverflow]
        LRADC_DELAY_KICK, LRADC_DELAY(0));
        ^
drivers/staging/iio/adc/mxs-lradc.c: In function ‘mxs_lradc_buffer_postdisable’:
drivers/staging/iio/adc/mxs-lradc.c:1311:8: warning: large integer implicitly truncated to unsigned type [-Woverflow]
        LRADC_DELAY_KICK, LRADC_DELAY(0));
        ^
Quoted 5 lines

I did saw the build warnings when I build tested them but I really do not know what should I do in this case.
The problems appear because 1UL' replaces '1' when using the BIT macro. In this case, should it be appropriate to just drop this patch and create a new patchset with just 9 patches?

Quoted 5 lines

Never send a patch which introduces build warnings. Better send the series with the other 9 patches and meanwhile try to see if you can find any possible solution to this problem. When you find the solution then send that particular patch as a single patch.

Thanks a lot.

Ioana

#18 lore raw

PATCH 10/10 staging: iio: adc: properly indent block comments

In reply to Ioana Ciornei

Rework block comments in order to follow
kernel coding style

---
 drivers/staging/iio/adc/ad7192.c | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)
drivers/staging/iio/adc/ad7192.c +20 -10
index f1d4911..2a16731 100644
@@ -35,10 +35,14 @@
 #define AD7192_REG_DATA		3 /* Data Register	     (RO, 24/32-bit) */
 #define AD7192_REG_ID		4 /* ID Register	     (RO, 8-bit) */
 #define AD7192_REG_GPOCON	5 /* GPOCON Register	     (RO, 8-bit) */
-#define AD7192_REG_OFFSET	6 /* Offset Register	     (RW, 16-bit
-				   * (AD7792)/24-bit (AD7192)) */
-#define AD7192_REG_FULLSALE	7 /* Full-Scale Register
-				   * (RW, 16-bit (AD7792)/24-bit (AD7192)) */
+#define AD7192_REG_OFFSET	6 /*
+				   * Offset Register	     (RW, 16-bit
+				   * (AD7792)/24-bit (AD7192))
+				   */
+#define AD7192_REG_FULLSALE	7 /*
+				   * Full-Scale Register
+				   * (RW, 16-bit (AD7792)/24-bit (AD7192))
+				   */
 
 /* Communications Register Bit Designations (AD7192_REG_COMM) */
 #define AD7192_COMM_WEN		BIT(7) /* Write Enable */
@@ -80,13 +84,19 @@
 #define AD7192_MODE_CAL_SYS_FULL	7 /* System Full-Scale Calibration */
 
 /* Mode Register: AD7192_MODE_CLKSRC options */
-#define AD7192_CLK_EXT_MCLK1_2		0 /* External 4.92 MHz Clock connected
-					   * from MCLK1 to MCLK2 */
+#define AD7192_CLK_EXT_MCLK1_2		0 /*
+					   * External 4.92 MHz Clock connected
+					   * from MCLK1 to MCLK2
+					   */
 #define AD7192_CLK_EXT_MCLK2		1 /* External Clock applied to MCLK2 */
-#define AD7192_CLK_INT			2 /* Internal 4.92 MHz Clock not
-					   * available at the MCLK2 pin */
-#define AD7192_CLK_INT_CO		3 /* Internal 4.92 MHz Clock available
-					   * at the MCLK2 pin */
+#define AD7192_CLK_INT			2 /*
+					   * Internal 4.92 MHz Clock not
+					   * available at the MCLK2 pin
+					   */
+#define AD7192_CLK_INT_CO		3 /*
+					   * Internal 4.92 MHz Clock available
+					   * at the MCLK2 pin
+					   */
 
 /* Configuration Register Bit Designations (AD7192_REG_CONF) */
 
Signature · 1 line
2.1.4