All of lore.kernel.org
 help / color / mirror / Atom feed
From: "AnilKumar, Chimata" <anilkumar@ti.com>
To: Wolfgang Grandegger <wg@grandegger.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>,
	"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>,
	"Gole, Anant" <anantgole@ti.com>, "Nori, Sekhar" <nsekhar@ti.com>
Subject: RE: [PATCH v2 3/4] can: c_can: Move overlay structure to array with offset as index
Date: Fri, 11 May 2012 15:23:27 +0000	[thread overview]
Message-ID: <331ABD5ECB02734CA317220B2BBEABC13E9BC9B9@DBDE01.ent.ti.com> (raw)
In-Reply-To: <4FAD24F0.3070600@grandegger.com>


Hi Wolfgang,

Thanks for the comments,

On Fri, May 11, 2012 at 20:10:48, Wolfgang Grandegger wrote:
> On 05/11/2012 01:09 PM, AnilKumar, Chimata wrote:
> > On Fri, May 11, 2012 at 01:42:43, Marc Kleine-Budde wrote:
> >> On 05/10/2012 01:34 PM, AnilKumar Ch wrote:
> >>> c_can uses overlay structure for accessing c_can module registers.
> >>> With this kind of implementation it is difficult to add one more ip
> >>> which is similar to c_can in functionality but different register
> >>> offsets.
> >>>
> >>> This patch changes the overlay structure implementation to an array
> >>> with register offset as index. This way we can overcome the above
> >>> limitation.
> >>
> >> The array index implementation looks very nice.
> >>
> >> I suggest to use the enum instead of a plain "int reg" in the
> >> c_can_read_* function arguments.
> > 
> > That is better compared to int reg, I will change.
> > 
> >>
> >> General question: What happend to "iface", like in this hunk below?
> > 
> > In entire driver iface is used as "0" means IF register bank one. So I defined
> > enum like "C_CAN_IF1_*". If IF register bank 2 is used in the driver at that
> > time we can define "C_CAN_IF2_*" and used appropriately.
> 
> But switching IF1->IF2 would then be awkward. Anyway, at the moment
> switching seems not required and therefore there is no need to introduce
> another array but...
> 
> > 
> >>
> >>>  	while (count && priv->read_reg(priv,
> >>> -				&priv->regs->ifregs[iface].com_req) &
> >>> +				C_CAN_IF1_COMREQ_REG) &
> >>>  				IF_COMR_BUSY) {
> 
> ... what is then "iface" still good for? I see that the functions still
> have that argument.
> 
> Apart from that the patch series look quite good now.

How about this implementation?

1. C_CAN_IF2_* will be added to enum next to C_CAN_IF1_* register flags

2. Add array fields for C_CAN_IF2_* with coresponding offsets.

3. #define IF_ENUM_REG_LEN	11 (eleven interface registers are present)

4. priv->read_reg(priv, C_CAN_IF1_COMREQ_REG + iface * IF_ENUM_REG_LEN);

Ultimately 11 * 3 + 1 + few more lines will be added to the patch.

Regards
AnilKumar

  reply	other threads:[~2012-05-11 15:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-10 11:34 [PATCH v2 0/4] can: c_can: Add support for Bosch D_CAN controller AnilKumar Ch
2012-05-10 11:34 ` [PATCH v2 1/4] can: c_can: fix an interrupt thrash issue with c_can driver AnilKumar Ch
2012-05-10 19:13   ` Marc Kleine-Budde
2012-05-10 11:34 ` [PATCH v2 2/4] can: c_can: fix: enable CAN HW interrupts after napi_enable() AnilKumar Ch
2012-05-10 19:16   ` Marc Kleine-Budde
2012-05-11 11:09     ` AnilKumar, Chimata
2012-05-10 11:34 ` [PATCH v2 3/4] can: c_can: Move overlay structure to array with offset as index AnilKumar Ch
2012-05-10 20:12   ` Marc Kleine-Budde
2012-05-11 11:09     ` AnilKumar, Chimata
2012-05-11 14:40       ` Wolfgang Grandegger
2012-05-11 15:23         ` AnilKumar, Chimata [this message]
2012-05-11 16:54           ` Marc Kleine-Budde
2012-05-10 11:34 ` [PATCH v2 4/4] can: c_can: Add support for Bosch D_CAN controller AnilKumar Ch
2012-05-10 19:34   ` Marc Kleine-Budde
2012-05-11 11:10     ` AnilKumar, Chimata

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=331ABD5ECB02734CA317220B2BBEABC13E9BC9B9@DBDE01.ent.ti.com \
    --to=anilkumar@ti.com \
    --cc=anantgole@ti.com \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=nsekhar@ti.com \
    --cc=wg@grandegger.com \
    /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.