Skip to contentSkip to conversation

staging: iio: adc: fix multiple checkpatch issues

PATCH Superseded Ioana Ciornei 5 participants 29 messages Oct 9, 2015 – Oct 13, 2015

Subsystems (6)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover staging: iio: adc: fix multiple checkpatch issues

This patchset fixes multiple checkpatch issues.

Changes in v2:
- removed commit 09/10 from previous version since it introduced build warnings

Changes in v3:
- reworked patch 2/9 so that it does not introduce any other checkpatch warnings
- changed the cover letter description in order to keep up with the other updates

Ioana Ciornei (9):
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: properly indent block comments

 drivers/staging/iio/adc/ad7192.c      |  94 ++++++++--------
 drivers/staging/iio/adc/ad7192.h      |   2 +-
 drivers/staging/iio/adc/ad7280a.c     | 196 ++++++++++++++++++----------------
 drivers/staging/iio/adc/ad7606_core.c |  23 ++--
 drivers/staging/iio/adc/ad7606_par.c  |  15 +--
 drivers/staging/iio/adc/ad7606_spi.c  |   5 +-
 drivers/staging/iio/adc/ad7780.c      |  13 +--
 drivers/staging/iio/adc/ad7816.c      |  53 +++++----
 drivers/staging/iio/adc/lpc32xx_adc.c |  20 ++--
 drivers/staging/iio/adc/mxs-lradc.c   | 185 +++++++++++++++++---------------
 drivers/staging/iio/adc/spear_adc.c   |   4 +-
 11 files changed, 323 insertions(+), 287 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH v3 1/9 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

---
Changes in v2:
- nothing
Changes in v3:
- nothing

 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
Reviewed-by on v3 1/9
#2 lore raw

Re: [Outreachy kernel] [PATCH v3 1/9] staging: iio: adc: use kernel types u32 and u64

Quoted 4 lines · Ioana Ciornei

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

Quoted 125 lines

---
Changes in v2:
- nothing
Changes in v3:
- nothing

 drivers/staging/iio/adc/mxs-lradc.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)
drivers/staging/iio/adc/mxs-lradc.c +15 -16
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));
--

2.1.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/e6bc65aa90f1ab391b061fd8a046c452ebcd95a9.1444419393.git.ciorneiioana%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#3 lore raw

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

In reply to Ioana Ciornei

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

---
Changes in v2:
- nothing
Changes in v3:
- rework changes in order to avoid introducing new checkpatch warnings

 drivers/staging/iio/adc/ad7192.c      |  47 +++++-----
 drivers/staging/iio/adc/ad7280a.c     | 163 ++++++++++++++++++----------------
 drivers/staging/iio/adc/ad7606_core.c |  21 +++--
 drivers/staging/iio/adc/ad7606_par.c  |  10 +--
 drivers/staging/iio/adc/ad7606_spi.c  |   4 +-
 drivers/staging/iio/adc/ad7780.c      |  12 +--
 drivers/staging/iio/adc/ad7816.c      |  48 +++++-----
 drivers/staging/iio/adc/lpc32xx_adc.c |  14 +--
 drivers/staging/iio/adc/mxs-lradc.c   | 153 +++++++++++++++++--------------
 drivers/staging/iio/adc/spear_adc.c   |   4 +-
 10 files changed, 253 insertions(+), 223 deletions(-)
drivers/staging/iio/adc/ad7192.c +24 -23
index fe56fb6..5ae7a50 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);
@@ -359,8 +359,9 @@ static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO,
 		ad7192_read_frequency,
 		ad7192_write_frequency);
 
-static ssize_t ad7192_show_scale_available(struct device *dev,
-			struct device_attribute *attr, char *buf)
+static ssize_t
+ad7192_show_scale_available(struct device *dev,
+			    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 +384,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 +394,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 +404,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 +530,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 +557,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 +572,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 +85 -78

298 lines not on this page · raw message

drivers/staging/iio/adc/ad7606_core.c +12 -9
index bf2c801..1e324fe 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,8 @@ 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 +146,8 @@ 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 +168,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 +463,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 +532,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 +594,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 +7 -5
index 9f03fe3..722bb15 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)
@@ -207,8 +207,10 @@ 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");
+		ret = devm_gpio_request_one(&spi->dev,
+					    pdata->gpio_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 +85 -68

360 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
#4 lore raw

Re: [Outreachy kernel] [PATCH v3 2/9] staging: iio: adc: properly indent to match open paranthesis

Quoted 10 lines · Ioana Ciornei

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

---
Changes in v2:
- nothing
Changes in v3:
- rework changes in order to avoid introducing new checkpatch warnings

<snip>

drivers/staging/iio/adc/ad7280a.c static int ad7280_attr_init(struct ad7280_state *st) · line 568

Quoted 5 lines
drivers/staging/iio/adc/ad7280a.c +0 -1
@@ -565,10 +565,11 @@ static int ad7280_attr_init(struct ad7280_state *st)
                        st->iio_attr[cnt].dev_attr.store =
                                ad7280_store_balance_sw;
                        st->iio_attr[cnt].dev_attr.attr.name =
-                               kasprintf(GFP_KERNEL,

This line looks good to me as it is. Is there any particular reason for which you we want GFP_KERNEL to be moved on the next line?

drivers/staging/iio/adc/ad7280a.c static int ad7280_attr_init(struct ad7280_state *st) · line 572

Quoted 7 lines
drivers/staging/iio/adc/ad7280a.c +4 -2
+                               kasprintf(
+                                       GFP_KERNEL,
                                        "in%d-in%d_balance_switch_en",
-                                       (dev * AD7280A_CELLS_PER_DEV) + ch,
-                                       (dev * AD7280A_CELLS_PER_DEV) + ch + 1);
+                                       dev * AD7280A_CELLS_PER_DEV + ch,
+                                       dev * AD7280A_CELLS_PER_DEV + ch + 1);

This lines should be properly aligned.

drivers/staging/iio/adc/ad7280a.c static int ad7280_attr_init(struct ad7280_state *st) · line 587

Quoted 12 lines
drivers/staging/iio/adc/ad7280a.c +2 -3
                        ad7280_attributes[cnt] =
                                &st->iio_attr[cnt].dev_attr.attr;
                        cnt++;
@@ -582,9 +583,11 @@ static int ad7280_attr_init(struct ad7280_state *st)
                        st->iio_attr[cnt].dev_attr.store =
                                ad7280_store_balance_timer;
                        st->iio_attr[cnt].dev_attr.attr.name =
-                               kasprintf(GFP_KERNEL, "in%d-in%d_balance_timer",
-                                       (dev * AD7280A_CELLS_PER_DEV) + ch,
-                                       (dev * AD7280A_CELLS_PER_DEV) + ch + 1);
+                               kasprintf(
+                                       GFP_KERNEL,

The same here.

Quoted 33 lines
drivers/staging/iio/adc/ad7280a.c +8 -5
+                                       "in%d-in%d_balance_timer",
+                                       dev * AD7280A_CELLS_PER_DEV + ch,
+                                       dev * AD7280A_CELLS_PER_DEV + ch + 1);
                        ad7280_attributes[cnt] =
                                &st->iio_attr[cnt].dev_attr.attr;
                }
@@ -595,8 +598,8 @@ static int ad7280_attr_init(struct ad7280_state *st)
 }
 
 static ssize_t ad7280_read_channel_config(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 ad7280_state *st = iio_priv(indio_dev);
@@ -624,9 +627,9 @@ static ssize_t ad7280_read_channel_config(struct device *dev,
 }
 
 static ssize_t ad7280_write_channel_config(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 ad7280_state *st = iio_priv(indio_dev);
@@ -698,39 +701,43 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
                        if (((channels[i] >> 11) & 0xFFF) >=
                                st->cell_threshhigh)

drivers/staging/iio/adc/ad7280a.c static irqreturn_t ad7280_event_handler(int irq, void *private) · line 705

Quoted 10 lines
drivers/staging/iio/adc/ad7280a.c +2 -7
                                iio_push_event(indio_dev,
-                                       IIO_EVENT_CODE(IIO_VOLTAGE,
-                                                      1,
-                                                      0,
-                                                      IIO_EV_DIR_RISING,
-                                                      IIO_EV_TYPE_THRESH,
-                                                      0, 0, 0),
-                                       iio_get_time_ns());
+                                              IIO_EVENT_CODE(
+                                                       IIO_VOLTAGE,

The same here, I think IIO_VOLTAGE should not be moved.

Review static irqreturn_t ad7280_event_handler(int irq, void *private) · line 707

Quoted 2 lines
(quoted diff) +2 -0
+                                                       1,
+                                                       0,

The rest of the patch looks good.

#5 lore raw

Re: [Outreachy kernel] [PATCH v3 2/9] staging: iio: adc: properly indent to match open paranthesis

Quoted 15 lines · Daniel Baluta
Quoted 10 lines · Ioana Ciornei

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

---
Changes in v2:
- nothing
Changes in v3:
- rework changes in order to avoid introducing new checkpatch warnings

<snip>

Quoted 9 lines

drivers/staging/iio/adc/ad7280a.c static int ad7280_attr_init(struct ad7280_state *st) · line 568

Quoted 5 lines
drivers/staging/iio/adc/ad7280a.c +0 -1
@@ -565,10 +565,11 @@ static int ad7280_attr_init(struct ad7280_state *st)
                        st->iio_attr[cnt].dev_attr.store =
                                ad7280_store_balance_sw;
                        st->iio_attr[cnt].dev_attr.attr.name =
-                               kasprintf(GFP_KERNEL,

This line looks good to me as it is. Is there any particular reason for which you we want GFP_KERNEL to be moved on the next line?

I chose to move kasprintf on the next line and all the others arguments also in order to improve readability.
I had to choose between leaving the kasprintf where it was and properly align the arguments to match the open bracket but cross the 80 char limit or moving the kasprintf call on the next line so the arguments are somewhat distinguishable.

Was this a bad call?

Quoted 10 lines

drivers/staging/iio/adc/ad7280a.c static int ad7280_attr_init(struct ad7280_state *st) · line 572

Quoted 8 lines
drivers/staging/iio/adc/ad7280a.c +4 -2
+                               kasprintf(
+                                       GFP_KERNEL,
                                        "in%d-in%d_balance_switch_en",
-                                       (dev * AD7280A_CELLS_PER_DEV) + ch,
-                                       (dev * AD7280A_CELLS_PER_DEV) + ch + 1);
+                                       dev * AD7280A_CELLS_PER_DEV + ch,
+                                       dev * AD7280A_CELLS_PER_DEV + ch + 1);

This lines should be properly aligned.

Answered above.

Quoted 64 lines

drivers/staging/iio/adc/ad7280a.c static int ad7280_attr_init(struct ad7280_state *st) · line 587

Quoted 13 lines
drivers/staging/iio/adc/ad7280a.c +2 -3
                        ad7280_attributes[cnt] =
                                &st->iio_attr[cnt].dev_attr.attr;
                        cnt++;
@@ -582,9 +583,11 @@ static int ad7280_attr_init(struct ad7280_state *st)
                        st->iio_attr[cnt].dev_attr.store =
                                ad7280_store_balance_timer;
                        st->iio_attr[cnt].dev_attr.attr.name =
-                               kasprintf(GFP_KERNEL, "in%d-in%d_balance_timer",
-                                       (dev * AD7280A_CELLS_PER_DEV) + ch,
-                                       (dev * AD7280A_CELLS_PER_DEV) + ch + 1);
+                               kasprintf(
+                                       GFP_KERNEL,

The same here.

Quoted 33 lines
drivers/staging/iio/adc/ad7280a.c +8 -5
+                                       "in%d-in%d_balance_timer",
+                                       dev * AD7280A_CELLS_PER_DEV + ch,
+                                       dev * AD7280A_CELLS_PER_DEV + ch + 1);
                        ad7280_attributes[cnt] =
                                &st->iio_attr[cnt].dev_attr.attr;
                }
@@ -595,8 +598,8 @@ static int ad7280_attr_init(struct ad7280_state *st)
 }
 
 static ssize_t ad7280_read_channel_config(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 ad7280_state *st = iio_priv(indio_dev);
@@ -624,9 +627,9 @@ static ssize_t ad7280_read_channel_config(struct device *dev,
 }
 
 static ssize_t ad7280_write_channel_config(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 ad7280_state *st = iio_priv(indio_dev);
@@ -698,39 +701,43 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
                        if (((channels[i] >> 11) & 0xFFF) >=
                                st->cell_threshhigh)

drivers/staging/iio/adc/ad7280a.c static irqreturn_t ad7280_event_handler(int irq, void *private) · line 705

Quoted 10 lines
drivers/staging/iio/adc/ad7280a.c +2 -7
                                iio_push_event(indio_dev,
-                                       IIO_EVENT_CODE(IIO_VOLTAGE,
-                                                      1,
-                                                      0,
-                                                      IIO_EV_DIR_RISING,
-                                                      IIO_EV_TYPE_THRESH,
-                                                      0, 0, 0),
-                                       iio_get_time_ns());
+                                              IIO_EVENT_CODE(
+                                                       IIO_VOLTAGE,

The same here, I think IIO_VOLTAGE should not be moved.

Quoted 4 lines

Review static irqreturn_t ad7280_event_handler(int irq, void *private) · line 707

Quoted 2 lines
(quoted diff) +2 -0
+                                                       1,
+                                                       0,

The rest of the patch looks good.

Thanks,

Ioana

#6 lore raw

Re: [Outreachy kernel] [PATCH v3 2/9] staging: iio: adc: properly indent to match open paranthesis

Quoted 26 lines · Ioana Ciornei
Quoted 15 lines · Daniel Baluta
Quoted 10 lines · Ioana Ciornei

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

---
Changes in v2:
- nothing
Changes in v3:
- rework changes in order to avoid introducing new checkpatch warnings

<snip>

Quoted 9 lines

drivers/staging/iio/adc/ad7280a.c static int ad7280_attr_init(struct ad7280_state *st) · line 568

Quoted 5 lines
drivers/staging/iio/adc/ad7280a.c +0 -1
@@ -565,10 +565,11 @@ static int ad7280_attr_init(struct ad7280_state *st)
                        st->iio_attr[cnt].dev_attr.store =
                                ad7280_store_balance_sw;
                        st->iio_attr[cnt].dev_attr.attr.name =
-                               kasprintf(GFP_KERNEL,

This line looks good to me as it is. Is there any particular reason for which you we want GFP_KERNEL to be moved on the next line?

Quoted 8 lines

I chose to move kasprintf on the next line and all the others arguments also in order to improve readability.
I had to choose between leaving the kasprintf where it was and properly align the arguments to match the open bracket but cross the 80 char limit or moving the kasprintf call on the next line so the arguments are somewhat distinguishable.

Was this a bad call?

It's not really normal to see the first argument on a different line. Do the other arguments not fit if they are lines up with the right side of the (? Perhaps it is possible to break up the longer arguments more so that they fit better?

julia

Quoted 95 lines
Quoted 11 lines

drivers/staging/iio/adc/ad7280a.c static int ad7280_attr_init(struct ad7280_state *st) · line 572

Quoted 9 lines
drivers/staging/iio/adc/ad7280a.c +4 -2
+                               kasprintf(
+                                       GFP_KERNEL,
                                        "in%d-in%d_balance_switch_en",
-                                       (dev * AD7280A_CELLS_PER_DEV) + ch,
-                                       (dev * AD7280A_CELLS_PER_DEV) + ch + 1);
+                                       dev * AD7280A_CELLS_PER_DEV + ch,
+                                       dev * AD7280A_CELLS_PER_DEV + ch + 1);

This lines should be properly aligned.

Answered above.

Quoted 64 lines

drivers/staging/iio/adc/ad7280a.c static int ad7280_attr_init(struct ad7280_state *st) · line 587

Quoted 13 lines
drivers/staging/iio/adc/ad7280a.c +2 -3
                        ad7280_attributes[cnt] =
                                &st->iio_attr[cnt].dev_attr.attr;
                        cnt++;
@@ -582,9 +583,11 @@ static int ad7280_attr_init(struct ad7280_state *st)
                        st->iio_attr[cnt].dev_attr.store =
                                ad7280_store_balance_timer;
                        st->iio_attr[cnt].dev_attr.attr.name =
-                               kasprintf(GFP_KERNEL, "in%d-in%d_balance_timer",
-                                       (dev * AD7280A_CELLS_PER_DEV) + ch,
-                                       (dev * AD7280A_CELLS_PER_DEV) + ch + 1);
+                               kasprintf(
+                                       GFP_KERNEL,

The same here.

Quoted 33 lines
drivers/staging/iio/adc/ad7280a.c +8 -5
+                                       "in%d-in%d_balance_timer",
+                                       dev * AD7280A_CELLS_PER_DEV + ch,
+                                       dev * AD7280A_CELLS_PER_DEV + ch + 1);
                        ad7280_attributes[cnt] =
                                &st->iio_attr[cnt].dev_attr.attr;
                }
@@ -595,8 +598,8 @@ static int ad7280_attr_init(struct ad7280_state *st)
 }
 
 static ssize_t ad7280_read_channel_config(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 ad7280_state *st = iio_priv(indio_dev);
@@ -624,9 +627,9 @@ static ssize_t ad7280_read_channel_config(struct device *dev,
 }
 
 static ssize_t ad7280_write_channel_config(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 ad7280_state *st = iio_priv(indio_dev);
@@ -698,39 +701,43 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
                        if (((channels[i] >> 11) & 0xFFF) >=
                                st->cell_threshhigh)

drivers/staging/iio/adc/ad7280a.c static irqreturn_t ad7280_event_handler(int irq, void *private) · line 705

Quoted 10 lines
drivers/staging/iio/adc/ad7280a.c +2 -7
                                iio_push_event(indio_dev,
-                                       IIO_EVENT_CODE(IIO_VOLTAGE,
-                                                      1,
-                                                      0,
-                                                      IIO_EV_DIR_RISING,
-                                                      IIO_EV_TYPE_THRESH,
-                                                      0, 0, 0),
-                                       iio_get_time_ns());
+                                              IIO_EVENT_CODE(
+                                                       IIO_VOLTAGE,

The same here, I think IIO_VOLTAGE should not be moved.

Quoted 4 lines

Review static irqreturn_t ad7280_event_handler(int irq, void *private) · line 707

Quoted 2 lines
(quoted diff) +2 -0
+                                                       1,
+                                                       0,

The rest of the patch looks good.

Thanks,

Ioana

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAHWJYFn-cd5tCRRjU-vV72-x5HM%2B%3Du5uojF6cYFT3XjqyjKE8g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

#7 lore raw

Re: [Outreachy kernel] [PATCH v3 2/9] staging: iio: adc: properly indent to match open paranthesis

Quoted 37 lines · Julia Lawall
Quoted 33 lines · Ioana Ciornei
Quoted 15 lines · Daniel Baluta
Quoted 10 lines · Ioana Ciornei

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

---
Changes in v2:
- nothing
Changes in v3:
- rework changes in order to avoid introducing new checkpatch warnings

<snip>

Quoted 9 lines

drivers/staging/iio/adc/ad7280a.c static int ad7280_attr_init(struct ad7280_state *st) · line 568

Quoted 5 lines
drivers/staging/iio/adc/ad7280a.c +0 -1
@@ -565,10 +565,11 @@ static int ad7280_attr_init(struct ad7280_state *st)
                        st->iio_attr[cnt].dev_attr.store =
                                ad7280_store_balance_sw;
                        st->iio_attr[cnt].dev_attr.attr.name =
-                               kasprintf(GFP_KERNEL,

This line looks good to me as it is. Is there any particular reason for which you we want GFP_KERNEL to be moved on the next line?

I chose to move kasprintf on the next line and all the others arguments also in order to improve readability.
I had to choose between leaving the kasprintf where it was and properly align the arguments to match the open bracket but cross the 80 char limit or moving the kasprintf call on the next line so the arguments are somewhat distinguishable.

Quoted 7 lines
Quoted 1 line

Was this a bad call?

It's not really normal to see the first argument on a different line. Do the other arguments not fit if they are lines up with the right side of the (? Perhaps it is possible to break up the longer arguments more so that they fit better?

The first argument fits, the problem is with the other ones. Well, now that I think of... yes there is a solution to this. If use a variable instead of 'dev * AD7280A_CELLS_PER_DEV + ch' all the problems would be solved.

Is this a proper way to handle it?

Thanks,

Ioana

Quoted 96 lines
Quoted 96 lines
Quoted 11 lines

drivers/staging/iio/adc/ad7280a.c static int ad7280_attr_init(struct ad7280_state *st) · line 572

Quoted 10 lines
drivers/staging/iio/adc/ad7280a.c +4 -2
+                               kasprintf(
+                                       GFP_KERNEL,
                                        "in%d-in%d_balance_switch_en",
-                                       (dev * AD7280A_CELLS_PER_DEV) + ch,
-                                       (dev * AD7280A_CELLS_PER_DEV) + ch + 1);
+                                       dev * AD7280A_CELLS_PER_DEV + ch,
+                                       dev * AD7280A_CELLS_PER_DEV + ch + 1);
Quoted 1 line

This lines should be properly aligned.

Answered above.

Quoted 64 lines

drivers/staging/iio/adc/ad7280a.c static int ad7280_attr_init(struct ad7280_state *st) · line 587

Quoted 13 lines
drivers/staging/iio/adc/ad7280a.c +2 -3
                        ad7280_attributes[cnt] =
                                &st->iio_attr[cnt].dev_attr.attr;
                        cnt++;
@@ -582,9 +583,11 @@ static int ad7280_attr_init(struct ad7280_state *st)
                        st->iio_attr[cnt].dev_attr.store =
                                ad7280_store_balance_timer;
                        st->iio_attr[cnt].dev_attr.attr.name =
-                               kasprintf(GFP_KERNEL, "in%d-in%d_balance_timer",
-                                       (dev * AD7280A_CELLS_PER_DEV) + ch,
-                                       (dev * AD7280A_CELLS_PER_DEV) + ch + 1);
+                               kasprintf(
+                                       GFP_KERNEL,

The same here.

Quoted 33 lines
drivers/staging/iio/adc/ad7280a.c +8 -5
+                                       "in%d-in%d_balance_timer",
+                                       dev * AD7280A_CELLS_PER_DEV + ch,
+                                       dev * AD7280A_CELLS_PER_DEV + ch + 1);
                        ad7280_attributes[cnt] =
                                &st->iio_attr[cnt].dev_attr.attr;
                }
@@ -595,8 +598,8 @@ static int ad7280_attr_init(struct ad7280_state *st)
 }
 
 static ssize_t ad7280_read_channel_config(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 ad7280_state *st = iio_priv(indio_dev);
@@ -624,9 +627,9 @@ static ssize_t ad7280_read_channel_config(struct device *dev,
 }
 
 static ssize_t ad7280_write_channel_config(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 ad7280_state *st = iio_priv(indio_dev);
@@ -698,39 +701,43 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
                        if (((channels[i] >> 11) & 0xFFF) >=
                                st->cell_threshhigh)

drivers/staging/iio/adc/ad7280a.c static irqreturn_t ad7280_event_handler(int irq, void *private) · line 705

Quoted 10 lines
drivers/staging/iio/adc/ad7280a.c +2 -7
                                iio_push_event(indio_dev,
-                                       IIO_EVENT_CODE(IIO_VOLTAGE,
-                                                      1,
-                                                      0,
-                                                      IIO_EV_DIR_RISING,
-                                                      IIO_EV_TYPE_THRESH,
-                                                      0, 0, 0),
-                                       iio_get_time_ns());
+                                              IIO_EVENT_CODE(
+                                                       IIO_VOLTAGE,

The same here, I think IIO_VOLTAGE should not be moved.

Quoted 4 lines

Review static irqreturn_t ad7280_event_handler(int irq, void *private) · line 707

Quoted 2 lines
(quoted diff) +2 -0
+                                                       1,
+                                                       0,

The rest of the patch looks good.

Thanks,

Ioana

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAHWJYFn-cd5tCRRjU-vV72-x5HM%2B%3Du5uojF6cYFT3XjqyjKE8g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Signature · 3 lines
Ioana Ciornei
Facultatea de Automatica si Calculatoare, UPB
Tel. 0753 861 668
#8 lore raw

Re: [Outreachy kernel] [PATCH v3 2/9] staging: iio: adc: properly indent to match open paranthesis

Quoted 46 lines · Ioana Ciornei
Quoted 37 lines · Julia Lawall
Quoted 33 lines · Ioana Ciornei
Quoted 15 lines · Daniel Baluta
Quoted 10 lines · Ioana Ciornei

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

---
Changes in v2:
- nothing
Changes in v3:
- rework changes in order to avoid introducing new checkpatch warnings

<snip>

Quoted 9 lines

drivers/staging/iio/adc/ad7280a.c static int ad7280_attr_init(struct ad7280_state *st) · line 568

Quoted 5 lines
drivers/staging/iio/adc/ad7280a.c +0 -1
@@ -565,10 +565,11 @@ static int ad7280_attr_init(struct ad7280_state *st)
                        st->iio_attr[cnt].dev_attr.store =
                                ad7280_store_balance_sw;
                        st->iio_attr[cnt].dev_attr.attr.name =
-                               kasprintf(GFP_KERNEL,

This line looks good to me as it is. Is there any particular reason for which you we want GFP_KERNEL to be moved on the next line?

I chose to move kasprintf on the next line and all the others arguments also in order to improve readability.
I had to choose between leaving the kasprintf where it was and properly align the arguments to match the open bracket but cross the 80 char limit or moving the kasprintf call on the next line so the arguments are somewhat distinguishable.

Quoted 7 lines
Quoted 1 line

Was this a bad call?

It's not really normal to see the first argument on a different line. Do the other arguments not fit if they are lines up with the right side of the (? Perhaps it is possible to break up the longer arguments more so that they fit better?

Quoted 6 lines

The first argument fits, the problem is with the other ones. Well, now that I think of... yes there is a solution to this. If use a variable instead of 'dev * AD7280A_CELLS_PER_DEV + ch' all the problems would be solved.

Is this a proper way to handle it?

Maybe a variable with a name like num_cells, that is dev * AD7280A_CELLS_PER_DEV?

julia

Quoted 117 lines

Thanks,

Ioana

Quoted 89 lines
Quoted 89 lines
Quoted 11 lines

drivers/staging/iio/adc/ad7280a.c static int ad7280_attr_init(struct ad7280_state *st) · line 572

Quoted 10 lines
drivers/staging/iio/adc/ad7280a.c +4 -2
+                               kasprintf(
+                                       GFP_KERNEL,
                                        "in%d-in%d_balance_switch_en",
-                                       (dev * AD7280A_CELLS_PER_DEV) + ch,
-                                       (dev * AD7280A_CELLS_PER_DEV) + ch + 1);
+                                       dev * AD7280A_CELLS_PER_DEV + ch,
+                                       dev * AD7280A_CELLS_PER_DEV + ch + 1);
Quoted 1 line

This lines should be properly aligned.

Answered above.

Quoted 64 lines

drivers/staging/iio/adc/ad7280a.c static int ad7280_attr_init(struct ad7280_state *st) · line 587

Quoted 13 lines
drivers/staging/iio/adc/ad7280a.c +2 -3
                        ad7280_attributes[cnt] =
                                &st->iio_attr[cnt].dev_attr.attr;
                        cnt++;
@@ -582,9 +583,11 @@ static int ad7280_attr_init(struct ad7280_state *st)
                        st->iio_attr[cnt].dev_attr.store =
                                ad7280_store_balance_timer;
                        st->iio_attr[cnt].dev_attr.attr.name =
-                               kasprintf(GFP_KERNEL, "in%d-in%d_balance_timer",
-                                       (dev * AD7280A_CELLS_PER_DEV) + ch,
-                                       (dev * AD7280A_CELLS_PER_DEV) + ch + 1);
+                               kasprintf(
+                                       GFP_KERNEL,

The same here.

Quoted 33 lines
drivers/staging/iio/adc/ad7280a.c +8 -5
+                                       "in%d-in%d_balance_timer",
+                                       dev * AD7280A_CELLS_PER_DEV + ch,
+                                       dev * AD7280A_CELLS_PER_DEV + ch + 1);
                        ad7280_attributes[cnt] =
                                &st->iio_attr[cnt].dev_attr.attr;
                }
@@ -595,8 +598,8 @@ static int ad7280_attr_init(struct ad7280_state *st)
 }
 
 static ssize_t ad7280_read_channel_config(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 ad7280_state *st = iio_priv(indio_dev);
@@ -624,9 +627,9 @@ static ssize_t ad7280_read_channel_config(struct device *dev,
 }
 
 static ssize_t ad7280_write_channel_config(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 ad7280_state *st = iio_priv(indio_dev);
@@ -698,39 +701,43 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
                        if (((channels[i] >> 11) & 0xFFF) >=
                                st->cell_threshhigh)

drivers/staging/iio/adc/ad7280a.c static irqreturn_t ad7280_event_handler(int irq, void *private) · line 705

Quoted 10 lines
drivers/staging/iio/adc/ad7280a.c +2 -7
                                iio_push_event(indio_dev,
-                                       IIO_EVENT_CODE(IIO_VOLTAGE,
-                                                      1,
-                                                      0,
-                                                      IIO_EV_DIR_RISING,
-                                                      IIO_EV_TYPE_THRESH,
-                                                      0, 0, 0),
-                                       iio_get_time_ns());
+                                              IIO_EVENT_CODE(
+                                                       IIO_VOLTAGE,

The same here, I think IIO_VOLTAGE should not be moved.

Quoted 4 lines

Review static irqreturn_t ad7280_event_handler(int irq, void *private) · line 707

Quoted 2 lines
(quoted diff) +2 -0
+                                                       1,
+                                                       0,

The rest of the patch looks good.

Thanks,

Ioana

Quoted 7 lines
Quoted 7 lines

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAHWJYFn-cd5tCRRjU-vV72-x5HM%2B%3Du5uojF6cYFT3XjqyjKE8g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
Ioana Ciornei
Facultatea de Automatica si Calculatoare, UPB
Tel. 0753 861 668

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAHWJYFnB%3Do_UYGcT%3DB4LYZ%2BjwcERBsHDSc1_dJ%3Dn%2BkaTBkgSiw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

#9 lore raw

Re: [Outreachy kernel] [PATCH v3 2/9] staging: iio: adc: properly indent to match open paranthesis

In reply to Ioana Ciornei
Quoted 46 lines · Ioana Ciornei
Quoted 37 lines · Julia Lawall
Quoted 33 lines · Ioana Ciornei
Quoted 15 lines · Daniel Baluta
Quoted 10 lines · Ioana Ciornei

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

---
Changes in v2:
- nothing
Changes in v3:
- rework changes in order to avoid introducing new checkpatch warnings

<snip>

Quoted 9 lines

drivers/staging/iio/adc/ad7280a.c static int ad7280_attr_init(struct ad7280_state *st) · line 568

Quoted 5 lines
drivers/staging/iio/adc/ad7280a.c +0 -1
@@ -565,10 +565,11 @@ static int ad7280_attr_init(struct ad7280_state *st)
                        st->iio_attr[cnt].dev_attr.store =
                                ad7280_store_balance_sw;
                        st->iio_attr[cnt].dev_attr.attr.name =
-                               kasprintf(GFP_KERNEL,

This line looks good to me as it is. Is there any particular reason for which you we want GFP_KERNEL to be moved on the next line?

I chose to move kasprintf on the next line and all the others arguments also in order to improve readability.
I had to choose between leaving the kasprintf where it was and properly align the arguments to match the open bracket but cross the 80 char limit or moving the kasprintf call on the next line so the arguments are somewhat distinguishable.

Quoted 7 lines
Quoted 1 line

Was this a bad call?

It's not really normal to see the first argument on a different line. Do the other arguments not fit if they are lines up with the right side of the (? Perhaps it is possible to break up the longer arguments more so that they fit better?

Quoted 6 lines

The first argument fits, the problem is with the other ones. Well, now that I think of... yes there is a solution to this. If use a variable instead of 'dev * AD7280A_CELLS_PER_DEV + ch' all the problems would be solved.

Is this a proper way to handle it?

Today morning Greg said in a review of one patch "No need to create a whole new variable when you only use it once."

reference at: https://lkml.org/lkml/2015/10/13/27

regards
sudip

#10 lore raw

Re: [Outreachy kernel] [PATCH v3 2/9] staging: iio: adc: properly indent to match open paranthesis

Quoted 52 lines · Sudip Mukherjee
Quoted 51 lines · Ioana Ciornei
Quoted 37 lines · Julia Lawall
Quoted 33 lines · Ioana Ciornei
Quoted 15 lines · Daniel Baluta
Quoted 10 lines · Ioana Ciornei

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

---
Changes in v2:
- nothing
Changes in v3:
- rework changes in order to avoid introducing new checkpatch warnings

<snip>

Quoted 9 lines

drivers/staging/iio/adc/ad7280a.c static int ad7280_attr_init(struct ad7280_state *st) · line 568

Quoted 5 lines
drivers/staging/iio/adc/ad7280a.c +0 -1
@@ -565,10 +565,11 @@ static int ad7280_attr_init(struct ad7280_state *st)
                        st->iio_attr[cnt].dev_attr.store =
                                ad7280_store_balance_sw;
                        st->iio_attr[cnt].dev_attr.attr.name =
-                               kasprintf(GFP_KERNEL,

This line looks good to me as it is. Is there any particular reason for which you we want GFP_KERNEL to be moved on the next line?

I chose to move kasprintf on the next line and all the others arguments also in order to improve readability.
I had to choose between leaving the kasprintf where it was and properly align the arguments to match the open bracket but cross the 80 char limit or moving the kasprintf call on the next line so the arguments are somewhat distinguishable.

Quoted 7 lines
Quoted 1 line

Was this a bad call?

It's not really normal to see the first argument on a different line. Do the other arguments not fit if they are lines up with the right side of the (? Perhaps it is possible to break up the longer arguments more so that they fit better?

The first argument fits, the problem is with the other ones. Well, now that I think of... yes there is a solution to this. If use a variable instead of 'dev * AD7280A_CELLS_PER_DEV + ch' all the problems would be solved.

Quoted 4 lines
Quoted 1 line

Is this a proper way to handle it?

Today morning Greg said in a review of one patch "No need to create a whole new variable when you only use it once."

It would be used twice, actually :)

julia

Quoted 5 lines

reference at: https://lkml.org/lkml/2015/10/13/27

regards
sudip

#11 lore raw

Re: [Outreachy kernel] [PATCH v3 2/9] staging: iio: adc: properly indent to match open paranthesis

In reply to Ioana Ciornei
Quoted 46 lines · Ioana Ciornei
Quoted 37 lines · Julia Lawall
Quoted 33 lines · Ioana Ciornei
Quoted 15 lines · Daniel Baluta
Quoted 10 lines · Ioana Ciornei

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

---
Changes in v2:
- nothing
Changes in v3:
- rework changes in order to avoid introducing new checkpatch warnings

<snip>

Quoted 9 lines

drivers/staging/iio/adc/ad7280a.c static int ad7280_attr_init(struct ad7280_state *st) · line 568

Quoted 5 lines
drivers/staging/iio/adc/ad7280a.c +0 -1
@@ -565,10 +565,11 @@ static int ad7280_attr_init(struct ad7280_state *st)
                        st->iio_attr[cnt].dev_attr.store =
                                ad7280_store_balance_sw;
                        st->iio_attr[cnt].dev_attr.attr.name =
-                               kasprintf(GFP_KERNEL,

This line looks good to me as it is. Is there any particular reason for which you we want GFP_KERNEL to be moved on the next line?

I chose to move kasprintf on the next line and all the others arguments also in order to improve readability.
I had to choose between leaving the kasprintf where it was and properly align the arguments to match the open bracket but cross the 80 char limit or moving the kasprintf call on the next line so the arguments are somewhat distinguishable.

Quoted 7 lines
Quoted 1 line

Was this a bad call?

It's not really normal to see the first argument on a different line. Do the other arguments not fit if they are lines up with the right side of the (? Perhaps it is possible to break up the longer arguments more so that they fit better?

Quoted 6 lines

The first argument fits, the problem is with the other ones. Well, now that I think of... yes there is a solution to this. If use a variable instead of 'dev * AD7280A_CELLS_PER_DEV + ch' all the problems would be solved.

Is this a proper way to handle it?

There will be one line of 81 chars. This is ok in my opinion.

As an alternative, we can move the closing parenthesis on a new line but this is ugly:

»       »       »       »       kasprintf(GFP_KERNEL,
»       »       »       »       »
"in%d-in%d_balance_switch_en",
»       »       »       »       »         dev * AD7280A_CELLS_PER_DEV + ch,
»       »       »       »       »         dev * AD7280A_CELLS_PER_DEV + ch + 1
»       »       »       »       »         );

So, let's go with having a line with 81 chars.

thanks,
Daniel.

#12 lore raw

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

In reply to Ioana Ciornei

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

---

Changes in v2:
- nothing
Changes in v3:
- nothing

 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 5ae7a50..6adac61 100644
@@ -626,7 +626,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 d3db25f..8ee2868 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++)
@@ -550,7 +550,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++)
@@ -689,7 +689,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);
@@ -846,7 +846,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 f250aaf..407d4a2 100644
@@ -1232,7 +1232,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
#14 lore raw

PATCH v3 4/9 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

---

Changes in v2:
- nothing
Changes in v3:
- nothing

 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 6adac61..e7212c8 100644
@@ -424,7 +424,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 8ee2868..2c07198 100644
@@ -606,7 +606,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;
@@ -642,7 +642,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 */
@@ -658,7 +658,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 1e324fe..5796ed2 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
Reviewed-by on v3 4/9
#15 lore raw

Re: [Outreachy kernel] [PATCH v3 4/9] staging: iio: adc: remove space after cast

Quoted 4 lines · Ioana Ciornei

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

Quoted 96 lines

---

Changes in v2:
- nothing
Changes in v3:
- nothing

 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 6adac61..e7212c8 100644
@@ -424,7 +424,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 8ee2868..2c07198 100644
@@ -606,7 +606,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;
@@ -642,7 +642,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 */
@@ -658,7 +658,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 1e324fe..5796ed2 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 -3
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;
 }
--

2.1.4

--

#16 lore raw

PATCH v3 5/9 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

---

Changes in v2:
- nothing
Changes in v3:
- nothing

 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 e7212c8..1bae258 100644
@@ -377,7 +377,7 @@ 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 2c07198..e8e1eb1 100644
@@ -748,14 +748,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
#17 lore raw

Re: [Outreachy kernel] [PATCH v3 5/9] staging: iio: adc: add spaces around binary operators

Quoted 21 lines · Ioana Ciornei

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

---

Changes in v2:
- nothing
Changes in v3:
- nothing

 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 +0 -0
index e7212c8..1bae258 100644

drivers/staging/iio/adc/ad7192.c ad7192_show_scale_available(struct device *dev, · line 380

Quoted 5 lines
drivers/staging/iio/adc/ad7192.c +1 -1
@@ -377,7 +377,7 @@ 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,

This is not ok :). in_voltage-voltage_scale_available is the name of an IIO sysfs
attribute exposed to user space. '-' is a part of the name, there is no binary operator
here.

If checkpatch complains about this then it's a false positive.

Quoted 8 lines
drivers/staging/iio/adc/ad7192.c +0 -0
                             S_IRUGO, ad7192_show_scale_available, NULL, 0);
 
 static IIO_DEVICE_ATTR(in_voltage_scale_available, S_IRUGO,
drivers/staging/iio/adc/ad7280a.c +0 -0
index 2c07198..e8e1eb1 100644

drivers/staging/iio/adc/ad7280a.c out: · line 755

Quoted 9 lines
drivers/staging/iio/adc/ad7280a.c +1 -1
@@ -748,14 +748,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);

Ditto.

drivers/staging/iio/adc/ad7280a.c out: · line 758

Quoted 4 lines
drivers/staging/iio/adc/ad7280a.c +1 -1
 static IIO_DEVICE_ATTR_NAMED(in_thresh_high_value,
-               in_voltage-voltage_thresh_high_value,
+               in_voltage - voltage_thresh_high_value,

Ditto.

drivers/staging/iio/adc/ad7816.c struct ad7816_chip_info { · line 51

Quoted 13 lines
drivers/staging/iio/adc/ad7280a.c +0 -0
                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];

This is ok.

Quoted 12 lines
drivers/staging/iio/adc/ad7816.c +0 -1
        u8  channel_id; /* 0 always be temperature */
        u8  mode;
 };
--

2.1.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/d94402f948a0d2561ee046fd5fcb56ea562ab1bf.1444419393.git.ciorneiioana%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#18 lore raw

Re: [Outreachy kernel] [PATCH v3 5/9] staging: iio: adc: add spaces around binary operators

Quoted 34 lines · Daniel Baluta
Quoted 21 lines · Ioana Ciornei

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

---

Changes in v2:
- nothing
Changes in v3:
- nothing

 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 +0 -0
index e7212c8..1bae258 100644

drivers/staging/iio/adc/ad7192.c ad7192_show_scale_available(struct device *dev, · line 380

Quoted 5 lines
drivers/staging/iio/adc/ad7192.c +1 -1
@@ -377,7 +377,7 @@ 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,

This is not ok :). in_voltage-voltage_scale_available is the name of an IIO sysfs
attribute exposed to user space. '-' is a part of the name, there is no binary operator
here.

Quoted 1 line

If checkpatch complains about this then it's a false positive.

Yes, checkpatch generated a warning and also there were no build errors. Sorry about this. I will send a v2.

Ioana

Quoted 57 lines
Quoted 10 lines
drivers/staging/iio/adc/ad7192.c +0 -0
                             S_IRUGO, ad7192_show_scale_available, NULL, 0);
 
 static IIO_DEVICE_ATTR(in_voltage_scale_available, S_IRUGO,
drivers/staging/iio/adc/ad7280a.c +0 -0
index 2c07198..e8e1eb1 100644

drivers/staging/iio/adc/ad7280a.c out: · line 755

Quoted 9 lines
drivers/staging/iio/adc/ad7280a.c +1 -1
@@ -748,14 +748,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);

Ditto.

drivers/staging/iio/adc/ad7280a.c out: · line 758

Quoted 4 lines
drivers/staging/iio/adc/ad7280a.c +1 -1
 static IIO_DEVICE_ATTR_NAMED(in_thresh_high_value,
-               in_voltage-voltage_thresh_high_value,
+               in_voltage - voltage_thresh_high_value,

Ditto.

drivers/staging/iio/adc/ad7816.c struct ad7816_chip_info { · line 51

Quoted 13 lines
drivers/staging/iio/adc/ad7280a.c +0 -0
                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];

This is ok.

Quoted 12 lines
drivers/staging/iio/adc/ad7816.c +0 -1
        u8  channel_id; /* 0 always be temperature */
        u8  mode;
 };
--

2.1.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/d94402f948a0d2561ee046fd5fcb56ea562ab1bf.1444419393.git.ciorneiioana%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

maintainer
#19 lore raw

Re: [Outreachy kernel] [PATCH v3 5/9] staging: iio: adc: add spaces around binary operators

Quoted 35 lines · Ioana Ciornei
Quoted 34 lines · Daniel Baluta
Quoted 21 lines · Ioana Ciornei

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

---

Changes in v2:
- nothing
Changes in v3:
- nothing

 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 +0 -0
index e7212c8..1bae258 100644

drivers/staging/iio/adc/ad7192.c ad7192_show_scale_available(struct device *dev, · line 380

Quoted 5 lines
drivers/staging/iio/adc/ad7192.c +1 -1
@@ -377,7 +377,7 @@ 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,

This is not ok :). in_voltage-voltage_scale_available is the name of an IIO sysfs
attribute exposed to user space. '-' is a part of the name, there is no binary operator
here.

Quoted 5 lines
Quoted 1 line

If checkpatch complains about this then it's a false positive.

Yes, checkpatch generated a warning and also there were no build errors. Sorry about this. I will send a v2.

You mean "v4", right? This is v3 already...

#20 lore raw

Re: [Outreachy kernel] [PATCH v3 5/9] staging: iio: adc: add spaces around binary operators

Quoted 2 lines · Greg KH
Quoted 1 line · Ioana Ciornei

On Mon, Oct 12, 2015 at 7:38 PM, Daniel Baluta <[email protected]>

Quoted 1 line · wrote:
Quoted 1 line
Quoted 1 line

On Fri, Oct 9, 2015 at 10:51 PM, Ioana Ciornei <[email protected]>

Quoted 11 lines · wrote:
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

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

---

Changes in v2:
- nothing
Changes in v3:
- nothing

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Review

Quoted 6 lines
 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(-)
(quoted diff) +0 -0

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

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines

drivers/staging/iio/adc/ad7192.c ad7192_show_scale_available(struct device *dev, · line 380

Quoted 9 lines

index e7212c8..1bae258 100644

drivers/staging/iio/adc/ad7192.c +1 -1
@@ -377,7 +377,7 @@ 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,

This is not ok :). in_voltage-voltage_scale_available is the name of an IIO sysfs
attribute exposed to user space. '-' is a part of the name, there is no binary operator
here.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

If checkpatch complains about this then it's a false positive.

Yes, checkpatch generated a warning and also there were no build errors. Sorry about this. I will send a v2.

You mean "v4", right? This is v3 already...

Yes, I was meaning v4. I will send it right away.

Ioana

#21 lore raw

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

In reply to Ioana Ciornei

Insert a blank line after declarations

---

Changes in v2:
- nothing
Changes in v3:
- nothing

 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
Reviewed-by on v3 6/9
#22 lore raw

Re: [Outreachy kernel] [PATCH v3 6/9] staging: iio: adc: add blank line after declarations

Quoted 3 lines · Ioana Ciornei

Insert a blank line after declarations

Quoted 44 lines

---

Changes in v2:
- nothing
Changes in v3:
- nothing

 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 -1
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
--

2.1.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/dda33ad15dafe15f720f120eb5c0d87efb52f391.1444419393.git.ciorneiioana%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#23 lore raw

PATCH v3 7/9 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

---

Changes in v2:
- nothing
Changes in v3:
- nothing

 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 1bae258..5f2b5a6 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 e8e1eb1..2be3475 100644
@@ -773,7 +773,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 722bb15..618b41f 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,
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
Reviewed-by on v3 7/9
#24 lore raw

Re: [Outreachy kernel] [PATCH v3 7/9] staging: iio: adc: remove multiple blank lines

Quoted 4 lines · Ioana Ciornei

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

Quoted 86 lines

---

Changes in v2:
- nothing
Changes in v3:
- nothing

 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 1bae258..5f2b5a6 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 e8e1eb1..2be3475 100644
@@ -773,7 +773,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 722bb15..618b41f 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,
drivers/staging/iio/adc/ad7816.c +0 -4
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)
--

2.1.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/35c56be9ce1f3e1af6510fb788fccc3043d339ac.1444419393.git.ciorneiioana%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#25 lore raw

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

In reply to Ioana Ciornei

Remove the use of CamelCase to follow the kernel naming conventions

---
Changes in v2:
- remove change added by mistake in v1
Changes in v3:
- nothing

 drivers/staging/iio/adc/ad7192.c      | 10 +++++-----
 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, 16 insertions(+), 16 deletions(-)
drivers/staging/iio/adc/ad7192.c +5 -5
index 5f2b5a6..c9a706a 100644
@@ -124,7 +124,7 @@
 #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 2be3475..f9f3670 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
@@ -840,8 +840,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));
@@ -857,7 +857,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);
 
@@ -884,9 +884,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
#26 lore raw

Re: [Outreachy kernel] [PATCH v3 8/9] staging: iio: adc: remove the use of CamelCase

Quoted 3 lines · Ioana Ciornei

Remove the use of CamelCase to follow the kernel naming conventions

Some of this names I think are intended because are easier to read.

Quoted 17 lines

---
Changes in v2:
- remove change added by mistake in v1
Changes in v3:
- nothing

 drivers/staging/iio/adc/ad7192.c      | 10 +++++-----
 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, 16 insertions(+), 16 deletions(-)
drivers/staging/iio/adc/ad7192.c +0 -0
index 5f2b5a6..c9a706a 100644

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

Quoted 6 lines
drivers/staging/iio/adc/ad7192.c +1 -1
@@ -124,7 +124,7 @@
 #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
 

This is ok.

Quoted 5 lines
drivers/staging/iio/adc/ad7192.c +0 -0
 /* 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:

drivers/staging/iio/adc/ad7192.c static int ad7192_setup(struct ad7192_state *st, · line 236

Quoted 10 lines
drivers/staging/iio/adc/ad7192.c +3 -3
        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;

Ok.

Quoted 33 lines
drivers/staging/iio/adc/ad7192.c +1 -1
                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 +1 -1
index 2be3475..f9f3670 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

drivers/staging/iio/adc/ad7280a.c static int ad7280_probe(struct spi_device *spi) · line 844

Quoted 5 lines
drivers/staging/iio/adc/ad7280a.c +0 -2
@@ -840,8 +840,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};

We shouldn't touch this. ACQ, AVG are abbreviations.

Quoted 32 lines
drivers/staging/iio/adc/ad7280a.c +6 -4
+       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));
@@ -857,7 +857,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);
 
@@ -884,9 +884,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 +0 -0
index d11c54b..b411e0b 100644

drivers/staging/iio/adc/lpc32xx_adc.c line 47

Quoted 7 lines
drivers/staging/iio/adc/lpc32xx_adc.c +2 -2
@@ -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! */

Also here. This shouldn't be touched.

Quoted 21 lines
drivers/staging/iio/adc/lpc32xx_adc.c +1 -2
 #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,
--

2.1.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1b5753d919ace483b427bd42476f97519b039adb.1444419393.git.ciorneiioana%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#27 lore raw

PATCH v3 9/9 staging: iio: adc: properly indent block comments

In reply to Ioana Ciornei

Rework block comments in order to follow
kernel coding style

---
Changes in v2:
- nothing
Changes in v3:
- nothing

 drivers/staging/iio/adc/ad7192.c | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)
drivers/staging/iio/adc/ad7192.c +20 -10
index c9a706a..1adfe00 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
#28 lore raw

Re: [Outreachy kernel] [PATCH v3 9/9] staging: iio: adc: properly indent block comments

Quoted 53 lines · Ioana Ciornei

Rework block comments in order to follow
kernel coding style

---
Changes in v2:
- nothing
Changes in v3:
- nothing

 drivers/staging/iio/adc/ad7192.c | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)
drivers/staging/iio/adc/ad7192.c +14 -10
index c9a706a..1adfe00 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

drivers/staging/iio/adc/ad7192.c

Quoted 10 lines
drivers/staging/iio/adc/ad7192.c +6 -1
+                                          * 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) */
 
--

This patch is correct. Anyhow, I think it is better to add the comments above the macro def.

thanks,
Daniel.