Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1570307 > unrolled thread
| Started by | Joe Perches <joe@perches.com> |
|---|---|
| First post | 2017-01-31 05:10 +0100 |
| Last post | 2017-01-31 13:30 +0100 |
| Articles | 6 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH 001] staging: wlan-ng: Add tabstop preceding the statement Joe Perches <joe@perches.com> - 2017-01-31 05:10 +0100
Re: [PATCH 001] staging: wlan-ng: Add tabstop preceding the statement Maksymilian Piechota <maksymilianpiechota@gmail.com> - 2017-01-31 12:10 +0100
Re: [PATCH 001] staging: wlan-ng: Add tabstop preceding the statement Joe Perches <joe@perches.com> - 2017-01-31 12:20 +0100
Re: [PATCH 001] staging: wlan-ng: Add tabstop preceding the statement Maksymilian Piechota <maksymilianpiechota@gmail.com> - 2017-01-31 12:40 +0100
Re: [PATCH 001] staging: wlan-ng: Add tabstop preceding the statement Joe Perches <joe@perches.com> - 2017-01-31 13:10 +0100
Re: [PATCH 001] staging: wlan-ng: Add tabstop preceding the statement Maksymilian Piechota <maksymilianpiechota@gmail.com> - 2017-01-31 13:30 +0100
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2017-01-31 05:10 +0100 |
| Subject | Re: [PATCH 001] staging: wlan-ng: Add tabstop preceding the statement |
| Message-ID | <t5xVw-4sX-1@gated-at.bofh.it> |
On Mon, 2017-01-30 at 17:44 +0100, Greg Kroah-Hartman wrote:
> On Mon, Jan 30, 2017 at 11:31:42AM -0500, Maksymilian Piechota wrote:
> > This patch fixes the checkpatch.pl warning:
> >
> > WARNING: Statements should start on a tabstop
> >
> > Signed-off-by: Maksymilian Piechota <maksymilianpiechota@gmail.com>
> > ---
> > drivers/staging/wlan-ng/prism2mgmt.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c
> > index 16fb2d3..2d67125 100644
> > --- a/drivers/staging/wlan-ng/prism2mgmt.c
> > +++ b/drivers/staging/wlan-ng/prism2mgmt.c
> > @@ -1308,7 +1308,7 @@ int prism2mgmt_wlansniff(struct wlandevice *wlandev, void *msgp)
> > hw->sniffhdr = 0;
> > wlandev->netdev->type = ARPHRD_IEEE80211_PRISM;
> > } else
> > - if ((msg->wlanheader.status ==
> > + if ((msg->wlanheader.status ==
> > P80211ENUM_msgitem_status_data_ok)
> > && (msg->wlanheader.data == P80211ENUM_truth_true)) {
> > hw->sniffhdr = 1;
>
> Hm, this all doesn't look correct now, does it? Please fix up the whole
> if statement here.
Ideally, it'd look something like:
/* Set the driver state */
/* Do we want the prism2 header? */
if (msg->prismheader.status == P80211ENUM_msgitem_status_data_ok &&
msg->prismheader.data == P80211ENUM_truth_true) {
hw->sniffhdr = 0;
wlandev->netdev->type = ARPHRD_IEEE80211_PRISM;
} else if (msg->wlanheader.status == P80211ENUM_msgitem_status_data_ok &&
msg->wlanheader.data == P80211ENUM_truth_true) {
hw->sniffhdr = 1;
wlandev->netdev->type = ARPHRD_IEEE80211_PRISM;
} else {
wlandev->netdev->type = ARPHRD_IEEE80211;
}
with the unnecessary parentheses removed,
the logical continuations at the end-of-line,
and the else if on a single line.
[toc] | [next] | [standalone]
| From | Maksymilian Piechota <maksymilianpiechota@gmail.com> |
|---|---|
| Date | 2017-01-31 12:10 +0100 |
| Subject | Re: [PATCH 001] staging: wlan-ng: Add tabstop preceding the statement |
| Message-ID | <t5EtX-8qc-1@gated-at.bofh.it> |
| In reply to | #1570307 |
On Mon, Jan 30, 2017 at 08:00:36PM -0800, Joe Perches wrote:
> On Mon, 2017-01-30 at 17:44 +0100, Greg Kroah-Hartman wrote:
> > On Mon, Jan 30, 2017 at 11:31:42AM -0500, Maksymilian Piechota wrote:
> > > This patch fixes the checkpatch.pl warning:
> > >
> > > WARNING: Statements should start on a tabstop
> > >
> > > Signed-off-by: Maksymilian Piechota <maksymilianpiechota@gmail.com>
> > > ---
> > > drivers/staging/wlan-ng/prism2mgmt.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c
> > > index 16fb2d3..2d67125 100644
> > > --- a/drivers/staging/wlan-ng/prism2mgmt.c
> > > +++ b/drivers/staging/wlan-ng/prism2mgmt.c
> > > @@ -1308,7 +1308,7 @@ int prism2mgmt_wlansniff(struct wlandevice *wlandev, void *msgp)
> > > hw->sniffhdr = 0;
> > > wlandev->netdev->type = ARPHRD_IEEE80211_PRISM;
> > > } else
> > > - if ((msg->wlanheader.status ==
> > > + if ((msg->wlanheader.status ==
> > > P80211ENUM_msgitem_status_data_ok)
> > > && (msg->wlanheader.data == P80211ENUM_truth_true)) {
> > > hw->sniffhdr = 1;
> >
> > Hm, this all doesn't look correct now, does it? Please fix up the whole
> > if statement here.
>
> Ideally, it'd look something like:
>
> /* Set the driver state */
> /* Do we want the prism2 header? */
> if (msg->prismheader.status == P80211ENUM_msgitem_status_data_ok &&
> msg->prismheader.data == P80211ENUM_truth_true) {
> hw->sniffhdr = 0;
> wlandev->netdev->type = ARPHRD_IEEE80211_PRISM;
> } else if (msg->wlanheader.status == P80211ENUM_msgitem_status_data_ok &&
> msg->wlanheader.data == P80211ENUM_truth_true) {
> hw->sniffhdr = 1;
> wlandev->netdev->type = ARPHRD_IEEE80211_PRISM;
> } else {
> wlandev->netdev->type = ARPHRD_IEEE80211;
> }
>
> with the unnecessary parentheses removed,
> the logical continuations at the end-of-line,
> and the else if on a single line.
>
I must admit it looks better, but this way we get 2 warnings instead of
1 (before my changes). What is the policy? Can we ignore more warnings
in order to get cleaner code?
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2017-01-31 12:20 +0100 |
| Message-ID | <t5EDD-8tt-3@gated-at.bofh.it> |
| In reply to | #1570605 |
On Tue, 2017-01-31 at 06:04 -0500, Maksymilian Piechota wrote:
> On Mon, Jan 30, 2017 at 08:00:36PM -0800, Joe Perches wrote:
> > On Mon, 2017-01-30 at 17:44 +0100, Greg Kroah-Hartman wrote:
> > > On Mon, Jan 30, 2017 at 11:31:42AM -0500, Maksymilian Piechota wrote:
> > > > This patch fixes the checkpatch.pl warning:
> > > >
> > > > WARNING: Statements should start on a tabstop
> > > >
> > > > Signed-off-by: Maksymilian Piechota <maksymilianpiechota@gmail.com>
> > > > ---
> > > > drivers/staging/wlan-ng/prism2mgmt.c | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c
> > > > index 16fb2d3..2d67125 100644
> > > > --- a/drivers/staging/wlan-ng/prism2mgmt.c
> > > > +++ b/drivers/staging/wlan-ng/prism2mgmt.c
> > > > @@ -1308,7 +1308,7 @@ int prism2mgmt_wlansniff(struct wlandevice *wlandev, void *msgp)
> > > > hw->sniffhdr = 0;
> > > > wlandev->netdev->type = ARPHRD_IEEE80211_PRISM;
> > > > } else
> > > > - if ((msg->wlanheader.status ==
> > > > + if ((msg->wlanheader.status ==
> > > > P80211ENUM_msgitem_status_data_ok)
> > > > && (msg->wlanheader.data == P80211ENUM_truth_true)) {
> > > > hw->sniffhdr = 1;
> > >
> > > Hm, this all doesn't look correct now, does it? Please fix up the whole
> > > if statement here.
> >
> > Ideally, it'd look something like:
> >
> > /* Set the driver state */
> > /* Do we want the prism2 header? */
> > if (msg->prismheader.status == P80211ENUM_msgitem_status_data_ok &&
> > msg->prismheader.data == P80211ENUM_truth_true) {
> > hw->sniffhdr = 0;
> > wlandev->netdev->type = ARPHRD_IEEE80211_PRISM;
> > } else if (msg->wlanheader.status == P80211ENUM_msgitem_status_data_ok &&
> > msg->wlanheader.data == P80211ENUM_truth_true) {
> > hw->sniffhdr = 1;
> > wlandev->netdev->type = ARPHRD_IEEE80211_PRISM;
> > } else {
> > wlandev->netdev->type = ARPHRD_IEEE80211;
> > }
> >
> > with the unnecessary parentheses removed,
> > the logical continuations at the end-of-line,
> > and the else if on a single line.
> >
>
> I must admit it looks better, but this way we get 2 warnings instead of
> 1 (before my changes). What is the policy? Can we ignore more warnings
> in order to get cleaner code?
Yes please.
checkpatch is just a guide, it's brainless.
The reason these lines are > 80 columns is
overly long/verbose identifiers.
If you really want to clean up the code here,
the P90211ENUM_ prefixes are a bit misleading
as they all are #define and not enums at all.
[toc] | [prev] | [next] | [standalone]
| From | Maksymilian Piechota <maksymilianpiechota@gmail.com> |
|---|---|
| Date | 2017-01-31 12:40 +0100 |
| Subject | Re: [PATCH 001] staging: wlan-ng: Add tabstop preceding the statement |
| Message-ID | <t5EX0-8E-13@gated-at.bofh.it> |
| In reply to | #1570614 |
On Tue, Jan 31, 2017 at 03:18:45AM -0800, Joe Perches wrote:
> On Tue, 2017-01-31 at 06:04 -0500, Maksymilian Piechota wrote:
> > On Mon, Jan 30, 2017 at 08:00:36PM -0800, Joe Perches wrote:
> > > On Mon, 2017-01-30 at 17:44 +0100, Greg Kroah-Hartman wrote:
> > > > On Mon, Jan 30, 2017 at 11:31:42AM -0500, Maksymilian Piechota wrote:
> > > > > This patch fixes the checkpatch.pl warning:
> > > > >
> > > > > WARNING: Statements should start on a tabstop
> > > > >
> > > > > Signed-off-by: Maksymilian Piechota <maksymilianpiechota@gmail.com>
> > > > > ---
> > > > > drivers/staging/wlan-ng/prism2mgmt.c | 2 +-
> > > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c
> > > > > index 16fb2d3..2d67125 100644
> > > > > --- a/drivers/staging/wlan-ng/prism2mgmt.c
> > > > > +++ b/drivers/staging/wlan-ng/prism2mgmt.c
> > > > > @@ -1308,7 +1308,7 @@ int prism2mgmt_wlansniff(struct wlandevice *wlandev, void *msgp)
> > > > > hw->sniffhdr = 0;
> > > > > wlandev->netdev->type = ARPHRD_IEEE80211_PRISM;
> > > > > } else
> > > > > - if ((msg->wlanheader.status ==
> > > > > + if ((msg->wlanheader.status ==
> > > > > P80211ENUM_msgitem_status_data_ok)
> > > > > && (msg->wlanheader.data == P80211ENUM_truth_true)) {
> > > > > hw->sniffhdr = 1;
> > > >
> > > > Hm, this all doesn't look correct now, does it? Please fix up the whole
> > > > if statement here.
> > >
> > > Ideally, it'd look something like:
> > >
> > > /* Set the driver state */
> > > /* Do we want the prism2 header? */
> > > if (msg->prismheader.status == P80211ENUM_msgitem_status_data_ok &&
> > > msg->prismheader.data == P80211ENUM_truth_true) {
> > > hw->sniffhdr = 0;
> > > wlandev->netdev->type = ARPHRD_IEEE80211_PRISM;
> > > } else if (msg->wlanheader.status == P80211ENUM_msgitem_status_data_ok &&
> > > msg->wlanheader.data == P80211ENUM_truth_true) {
> > > hw->sniffhdr = 1;
> > > wlandev->netdev->type = ARPHRD_IEEE80211_PRISM;
> > > } else {
> > > wlandev->netdev->type = ARPHRD_IEEE80211;
> > > }
> > >
> > > with the unnecessary parentheses removed,
> > > the logical continuations at the end-of-line,
> > > and the else if on a single line.
> > >
> >
> > I must admit it looks better, but this way we get 2 warnings instead of
> > 1 (before my changes). What is the policy? Can we ignore more warnings
> > in order to get cleaner code?
>
> Yes please.
>
> checkpatch is just a guide, it's brainless.
>
> The reason these lines are > 80 columns is
> overly long/verbose identifiers.
>
> If you really want to clean up the code here,
> the P90211ENUM_ prefixes are a bit misleading
> as they all are #define and not enums at all.
>
But would you like me to remove this prefixes for all of the enums from
p80211types.h? Are you sure it won't cause any symbol conflicts?
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2017-01-31 13:10 +0100 |
| Message-ID | <t5Fq1-xl-17@gated-at.bofh.it> |
| In reply to | #1570625 |
On Tue, 2017-01-31 at 06:33 -0500, Maksymilian Piechota wrote: > On Tue, Jan 31, 2017 at 03:18:45AM -0800, Joe Perches wrote: > > checkpatch is just a guide, it's brainless. > > > > The reason these lines are > 80 columns is > > overly long/verbose identifiers. > > > > If you really want to clean up the code here, > > the P90211ENUM_ prefixes are a bit misleading > > as they all are #define and not enums at all. > > > But would you like me to remove this prefixes for all of the enums from > p80211types.h? Are you sure it won't cause any symbol conflicts? No, I don't want that, I'd prefer you think about it. Also, a useful effort would be to (from the README) TODO: [] - move to use the in-kernel wireless stack where most all of the P80211 code would be removed. Anyway, sure, use checkpatch as a tool to help when learning the process of how to submit patches properly. Then move on to more thoroughly understand a block of code in the kernel that can be improved with cleaner style and logic and bug fixes you could submit. That's be much more appreciated than random 80 column fixups and strict checkpatch compliance done without a thorough understanding of the code. In any case, welcome, hope you stick around.
[toc] | [prev] | [next] | [standalone]
| From | Maksymilian Piechota <maksymilianpiechota@gmail.com> |
|---|---|
| Date | 2017-01-31 13:30 +0100 |
| Subject | Re: [PATCH 001] staging: wlan-ng: Add tabstop preceding the statement |
| Message-ID | <t5FJp-DW-33@gated-at.bofh.it> |
| In reply to | #1570654 |
On Tue, Jan 31, 2017 at 04:07:04AM -0800, Joe Perches wrote: > On Tue, 2017-01-31 at 06:33 -0500, Maksymilian Piechota wrote: > > On Tue, Jan 31, 2017 at 03:18:45AM -0800, Joe Perches wrote: > > > checkpatch is just a guide, it's brainless. > > > > > > The reason these lines are > 80 columns is > > > overly long/verbose identifiers. > > > > > > If you really want to clean up the code here, > > > the P90211ENUM_ prefixes are a bit misleading > > > as they all are #define and not enums at all. > > > > > But would you like me to remove this prefixes for all of the enums from > > p80211types.h? Are you sure it won't cause any symbol conflicts? > > No, I don't want that, I'd prefer you think about it. > > Also, a useful effort would be to (from the README) > > TODO: > [] > - move to use the in-kernel wireless stack > > where most all of the P80211 code would be removed. > > Anyway, sure, use checkpatch as a tool to help when > learning the process of how to submit patches properly. > Then move on to more thoroughly understand a block of > code in the kernel that can be improved with cleaner > style and logic and bug fixes you could submit. > > That's be much more appreciated than random 80 column > fixups and strict checkpatch compliance done without > a thorough understanding of the code. > > In any case, welcome, hope you stick around. It's clear that there are a lot more usefull patches than 80 column fix, but as you said, I learn how to submit patches and there is is constraint to submit only one checkpatch warning fix. Many thanks for advice how to proceed. I will take a look at it when I finish Greg's tutorial. Thank you, I hope to have a significant contribution to Linux Community.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web