From: David Miller <davem@davemloft.net> To: isubramanian@apm.com Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, jcm@redhat.com, patches@apm.com, rapatel@apm.com, kchudgar@apm.com Subject: Re: [PATCH v2 4/4] drivers: net: Add APM X-Gene SoC ethernet driver support. Date: Sat, 12 Apr 2014 16:55:49 -0400 (EDT) [thread overview] Message-ID: <20140412.165549.1068958710661824002.davem@davemloft.net> (raw) In-Reply-To: <1397271984-23405-5-git-send-email-isubramanian@apm.com> From: Iyappan Subramanian <isubramanian@apm.com> Date: Fri, 11 Apr 2014 20:06:24 -0700 > This patch adds network driver for APM X-Gene SoC ethernet. > > Signed-off-by: Iyappan Subramanian <isubramanian@apm.com> > Signed-off-by: Ravi Patel <rapatel@apm.com> > Signed-off-by: Keyur Chudgar <kchudgar@apm.com> This driver is going to take a long to review and get to the point where it can be integrated upstream, I'm just trying to set your expectations properly. > +inline void set_desc(struct xgene_enet_desc *desc, enum desc_info_index index, > + u64 val) > +{ The "inline" tag is not necessary, let the compiler figure it out. > + u8 word_index = desc_info[index].word_index; > + u8 start_bit = desc_info[index].start_bit; > + u8 len = desc_info[index].len; > + > + u64 mask = GENMASK_ULL((start_bit + len - 1), start_bit); > + ((u64 *)desc)[word_index] = (((u64 *)desc)[word_index] & ~mask) > + | (((u64) val << start_bit) & mask); This looks horrible for several reasons. First of all, do not put empty lines in the middle of a set of local variable declarations. But do put a single empty line after the last local variable, and before the actual code of the function starts. Get rid of all of this excessive casting. Tell the compiler what you're actually doing, pass 'desc' in as "void *" and use local "u64 *" pointers (to which 'desc' is assigned to) if you must.
WARNING: multiple messages have this Message-ID (diff)
From: davem@davemloft.net (David Miller) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 4/4] drivers: net: Add APM X-Gene SoC ethernet driver support. Date: Sat, 12 Apr 2014 16:55:49 -0400 (EDT) [thread overview] Message-ID: <20140412.165549.1068958710661824002.davem@davemloft.net> (raw) In-Reply-To: <1397271984-23405-5-git-send-email-isubramanian@apm.com> From: Iyappan Subramanian <isubramanian@apm.com> Date: Fri, 11 Apr 2014 20:06:24 -0700 > This patch adds network driver for APM X-Gene SoC ethernet. > > Signed-off-by: Iyappan Subramanian <isubramanian@apm.com> > Signed-off-by: Ravi Patel <rapatel@apm.com> > Signed-off-by: Keyur Chudgar <kchudgar@apm.com> This driver is going to take a long to review and get to the point where it can be integrated upstream, I'm just trying to set your expectations properly. > +inline void set_desc(struct xgene_enet_desc *desc, enum desc_info_index index, > + u64 val) > +{ The "inline" tag is not necessary, let the compiler figure it out. > + u8 word_index = desc_info[index].word_index; > + u8 start_bit = desc_info[index].start_bit; > + u8 len = desc_info[index].len; > + > + u64 mask = GENMASK_ULL((start_bit + len - 1), start_bit); > + ((u64 *)desc)[word_index] = (((u64 *)desc)[word_index] & ~mask) > + | (((u64) val << start_bit) & mask); This looks horrible for several reasons. First of all, do not put empty lines in the middle of a set of local variable declarations. But do put a single empty line after the last local variable, and before the actual code of the function starts. Get rid of all of this excessive casting. Tell the compiler what you're actually doing, pass 'desc' in as "void *" and use local "u64 *" pointers (to which 'desc' is assigned to) if you must.
next prev parent reply other threads:[~2014-04-12 20:55 UTC|newest] Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-04-12 3:06 [PATCH v2 0/4] net: Add APM X-Gene SoC Ethernet driver support Iyappan Subramanian 2014-04-12 3:06 ` Iyappan Subramanian 2014-04-12 3:06 ` [PATCH v2 1/4] MAINTAINERS: Add entry for APM X-Gene SoC ethernet driver Iyappan Subramanian 2014-04-12 3:06 ` Iyappan Subramanian 2014-04-12 3:06 ` Iyappan Subramanian 2014-04-12 3:06 ` [PATCH v2 2/4] Documentation: dts: Add bindings " Iyappan Subramanian 2014-04-12 3:06 ` Iyappan Subramanian 2014-04-12 18:55 ` Florian Fainelli 2014-04-12 18:55 ` Florian Fainelli 2014-04-12 18:55 ` Florian Fainelli 2014-04-14 22:11 ` Iyappan Subramanian 2014-04-14 22:11 ` Iyappan Subramanian 2014-04-14 22:11 ` Iyappan Subramanian 2014-04-14 13:06 ` Ben Dooks 2014-04-14 13:06 ` Ben Dooks 2014-04-14 22:15 ` Iyappan Subramanian 2014-04-14 22:15 ` Iyappan Subramanian 2014-04-14 22:15 ` Iyappan Subramanian 2014-04-18 19:51 ` Sergei Shtylyov 2014-04-18 19:51 ` Sergei Shtylyov 2014-04-12 3:06 ` [PATCH v2 3/4] " Iyappan Subramanian 2014-04-12 3:06 ` Iyappan Subramanian 2014-04-12 3:06 ` Iyappan Subramanian 2014-04-12 3:06 ` [PATCH v2 4/4] drivers: net: Add APM X-Gene SoC ethernet driver support Iyappan Subramanian 2014-04-12 3:06 ` Iyappan Subramanian 2014-04-12 3:06 ` Iyappan Subramanian 2014-04-12 20:55 ` David Miller [this message] 2014-04-12 20:55 ` David Miller 2014-04-14 22:09 ` Iyappan Subramanian 2014-04-14 22:09 ` Iyappan Subramanian 2014-04-14 22:09 ` Iyappan Subramanian 2014-04-14 14:05 ` Ben Dooks 2014-04-14 14:05 ` Ben Dooks 2014-04-17 2:06 ` Iyappan Subramanian 2014-04-17 2:06 ` Iyappan Subramanian 2014-04-17 2:06 ` Iyappan Subramanian 2014-04-14 13:07 ` [PATCH v2 0/4] net: Add APM X-Gene SoC Ethernet " Ben Dooks 2014-04-14 13:07 ` Ben Dooks 2014-04-14 13:12 ` Ben Dooks 2014-04-14 13:12 ` Ben Dooks 2014-04-14 13:12 ` Ben Dooks
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=20140412.165549.1068958710661824002.davem@davemloft.net \ --to=davem@davemloft.net \ --cc=devicetree@vger.kernel.org \ --cc=gregkh@linuxfoundation.org \ --cc=isubramanian@apm.com \ --cc=jcm@redhat.com \ --cc=kchudgar@apm.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=netdev@vger.kernel.org \ --cc=patches@apm.com \ --cc=rapatel@apm.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: linkBe 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.