netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Jean Sacren <sakiwit-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-zigbee-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH net-next] ieee802154: use helper function to get rid of redundancy
Date: Sun, 1 Jun 2014 16:35:53 +0200	[thread overview]
Message-ID: <20140601143550.GA13168@omega> (raw)
In-Reply-To: <20140601142317.GA19754-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Hi,

On Sun, Jun 01, 2014 at 08:23:17AM -0600, Jean Sacren wrote:
> From: Alexander Aring <alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Date: Sun, 01 Jun 2014 09:26:57 +0200
> 
> Hi Alex,
> 
> Thank you very much for the feedback.
> 
> > the at86rf230 driver supports several at86rf2xx chips. You split the
> > at86rf212_set_channel which is at86rf212 specific in two function which
> > are named at86rf230_foo.
> 
> I didn't "split" at86rf212_set_channel() in two functions. I spliced
> those two sections of code and made at86rf212_set_channel() far
> succinct and easy to read.
> 

yes, but this driver supports more than one chip and it's easier to read
if we have one channel_set function for each chip type. Note you also
named the specific channel_set function to a another at86rf230_foo
function which is at86rf212 specific only. Sorry that will confuse
all the people who will ever read this code.

There is a at86rf230_ops and at86rf212_ops struct. The channel_set
function it's much easier to have only one callback for each struct,
otherwise you have 4 different channel_set functions and nobody knows
for which at86rf2xx type that function is for.

> > Sorry, but I think we should not do this. One reason is that the code is
> > much easier to read when we have one channel_set callback for at86rf23x
> > and at86rf212 chips.
> 
> If you use one channel_set callback as before the change, how would you
> overcome the redundancy?
> 

There is no redundancy, sorry. There would be a redundancy if two
chiptypes like at86rf231 and at86rf212 needs some code of this callback
and you can do some codesharing, but you can't do that there.

- Alex

------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet

  parent reply	other threads:[~2014-06-01 14:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-31 23:39 [PATCH net-next] ieee802154: use helper function to get rid of redundancy Jean Sacren
2014-06-01  7:26 ` Alexander Aring
2014-06-01 14:23   ` Jean Sacren
     [not found]     ` <20140601142317.GA19754-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-01 14:35       ` Alexander Aring [this message]
2014-06-01 15:35         ` Jean Sacren
2014-06-01 16:39           ` Alexander Aring
2014-06-01 17:49             ` Jean Sacren
2014-06-01 17:53               ` Jean Sacren

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=20140601143550.GA13168@omega \
    --to=alex.aring-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=linux-zigbee-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sakiwit-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).