All of lore.kernel.org
 help / color / mirror / Atom feed
From: kgunda@codeaurora.org
To: Stephen Boyd <sboyd@codeaurora.org>
Cc: Abhijeet Dharmapurikar <adharmap@codeaurora.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	David Collins <collinsd@codeaurora.org>,
	Subbaraman Narayanamurthy <subbaram@codeaurora.org>,
	Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	adharmap@quicinc.com, aghayal@qti.qualcomm.com,
	linux-arm-msm-owner@vger.kernel.org
Subject: Re: [PATCH V1 02/15] spmi: pmic-arb: rename spmi_pmic_arb_dev to spmi_pmic_arb
Date: Thu, 01 Jun 2017 21:41:34 +0530	[thread overview]
Message-ID: <2bfcb67b77b7bbd1eccd3aeaf11dc75d@codeaurora.org> (raw)
In-Reply-To: <20170531004637.GT20170@codeaurora.org>

Thanks Stephen for reviewing the patches. Responses inline.

Thanks,
Kiran

On 2017-05-31 06:16, Stephen Boyd wrote:
> On 05/30, Kiran Gunda wrote:
>> From: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
>> 
>> Usually *_dev best used for structures that embed a struct device in
>> them. spmi_pmic_arb_dev doesn't embed one. It is simply a driver data
>> structure. Use an appropriate name for it.
>> 
>> Also there are many places in the driver that left shift the bit to
>> generate a bit mask. Replace it with the BIT() macro.
> 
> That would be a different patch because the subject doesn't even
> mention this.
> 
Sure. Agree. Will split this in to different patch.
>> 
>> Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
>> Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
>> ---
>>  drivers/spmi/spmi-pmic-arb.c | 164 
>> +++++++++++++++++++++----------------------
> 
> Would also be nice if you ran scripts/objdiff on this so we can
> be confident the code didn't change.
> 
Sure. Will do that in the next patch.

>>  1 file changed, 82 insertions(+), 82 deletions(-)
>> 
>> diff --git a/drivers/spmi/spmi-pmic-arb.c 
>> b/drivers/spmi/spmi-pmic-arb.c
>> index df463d4..7f918ea 100644
>> --- a/drivers/spmi/spmi-pmic-arb.c
>> +++ b/drivers/spmi/spmi-pmic-arb.c
>> @@ -58,10 +58,10 @@
>> 
>>  /* Channel Status fields */
>>  enum pmic_arb_chnl_status {
>> -	PMIC_ARB_STATUS_DONE	= (1 << 0),
>> -	PMIC_ARB_STATUS_FAILURE	= (1 << 1),
>> -	PMIC_ARB_STATUS_DENIED	= (1 << 2),
>> -	PMIC_ARB_STATUS_DROPPED	= (1 << 3),
>> +	PMIC_ARB_STATUS_DONE	= BIT(0),
>> +	PMIC_ARB_STATUS_FAILURE	= BIT(1),
>> +	PMIC_ARB_STATUS_DENIED	= BIT(2),
>> +	PMIC_ARB_STATUS_DROPPED	= BIT(3),
>>  };
>> 
>>  /* Command register fields */
>> @@ -99,7 +99,7 @@ enum pmic_arb_cmd_op_code {
>>  struct pmic_arb_ver_ops;
>> 
>>  /**
>> - * spmi_pmic_arb_dev - SPMI PMIC Arbiter object
>> + * spmi_pmic_arb - SPMI PMIC Arbiter object
>>   *
>>   * @rd_base:		on v1 "core", on v2 "observer" register base off DT.
>>   * @wr_base:		on v1 "core", on v2 "chnls"    register base off DT.
>> @@ -120,7 +120,7 @@ enum pmic_arb_cmd_op_code {
>>   * @ppid_to_chan	in-memory copy of PPID -> channel (APID) mapping 
>> table.
>>   *			v2 only.
>>   */
>> -struct spmi_pmic_arb_dev {
>> +struct spmi_pmic_arb {
>>  	void __iomem		*rd_base;
>>  	void __iomem		*wr_base;
>>  	void __iomem		*intr;
>> @@ -164,10 +164,10 @@ struct spmi_pmic_arb_dev {
>>   *			on v2 offset of SPMI_PIC_IRQ_CLEARn.
>>   */
>>  struct pmic_arb_ver_ops {
>> -	int (*mode)(struct spmi_pmic_arb_dev *dev, u8 sid, u16 addr,
>> +	int (*mode)(struct spmi_pmic_arb *dev, u8 sid, u16 addr,
> 
> But we leave dev here? I'm losing faith that this patch is
> worthwhile.
Ok. As per your suggestion we will drop this renaming patch.

> 
>>  			mode_t *mode);
>>  	/* spmi commands (read_cmd, write_cmd, cmd) functionality */
>> -	int (*offset)(struct spmi_pmic_arb_dev *dev, u8 sid, u16 addr,
>> +	int (*offset)(struct spmi_pmic_arb *dev, u8 sid, u16 addr,
>>  		      u32 *offset);
>>  	u32 (*fmt_cmd)(u8 opc, u8 sid, u16 addr, u8 bc);
>>  	int (*non_data_cmd)(struct spmi_controller *ctrl, u8 opc, u8 sid);
>> @@ -178,16 +178,16 @@ struct pmic_arb_ver_ops {
>>  	u32 (*irq_clear)(u8 n);
>>  };
>> 
>> -static inline void pmic_arb_base_write(struct spmi_pmic_arb_dev *dev,
>> +static inline void pmic_arb_base_write(struct spmi_pmic_arb *pa,
>>  				       u32 offset, u32 val)
>>  {
>> -	writel_relaxed(val, dev->wr_base + offset);
>> +	writel_relaxed(val, pa->wr_base + offset);
> 
> "pa" is a little confusing with things like physical address and
> such. I would have gone for "arb", but the code is written
> already, so why change it now?
> 
Ok. As per your suggestion we will drop this renaming patch.
>>  }
>> 
>> -static inline void pmic_arb_set_rd_cmd(struct spmi_pmic_arb_dev *dev,
>> +static inline void pmic_arb_set_rd_cmd(struct spmi_pmic_arb *pa,
>>  				       u32 offset, u32 val)
>>  {
>> -	writel_relaxed(val, dev->rd_base + offset);
>> +	writel_relaxed(val, pa->rd_base + offset);
>>  }
>> 
>>  /**
>> @@ -196,9 +196,10 @@ static inline void pmic_arb_set_rd_cmd(struct 
>> spmi_pmic_arb_dev *dev,
>>   * @reg:	register's address
>>   * @buf:	output parameter, length must be bc + 1
>>   */
>> -static void pa_read_data(struct spmi_pmic_arb_dev *dev, u8 *buf, u32 
>> reg, u8 bc)
>> +static void pa_read_data(struct spmi_pmic_arb *pa, u8 *buf, u32 reg, 
>> u8 bc)
> 
> In fact, I would rename these pa_{read,write}_data() functions as
> pmic_arb_{read,write}_data() to be consistent. These are the only
> places "pa_" is used right now.
> 
Sure. Agree. Will rename this to pmic_arb_{read,write}_data in the next 
patch.
>>  {
>> -	u32 data = __raw_readl(dev->rd_base + reg);
>> +	u32 data = __raw_readl(pa->rd_base + reg);
>> +
>>  	memcpy(buf, &data, (bc & 3) + 1);
>>  }
>> 
>> @@ -209,23 +210,24 @@ static void pa_read_data(struct 
>> spmi_pmic_arb_dev *dev, u8 *buf, u32 reg, u8 bc)
>>   * @buf:	buffer to write. length must be bc + 1.
>>   */
>>  static void
>> -pa_write_data(struct spmi_pmic_arb_dev *dev, const u8 *buf, u32 reg, 
>> u8 bc)
>> +pa_write_data(struct spmi_pmic_arb *pa, const u8 *buf, u32 reg, u8 
>> bc)
>>  {
>>  	u32 data = 0;
>> +
>>  	memcpy(&data, buf, (bc & 3) + 1);
>> -	__raw_writel(data, dev->wr_base + reg);
>> +	pmic_arb_base_write(pa, reg, data);
> 
> This is an unrelated change. Not sure what's going on with this
> diff but we most likely want to keep the __raw_writel() here. See
> how renames introduce bugs and why we don't value them?
> 
Actually pmic_arb_base_write has the writel_relaxed inside it.
that's why we removed the __raw_writel to use the common function.
Anyways, we drop the renaming patch from this patch series.
>>  }
>> 
>> @@ -270,22 +272,22 @@ static int pmic_arb_wait_for_done(struct 
>> spmi_controller *ctrl,
>>  static int
>>  pmic_arb_non_data_cmd_v1(struct spmi_controller *ctrl, u8 opc, u8 
>> sid)
>>  {
>> -	struct spmi_pmic_arb_dev *pmic_arb = 
>> spmi_controller_get_drvdata(ctrl);
>> +	struct spmi_pmic_arb *pa = spmi_controller_get_drvdata(ctrl);
>>  	unsigned long flags;
>>  	u32 cmd;
>>  	int rc;
>>  	u32 offset;
>> 
>> -	rc = pmic_arb->ver_ops->offset(pmic_arb, sid, 0, &offset);
>> +	rc = pa->ver_ops->offset(pa, sid, 0, &offset);
>>  	if (rc)
>>  		return rc;
>> 
>>  	cmd = ((opc | 0x40) << 27) | ((sid & 0xf) << 20);
>> 
>> -	raw_spin_lock_irqsave(&pmic_arb->lock, flags);
>> -	pmic_arb_base_write(pmic_arb, offset + PMIC_ARB_CMD, cmd);
>> -	rc = pmic_arb_wait_for_done(ctrl, pmic_arb->wr_base, sid, 0);
>> -	raw_spin_unlock_irqrestore(&pmic_arb->lock, flags);
>> +	raw_spin_lock_irqsave(&pa->lock, flags);
>> +	pmic_arb_base_write(pa, offset + PMIC_ARB_CMD, cmd);
>> +	rc = pmic_arb_wait_for_done(ctrl, pa->wr_base, sid, 0);
>> +	raw_spin_unlock_irqrestore(&pa->lock, flags);
>> 
>>  	return rc;
> 
> Yeah pmic_arb sounds fine too. Not sure why we changed anything
> in this function.
> 
Ok. We will drop this renaming patch.
>>  }
>> @@ -299,7 +301,7 @@ static int pmic_arb_wait_for_done(struct 
>> spmi_controller *ctrl,
>>  /* Non-data command */
>>  static int pmic_arb_cmd(struct spmi_controller *ctrl, u8 opc, u8 sid)
>>  {
>> -	struct spmi_pmic_arb_dev *pmic_arb = 
>> spmi_controller_get_drvdata(ctrl);
>> +	struct spmi_pmic_arb *pa = spmi_controller_get_drvdata(ctrl);
>> 
>>  	dev_dbg(&ctrl->dev, "cmd op:0x%x sid:%d\n", opc, sid);
>> 
>> @@ -307,13 +309,13 @@ static int pmic_arb_cmd(struct spmi_controller 
>> *ctrl, u8 opc, u8 sid)
>>  	if (opc < SPMI_CMD_RESET || opc > SPMI_CMD_WAKEUP)
>>  		return -EINVAL;
>> 
>> -	return pmic_arb->ver_ops->non_data_cmd(ctrl, opc, sid);
>> +	return pa->ver_ops->non_data_cmd(ctrl, opc, sid);
> 
> Same story...
> 
Ok. We will drop this renaming patch.
>>  }
>> 
>>  static int pmic_arb_read_cmd(struct spmi_controller *ctrl, u8 opc, u8 
>> sid,
>>  			     u16 addr, u8 *buf, size_t len)
>>  {
>> -	struct spmi_pmic_arb_dev *pmic_arb = 
>> spmi_controller_get_drvdata(ctrl);
>> +	struct spmi_pmic_arb *pa = spmi_controller_get_drvdata(ctrl);
>>  	unsigned long flags;
>>  	u8 bc = len - 1;
>>  	u32 cmd;
>> @@ -321,16 +323,16 @@ static int pmic_arb_read_cmd(struct 
>> spmi_controller *ctrl, u8 opc, u8 sid,
>>  	u32 offset;
>>  	mode_t mode;
>> 
>> -	rc = pmic_arb->ver_ops->offset(pmic_arb, sid, addr, &offset);
>> +	rc = pa->ver_ops->offset(pa, sid, addr, &offset);
>>  	if (rc)
>>  		return rc;
>> 
>> -	rc = pmic_arb->ver_ops->mode(pmic_arb, sid, addr, &mode);
>> +	rc = pa->ver_ops->mode(pa, sid, addr, &mode);
>>  	if (rc)
>>  		return rc;
>> 
>>  	if (!(mode & S_IRUSR)) {
>> -		dev_err(&pmic_arb->spmic->dev,
>> +		dev_err(&pa->spmic->dev,
>>  			"error: impermissible read from peripheral sid:%d addr:0x%x\n",
>>  			sid, addr);
>>  		return -EPERM;
>> @@ -353,30 +355,29 @@ static int pmic_arb_read_cmd(struct 
>> spmi_controller *ctrl, u8 opc, u8 sid,
>>  	else
>>  		return -EINVAL;
>> 
>> -	cmd = pmic_arb->ver_ops->fmt_cmd(opc, sid, addr, bc);
>> +	cmd = pa->ver_ops->fmt_cmd(opc, sid, addr, bc);
>> 
>> -	raw_spin_lock_irqsave(&pmic_arb->lock, flags);
>> -	pmic_arb_set_rd_cmd(pmic_arb, offset + PMIC_ARB_CMD, cmd);
>> -	rc = pmic_arb_wait_for_done(ctrl, pmic_arb->rd_base, sid, addr);
>> +	raw_spin_lock_irqsave(&pa->lock, flags);
>> +	pmic_arb_set_rd_cmd(pa, offset + PMIC_ARB_CMD, cmd);
>> +	rc = pmic_arb_wait_for_done(ctrl, pa->rd_base, sid, addr);
>>  	if (rc)
>>  		goto done;
>> 
>> -	pa_read_data(pmic_arb, buf, offset + PMIC_ARB_RDATA0,
>> +	pa_read_data(pa, buf, offset + PMIC_ARB_RDATA0,
>>  		     min_t(u8, bc, 3));
>> 
>>  	if (bc > 3)
>> -		pa_read_data(pmic_arb, buf + 4,
>> -				offset + PMIC_ARB_RDATA1, bc - 4);
>> +		pa_read_data(pa, buf + 4, offset + PMIC_ARB_RDATA1, bc - 4);
>> 
>>  done:
>> -	raw_spin_unlock_irqrestore(&pmic_arb->lock, flags);
>> +	raw_spin_unlock_irqrestore(&pa->lock, flags);
>>  	return rc;
>>  }
>> 
>>  static int pmic_arb_write_cmd(struct spmi_controller *ctrl, u8 opc, 
>> u8 sid,
>>  			      u16 addr, const u8 *buf, size_t len)
>>  {
>> -	struct spmi_pmic_arb_dev *pmic_arb = 
>> spmi_controller_get_drvdata(ctrl);
>> +	struct spmi_pmic_arb *pa = spmi_controller_get_drvdata(ctrl);
>>  	unsigned long flags;
>>  	u8 bc = len - 1;
>>  	u32 cmd;
>> @@ -384,16 +385,16 @@ static int pmic_arb_write_cmd(struct 
>> spmi_controller *ctrl, u8 opc, u8 sid,
>>  	u32 offset;
>>  	mode_t mode;
>> 
>> -	rc = pmic_arb->ver_ops->offset(pmic_arb, sid, addr, &offset);
>> +	rc = pa->ver_ops->offset(pa, sid, addr, &offset);
>>  	if (rc)
>>  		return rc;
>> 
>> -	rc = pmic_arb->ver_ops->mode(pmic_arb, sid, addr, &mode);
>> +	rc = pa->ver_ops->mode(pa, sid, addr, &mode);
>>  	if (rc)
>>  		return rc;
>> 
>>  	if (!(mode & S_IWUSR)) {
>> -		dev_err(&pmic_arb->spmic->dev,
>> +		dev_err(&pa->spmic->dev,
>>  			"error: impermissible write to peripheral sid:%d addr:0x%x\n",
>>  			sid, addr);
>>  		return -EPERM;
>> @@ -418,20 +419,18 @@ static int pmic_arb_write_cmd(struct 
>> spmi_controller *ctrl, u8 opc, u8 sid,
>>  	else
>>  		return -EINVAL;
>> 
>> -	cmd = pmic_arb->ver_ops->fmt_cmd(opc, sid, addr, bc);
>> +	cmd = pa->ver_ops->fmt_cmd(opc, sid, addr, bc);
>> 
>>  	/* Write data to FIFOs */
>> -	raw_spin_lock_irqsave(&pmic_arb->lock, flags);
>> -	pa_write_data(pmic_arb, buf, offset + PMIC_ARB_WDATA0,
>> -		      min_t(u8, bc, 3));
>> +	raw_spin_lock_irqsave(&pa->lock, flags);
>> +	pa_write_data(pa, buf, offset + PMIC_ARB_WDATA0, min_t(u8, bc, 3));
>>  	if (bc > 3)
>> -		pa_write_data(pmic_arb, buf + 4,
>> -				offset + PMIC_ARB_WDATA1, bc - 4);
>> +		pa_write_data(pa, buf + 4, offset + PMIC_ARB_WDATA1, bc - 4);
>> 
>>  	/* Start the transaction */
>> -	pmic_arb_base_write(pmic_arb, offset + PMIC_ARB_CMD, cmd);
>> -	rc = pmic_arb_wait_for_done(ctrl, pmic_arb->wr_base, sid, addr);
>> -	raw_spin_unlock_irqrestore(&pmic_arb->lock, flags);
>> +	pmic_arb_base_write(pa, offset + PMIC_ARB_CMD, cmd);
>> +	rc = pmic_arb_wait_for_done(ctrl, pa->wr_base, sid, addr);
>> +	raw_spin_unlock_irqrestore(&pa->lock, flags);
>> 
>>  	return rc;
>>  }
> 
> Same story for all this diff.
Ok. We will drop this renaming patch.
> 
>> @@ -457,7 +456,7 @@ struct spmi_pmic_arb_qpnpint_type {
>>  static void qpnpint_spmi_write(struct irq_data *d, u8 reg, void *buf,
>>  			       size_t len)
>>  {
>> -	struct spmi_pmic_arb_dev *pa = irq_data_get_irq_chip_data(d);
>> +	struct spmi_pmic_arb *pa = irq_data_get_irq_chip_data(d);
>>  	u8 sid = d->hwirq >> 24;
>>  	u8 per = d->hwirq >> 16;
>> 
>> @@ -470,7 +469,7 @@ static void qpnpint_spmi_write(struct irq_data *d, 
>> u8 reg, void *buf,
>> 
>>  static void qpnpint_spmi_read(struct irq_data *d, u8 reg, void *buf, 
>> size_t len)
>>  {
>> -	struct spmi_pmic_arb_dev *pa = irq_data_get_irq_chip_data(d);
>> +	struct spmi_pmic_arb *pa = irq_data_get_irq_chip_data(d);
>>  	u8 sid = d->hwirq >> 24;
>>  	u8 per = d->hwirq >> 16;
>> 
>> @@ -481,7 +480,7 @@ static void qpnpint_spmi_read(struct irq_data *d, 
>> u8 reg, void *buf, size_t len)
>>  				    d->irq);
>>  }
>> 
>> -static void periph_interrupt(struct spmi_pmic_arb_dev *pa, u8 apid)
>> +static void periph_interrupt(struct spmi_pmic_arb *pa, u8 apid)
>>  {
>>  	unsigned int irq;
>>  	u32 status;
>> @@ -490,7 +489,7 @@ static void periph_interrupt(struct 
>> spmi_pmic_arb_dev *pa, u8 apid)
>>  	status = readl_relaxed(pa->intr + pa->ver_ops->irq_status(apid));
>>  	while (status) {
>>  		id = ffs(status) - 1;
>> -		status &= ~(1 << id);
>> +		status &= ~BIT(id);
>>  		irq = irq_find_mapping(pa->domain,
>>  				       pa->apid_to_ppid[apid] << 16
>>  				     | id << 8
>> @@ -501,7 +500,7 @@ static void periph_interrupt(struct 
>> spmi_pmic_arb_dev *pa, u8 apid)
>> 
>>  static void pmic_arb_chained_irq(struct irq_desc *desc)
>>  {
>> -	struct spmi_pmic_arb_dev *pa = irq_desc_get_handler_data(desc);
>> +	struct spmi_pmic_arb *pa = irq_desc_get_handler_data(desc);
>>  	struct irq_chip *chip = irq_desc_get_chip(desc);
>>  	void __iomem *intr = pa->intr;
>>  	int first = pa->min_apid >> 5;
>> @@ -516,7 +515,7 @@ static void pmic_arb_chained_irq(struct irq_desc 
>> *desc)
>>  				      pa->ver_ops->owner_acc_status(pa->ee, i));
>>  		while (status) {
>>  			id = ffs(status) - 1;
>> -			status &= ~(1 << id);
>> +			status &= ~BIT(id);
>>  			periph_interrupt(pa, id + i * 32);
>>  		}
>>  	}
>> @@ -526,23 +525,23 @@ static void pmic_arb_chained_irq(struct irq_desc 
>> *desc)
>> 
>>  static void qpnpint_irq_ack(struct irq_data *d)
>>  {
>> -	struct spmi_pmic_arb_dev *pa = irq_data_get_irq_chip_data(d);
>> +	struct spmi_pmic_arb *pa = irq_data_get_irq_chip_data(d);
>>  	u8 irq  = d->hwirq >> 8;
>>  	u8 apid = d->hwirq;
>>  	unsigned long flags;
>>  	u8 data;
>> 
>>  	raw_spin_lock_irqsave(&pa->lock, flags);
>> -	writel_relaxed(1 << irq, pa->intr + pa->ver_ops->irq_clear(apid));
>> +	writel_relaxed(BIT(irq), pa->intr + pa->ver_ops->irq_clear(apid));
>>  	raw_spin_unlock_irqrestore(&pa->lock, flags);
>> 
>> -	data = 1 << irq;
>> +	data = BIT(irq);
>>  	qpnpint_spmi_write(d, QPNPINT_REG_LATCHED_CLR, &data, 1);
>>  }
>> 
>>  static void qpnpint_irq_mask(struct irq_data *d)
>>  {
>> -	struct spmi_pmic_arb_dev *pa = irq_data_get_irq_chip_data(d);
>> +	struct spmi_pmic_arb *pa = irq_data_get_irq_chip_data(d);
>>  	u8 irq  = d->hwirq >> 8;
>>  	u8 apid = d->hwirq;
>>  	unsigned long flags;
>> @@ -558,13 +557,13 @@ static void qpnpint_irq_mask(struct irq_data *d)
>>  	}
>>  	raw_spin_unlock_irqrestore(&pa->lock, flags);
>> 
>> -	data = 1 << irq;
>> +	data = BIT(irq);
>>  	qpnpint_spmi_write(d, QPNPINT_REG_EN_CLR, &data, 1);
>>  }
>> 
>>  static void qpnpint_irq_unmask(struct irq_data *d)
>>  {
>> -	struct spmi_pmic_arb_dev *pa = irq_data_get_irq_chip_data(d);
>> +	struct spmi_pmic_arb *pa = irq_data_get_irq_chip_data(d);
>>  	u8 irq  = d->hwirq >> 8;
>>  	u8 apid = d->hwirq;
>>  	unsigned long flags;
>> @@ -579,7 +578,7 @@ static void qpnpint_irq_unmask(struct irq_data *d)
>>  	}
>>  	raw_spin_unlock_irqrestore(&pa->lock, flags);
>> 
>> -	data = 1 << irq;
>> +	data = BIT(irq);
>>  	qpnpint_spmi_write(d, QPNPINT_REG_EN_SET, &data, 1);
>>  }
>> 
>> @@ -590,7 +589,7 @@ static void qpnpint_irq_enable(struct irq_data *d)
>> 
>>  	qpnpint_irq_unmask(d);
>> 
>> -	data = 1 << irq;
>> +	data = BIT(irq);
>>  	qpnpint_spmi_write(d, QPNPINT_REG_LATCHED_CLR, &data, 1);
>>  }
>> 
>> @@ -598,25 +597,26 @@ static int qpnpint_irq_set_type(struct irq_data 
>> *d, unsigned int flow_type)
>>  {
>>  	struct spmi_pmic_arb_qpnpint_type type;
>>  	u8 irq = d->hwirq >> 8;
>> +	u8 bit_mask_irq = BIT(irq);
> 
> Why the local variable? Just do the ~BIT(irq) thing in place and
> let the compiler take care of the hoist?
> 
Sure.. we will remove this local variable in the subsequent patch.
>> 
>>  	qpnpint_spmi_read(d, QPNPINT_REG_SET_TYPE, &type, sizeof(type));
>> 
>>  	if (flow_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) {
>> -		type.type |= 1 << irq;
>> +		type.type |= bit_mask_irq;
>>  		if (flow_type & IRQF_TRIGGER_RISING)
>> -			type.polarity_high |= 1 << irq;
>> +			type.polarity_high |= bit_mask_irq;
>>  		if (flow_type & IRQF_TRIGGER_FALLING)
>> -			type.polarity_low  |= 1 << irq;
>> +			type.polarity_low  |= bit_mask_irq;
>>  	} else {
>>  		if ((flow_type & (IRQF_TRIGGER_HIGH)) &&
>>  		    (flow_type & (IRQF_TRIGGER_LOW)))
>>  			return -EINVAL;
>> 
>> -		type.type &= ~(1 << irq); /* level trig */
>> +		type.type &= ~bit_mask_irq; /* level trig */
>>  		if (flow_type & IRQF_TRIGGER_HIGH)
>> -			type.polarity_high |= 1 << irq;
>> +			type.polarity_high |= bit_mask_irq;
>>  		else
>> -			type.polarity_low  |= 1 << irq;
>> +			type.polarity_low  |= bit_mask_irq;
>>  	}
>> 
>>  	qpnpint_spmi_write(d, QPNPINT_REG_SET_TYPE, &type, sizeof(type));
>> @@ -657,7 +657,7 @@ struct spmi_pmic_arb_irq_spec {
> 
> Overall I see little to no value with this patch. I suggest you
> drop the rename. The BIT() thing may be ok, but again, not sure
> there's any benefit.
Ok.. Sure. We drop out the renaming patch in the next version
and will have only BIT() macro patch.

  reply	other threads:[~2017-06-01 16:11 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-30 12:38 [PATCH V1 00/15]: support for spmi_pmic_arb v3/v5 and bug fixes Kiran Gunda
2017-05-30 12:38 ` Kiran Gunda
2017-05-30 12:38 ` [PATCH V1 01/15] spmi: pmic_arb: block access of invalid read and writes Kiran Gunda
2017-05-31  0:33   ` Stephen Boyd
2017-06-12 11:26     ` kgunda
2017-06-13  2:09       ` Stephen Boyd
2017-06-14 15:09         ` kgunda
2017-05-30 12:38 ` [PATCH V1 02/15] spmi: pmic-arb: rename spmi_pmic_arb_dev to spmi_pmic_arb Kiran Gunda
2017-05-31  0:46   ` Stephen Boyd
2017-06-01 16:11     ` kgunda [this message]
2017-06-02 18:29       ` Stephen Boyd
2017-06-05  6:28         ` kgunda
2017-05-30 12:38 ` [PATCH V1 03/15] spmi: pmic-arb: fix inconsistent use of apid and chan Kiran Gunda
2017-05-31  1:31   ` Stephen Boyd
2017-06-01 16:37     ` kgunda
2017-05-30 12:38 ` [PATCH V1 04/15] spmi: pmic-arb: optimize table lookups Kiran Gunda
2017-05-31  1:44   ` Stephen Boyd
2017-06-01 16:53     ` kgunda
2017-06-02 18:31       ` Stephen Boyd
2017-06-05  6:33         ` kgunda
2017-05-30 12:38 ` [PATCH V1 05/15] spmi: pmic-arb: cleanup unrequested irqs Kiran Gunda
2017-05-31  1:57   ` Stephen Boyd
2017-06-06 10:50     ` kgunda
2017-06-13  2:11       ` Stephen Boyd
2017-06-14 15:04         ` kgunda
2017-05-30 12:38 ` [PATCH V1 06/15] spmi: pmic-arb: fix missing interrupts Kiran Gunda
2017-05-31  2:00   ` Stephen Boyd
2017-06-01 17:06     ` kgunda
2017-05-30 12:38 ` [PATCH V1 07/15] spmi: pmic-arb: clear the latched status of the interrupt Kiran Gunda
2017-05-31 22:03   ` Stephen Boyd
2017-06-06 10:55     ` kgunda
2017-05-30 12:38 ` [PATCH V1 08/15] spmi: pmic_arb: use appropriate flow handler Kiran Gunda
2017-05-31 19:03   ` Stephen Boyd
2017-06-06 10:57     ` kgunda
2017-05-30 12:38 ` [PATCH V1 09/15] spmi: pmic-arb: check apid enabled before calling the handler Kiran Gunda
2017-05-31 20:39   ` Stephen Boyd
2017-06-14 15:38     ` kgunda
2017-06-16 21:11       ` Stephen Boyd
2017-06-21  5:02         ` kgunda
2017-05-30 12:38 ` [PATCH V1 10/15] spmi: pmic_arb: add support for PMIC bus arbiter v3 Kiran Gunda
2017-05-31 22:18   ` Stephen Boyd
2017-06-06 11:10     ` kgunda
2017-05-30 12:38 ` [PATCH V1 11/15] spmi: spmi-pmic-arb: enable the SPMI interrupt as a wakeup source Kiran Gunda
2017-05-31 17:13   ` Stephen Boyd
2017-06-08 11:30     ` kgunda
2017-05-30 12:39 ` [PATCH V1 12/15] spmi-pmic-arb: fix a possible null pointer dereference Kiran Gunda
2017-05-31 17:29   ` Stephen Boyd
2017-06-02  7:13     ` kgunda
2017-05-30 12:39 ` [PATCH V1 13/15] spmi: pmic-arb: add support for HW version 5 Kiran Gunda
2017-06-01  6:08   ` Stephen Boyd
2017-06-08 11:28     ` kgunda
2017-05-30 12:39 ` [PATCH V1 14/15] spmi: pmic-arb: do not ack and clear peripheral interrupts in cleanup_irq Kiran Gunda
2017-05-30 22:23   ` kbuild test robot
2017-05-30 22:23     ` kbuild test robot
2017-05-31 17:53   ` Stephen Boyd
2017-06-02  7:26     ` kgunda
2017-06-06 11:27       ` kgunda
2017-06-13  2:10         ` Stephen Boyd
2017-07-18 11:53           ` kgunda
2017-05-30 12:39 ` [PATCH V1 15/15] spmi: pmic-arb: instantiate spmi_devices at arch_initcall Kiran Gunda
2017-05-31 22:07   ` Stephen Boyd
2017-07-18 11:49     ` kgunda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2bfcb67b77b7bbd1eccd3aeaf11dc75d@codeaurora.org \
    --to=kgunda@codeaurora.org \
    --cc=adharmap@codeaurora.org \
    --cc=adharmap@quicinc.com \
    --cc=aghayal@qti.qualcomm.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=collinsd@codeaurora.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-msm-owner@vger.kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sboyd@codeaurora.org \
    --cc=subbaram@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.