Skip to contentSkip to conversation

Eudyptula Challenge (Task 10)

PATCH Superseded Wahib Faizi 5 participants 20 messages Jun 12, 2014 – Jun 18, 2014 1 message not in the archive Staging

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): Eudyptula Challenge (Task 10)

#1 lore raw

Greetings Linux Kernel Developers!

This is Task 10 of the Eudyptula Challenge.

#2 lore raw

PATCH 1/1 drivers/staging/usbip/userspace/libsrc/usbip_host_driver.c: fix coding style

Fix coding style issues detected by checkpatch.pl:
1. do not use assignment in if condition
2. line over 80 characters

---
 .../usbip/userspace/libsrc/usbip_host_driver.c     |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/usbip/userspace/libsrc/usbip_host_driver.c +4 -3
index 92caef7..bef08d5 100644
@@ -47,7 +47,8 @@ static int32_t read_attr_usbip_status(struct usbip_usb_device *udev)
 	snprintf(status_attr_path, SYSFS_PATH_MAX, "%s/usbip_status",
 		 udev->path);
 
-	if ((fd = open(status_attr_path, O_RDONLY)) < 0) {
+	fd = open(status_attr_path, O_RDONLY);
+	if (fd < 0) {
 		err("error opening attribute %s", status_attr_path);
 		return -1;
 	}
@@ -87,8 +88,8 @@ struct usbip_exported_device *usbip_exported_device_new(const char *sdevpath)
 		goto err;
 
 	/* reallocate buffer to include usb interface data */
-	size = sizeof(struct usbip_exported_device) + edev->udev.bNumInterfaces *
-		sizeof(struct usbip_usb_interface);
+	size = sizeof(struct usbip_exported_device) +
+		edev->udev.bNumInterfaces * sizeof(struct usbip_usb_interface);
 
 	edev_old = edev;
 	edev = realloc(edev, size);
Signature · 1 line
1.7.9.5
#3 lore raw

Re: [PATCH] drivers/staging/usbip/userspace/libsrc/usbip_host_driver.c: fix coding style

Quoted 3 lines · Wahib Faizi

Fix coding style issues detected by checkpatch.pl:
1. do not use assignment in if condition
2. line over 80 characters

You are doing two different things here, so please break it up into two different patches. Can you please do this and resend?

thanks,

greg k-h

#4 lore raw

Split patch into 2 logical chunks

In reply to Wahib Faizi

Fix coding style issues detected by checkpatch.pl in usbip_host_driver.c.

v2: Split patch into logical chunks, as suggested by
Greg Kroah-Hartman <[email protected]>

[PATCH v2 1/2]
Fix coding style issue "do not use assignment in if condition" detected by checkpatch.pl in usbip_host_driver.c.

[PATCH v2 2/2]
Fix coding style issue "line over 80 characters"
detected by checkpatch.pl in usbip_host_driver.c.

#5 lore raw

PATCH v2 1/2 drivers/staging/usbip/userspace/libsrc/usbip_host_driver.c: fix coding style

Fix coding style issue "do not use assignment in if condition" detected by checkpatch.pl in usbip_host_driver.c.

---
 .../usbip/userspace/libsrc/usbip_host_driver.c     |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/usbip/userspace/libsrc/usbip_host_driver.c +2 -1
index 92caef7..32b8f52 100644
@@ -47,7 +47,8 @@ static int32_t read_attr_usbip_status(struct usbip_usb_device *udev)
 	snprintf(status_attr_path, SYSFS_PATH_MAX, "%s/usbip_status",
 		 udev->path);
 
-	if ((fd = open(status_attr_path, O_RDONLY)) < 0) {
+	fd = open(status_attr_path, O_RDONLY);
+	if (fd < 0) {
 		err("error opening attribute %s", status_attr_path);
 		return -1;
 	}
Signature · 1 line
1.7.9.5
#6 lore raw

Re: [PATCH v2 1/2] drivers/staging/usbip/userspace/libsrc/usbip_host_driver.c: fix coding style

Quoted 4 lines · Wahib Faizi

Fix coding style issue "do not use assignment in if condition" detected by checkpatch.pl in usbip_host_driver.c.

Both of these patches have the same Subject: line, which isn't good as it doesn't make much sense.

You can also shorten it a lot, for example, this one should be:
Subject: staging: usbip: usbip_host_driver.c: fix if assignment style issue

Care to redo both of these that way?

thanks,

greg k-h

#7 lore raw

Re: [PATCH v2 1/2] drivers/staging/usbip/userspace/libsrc/usbip_host_driver.c: fix coding style

Quoted 11 lines · Greg Kroah-Hartman
Quoted 4 lines · Wahib Faizi

Fix coding style issue "do not use assignment in if condition" detected by checkpatch.pl in usbip_host_driver.c.

Both of these patches have the same Subject: line, which isn't good as it doesn't make much sense.

You can also shorten it a lot, for example, this one should be:
Subject: staging: usbip: usbip_host_driver.c: fix if assignment style issue

True. usbip_host_driver.c doesn't add much though.

It could even be something like:

staging: usbip: avoid assignment in if

#8 lore raw

PATCH v2 2/2 drivers/staging/usbip/userspace/libsrc/usbip_host_driver.c: fix coding style

In reply to Wahib Faizi

Fix coding style issue "line over 80 characters"
detected by checkpatch.pl in usbip_host_driver.c.

---
 .../usbip/userspace/libsrc/usbip_host_driver.c     |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/usbip/userspace/libsrc/usbip_host_driver.c +2 -2
index 32b8f52..bef08d5 100644
@@ -88,8 +88,8 @@ struct usbip_exported_device *usbip_exported_device_new(const char *sdevpath)
 		goto err;
 
 	/* reallocate buffer to include usb interface data */
-	size = sizeof(struct usbip_exported_device) + edev->udev.bNumInterfaces *
-		sizeof(struct usbip_usb_interface);
+	size = sizeof(struct usbip_exported_device) +
+		edev->udev.bNumInterfaces * sizeof(struct usbip_usb_interface);
 
 	edev_old = edev;
 	edev = realloc(edev, size);
Signature · 1 line
1.7.9.5
#10 lore raw

PATCH v3 1/2 staging: usbip: usbip_host_driver.c: avoid assignment in if

Fix coding style issue "do not use assignment in if condition" detected by checkpatch.pl in usbip_host_driver.c.

---
 .../usbip/userspace/libsrc/usbip_host_driver.c     |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/usbip/userspace/libsrc/usbip_host_driver.c +2 -1
index 92caef7..32b8f52 100644
@@ -47,7 +47,8 @@ static int32_t read_attr_usbip_status(struct usbip_usb_device *udev)
 	snprintf(status_attr_path, SYSFS_PATH_MAX, "%s/usbip_status",
 		 udev->path);
 
-	if ((fd = open(status_attr_path, O_RDONLY)) < 0) {
+	fd = open(status_attr_path, O_RDONLY);
+	if (fd < 0) {
 		err("error opening attribute %s", status_attr_path);
 		return -1;
 	}
Signature · 1 line
1.7.9.5
#11 lore raw

PATCH v3 2/2 staging: usbip: usbip_host_driver.c: fix line over 80 characters

In reply to Wahib Faizi

Fix coding style issue "line over 80 characters"
detected by checkpatch.pl in usbip_host_driver.c.

---
 .../usbip/userspace/libsrc/usbip_host_driver.c     |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/usbip/userspace/libsrc/usbip_host_driver.c +2 -2
index 32b8f52..bef08d5 100644
@@ -88,8 +88,8 @@ struct usbip_exported_device *usbip_exported_device_new(const char *sdevpath)
 		goto err;
 
 	/* reallocate buffer to include usb interface data */
-	size = sizeof(struct usbip_exported_device) + edev->udev.bNumInterfaces *
-		sizeof(struct usbip_usb_interface);
+	size = sizeof(struct usbip_exported_device) +
+		edev->udev.bNumInterfaces * sizeof(struct usbip_usb_interface);
 
 	edev_old = edev;
 	edev = realloc(edev, size);
Signature · 1 line
1.7.9.5
#13 lore raw

PATCH v3 1/2 staging: usbip: usbip_host_driver.c: avoid assignment in if

Fix coding style issue "do not use assignment in if condition" detected by checkpatch.pl in usbip_host_driver.c.

---
 .../usbip/userspace/libsrc/usbip_host_driver.c     |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/usbip/userspace/libsrc/usbip_host_driver.c +2 -1
index 92caef7..32b8f52 100644
@@ -47,7 +47,8 @@ static int32_t read_attr_usbip_status(struct usbip_usb_device *udev)
 	snprintf(status_attr_path, SYSFS_PATH_MAX, "%s/usbip_status",
 		 udev->path);
 
-	if ((fd = open(status_attr_path, O_RDONLY)) < 0) {
+	fd = open(status_attr_path, O_RDONLY);
+	if (fd < 0) {
 		err("error opening attribute %s", status_attr_path);
 		return -1;
 	}
Signature · 1 line
1.7.9.5
#14 lore raw

PATCH v3 2/2 staging: usbip: usbip_host_driver.c: fix line over 80 characters

In reply to Wahib Faizi

Fix coding style issue "line over 80 characters"
detected by checkpatch.pl in usbip_host_driver.c.

---
 .../usbip/userspace/libsrc/usbip_host_driver.c     |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/usbip/userspace/libsrc/usbip_host_driver.c +2 -2
index 32b8f52..bef08d5 100644
@@ -88,8 +88,8 @@ struct usbip_exported_device *usbip_exported_device_new(const char *sdevpath)
 		goto err;
 
 	/* reallocate buffer to include usb interface data */
-	size = sizeof(struct usbip_exported_device) + edev->udev.bNumInterfaces *
-		sizeof(struct usbip_usb_interface);
+	size = sizeof(struct usbip_exported_device) +
+		edev->udev.bNumInterfaces * sizeof(struct usbip_usb_interface);
 
 	edev_old = edev;
 	edev = realloc(edev, size);
Signature · 1 line
1.7.9.5
#15 lore raw

Re: [PATCH v3 0/2] Fix subject line

In reply to Wahib Faizi
Quoted 1 line · Wahib Faizi

Fix coding style issues detected by checkpatch.pl in usbip_host_driver.c.

Sorry but unless bundled with something more meaningful, I really don't see the value in these changes. I certainly don't want to discourage folks or anything, but just testing other patches is a lot more helpful than this.

I haven't followed much about the Eudyptula Challenge, but I hope other assignments are more involved than this.

Thanks,
Davidlohr

#16 lore raw

Re: [PATCH v3 0/2] Fix subject line

Quoted 7 lines · Davidlohr Bueso
Quoted 1 line · Wahib Faizi

Fix coding style issues detected by checkpatch.pl in usbip_host_driver.c.

Sorry but unless bundled with something more meaningful, I really don't see the value in these changes. I certainly don't want to discourage folks or anything, but just testing other patches is a lot more helpful than this.

When the staging code is still needing basic fixes like this, it is "meaningful" to do patches that clean up stuff like this. That's what the staging tree is for.

thanks,

greg k-h

#17 lore raw

Re: [PATCH v3 0/2] Fix subject line

Quoted 4 lines · Greg Kroah-Hartman
Quoted 3 lines · Davidlohr Bueso
Quoted 1 line · Wahib Faizi

Fix coding style issues detected by checkpatch.pl in usbip_host_driver.c.

Quoted 8 lines
Quoted 4 lines

Sorry but unless bundled with something more meaningful, I really don't see the value in these changes. I certainly don't want to discourage folks or anything, but just testing other patches is a lot more helpful than this.

When the staging code is still needing basic fixes like this, it is "meaningful" to do patches that clean up stuff like this. That's what the staging tree is for.

Sure, but "making checkpatch happy just to make checkpatch happy" isn't a good justification, even for staging. Patch 1 does have value in that it helps avoid silly bugs, but take patch 2/2, we end-up saving just a few spaces... Anyways, just my 2 cents.

Thanks,
Davidlohr

#18 lore raw

Re: [PATCH v3 0/2] Fix subject line

Quoted 10 lines · Davidlohr Bueso
Quoted 9 lines · Greg Kroah-Hartman
Quoted 7 lines · Davidlohr Bueso
Quoted 1 line · Wahib Faizi

Fix coding style issues detected by checkpatch.pl in usbip_host_driver.c.

Sorry but unless bundled with something more meaningful, I really don't see the value in these changes. I certainly don't want to discourage folks or anything, but just testing other patches is a lot more helpful than this.

Quoted 6 lines
Quoted 3 lines

When the staging code is still needing basic fixes like this, it is "meaningful" to do patches that clean up stuff like this. That's what the staging tree is for.

Sure, but "making checkpatch happy just to make checkpatch happy" isn't a good justification, even for staging.

It actually is. Fighting against checkpatch is a losers battle. Our way more efficient.

1) We do need to fix this checkpatch warning before it moves out of staging.
2) NAKing patches is actually a lot of stress for everyone. It stresses out submitters and drives them away. It stresses out the maintainers because we feel bad. That stress is bad when it is pointless.
3) This patch is ok.
4) If we don't apply this patch then someone else will send the exact same patch or something worse until we apply something.
5) The v3 of this patch takes under 30 seconds to review and apply.
6) Newbies feel happy when their patch gets merged and that is good.

The other thing is that if you start asking "Is this patch meaningful" then it makes applying any patch into a big question about meaning and it tires you out.

In staging we have clear rules for when a patch is going to be applied and everyone understands the rules. It means that if Greg is traveling then you know which patches he is going to apply in what order and life is easier because it is more predictable.

regards,
dan carpenter

author
#19 lore raw

Re: [PATCH v3 0/2] Fix subject line

In reply to Davidlohr Bueso

Hi Davidlohr!

Don't worry. I am not discouraged. :)

I understand your concern that the patch feels superficial. It's what the task asked us to do. I suspect the author(s) of the Eudyptula Challenge designed this task to get us involved with the Linux kernel community.

I have been looking for a bug in 'usbip' to bundle with my patch. The only bug that I could find (as of 16-Jun-2014) on bugzilla.kernel.org related to 'usbip' is Bug 77191.

Bug 77191 - ftdi-sio (usbserial) over usbip hung after disconnect while in use
(https://bugzilla.kernel.org/show_bug.cgi?id=77191)

Sadly the bug doesn't seem to be newbie friendly as it requires special setup to reproduce and requires the developer to know about the intricacies of the 'usbip' subsystem. I understand that people commiting their specialized knowledge is how the kernel development actually works. But USB is not my speciality (yet).

Could you point me to more beginner friendly bugs which aren't superficial code cleanups?

Can I bundle fixes to subsystems other than 'usbip' with the code cleanup patch for 'usbip'?

Regards,
Wahib

Quoted 14 lines · Davidlohr Bueso
Quoted 1 line · Wahib Faizi

Fix coding style issues detected by checkpatch.pl in usbip_host_driver.c.

Sorry but unless bundled with something more meaningful, I really don't see the value in these changes. I certainly don't want to discourage folks or anything, but just testing other patches is a lot more helpful than this.

I haven't followed much about the Eudyptula Challenge, but I hope other assignments are more involved than this.

Thanks,
Davidlohr

#20 lore raw

Re: [PATCH v3 0/2] Fix subject line

Quoted 7 lines · Wahib

Hi Davidlohr!

Don't worry. I am not discouraged. :)

I understand your concern that the patch feels superficial. It's what the task asked us to do. I suspect the author(s) of the Eudyptula Challenge designed this task to get us involved with the Linux kernel community.

If you feel you actually learn something by doing the Eudyptula Challenge, then good for you, and by all means continue doing so. As I mentioned, I know almost zero about it, but can say for sure that cleanups alone won't get you very far in the community and you will probably get bored sooner or later -- which is unfortunate as kernel hacking fascinating.

Quoted 8 lines

I have been looking for a bug in 'usbip' to bundle with my patch. The only bug that I could find (as of 16-Jun-2014) on bugzilla.kernel.org related to 'usbip' is Bug 77191.

Bug 77191 - ftdi-sio (usbserial) over usbip hung after disconnect while in use
(https://bugzilla.kernel.org/show_bug.cgi?id=77191)

Quoted 8 lines

Sadly the bug doesn't seem to be newbie friendly as it requires special setup to reproduce and requires the developer to know about the intricacies of the 'usbip' subsystem. I understand that people commiting their specialized knowledge is how the kernel development actually works. But USB is not my speciality (yet).

Could you point me to more beginner friendly bugs which aren't superficial code cleanups?

There are plenty of bugs out there, and not so hard to find -- just push some module/filesystem/subsystem/testcase hard enough to make it do things it shouldn't. Run linux-next on trinity and fix/report the bugs, etc.

imho testing and reading other people's patches is perhaps the best way to do useful things, get acquainted with the code and get experience with lkml and the process behind kernel development.

Quoted 2 lines

Can I bundle fixes to subsystems other than 'usbip' with the code cleanup patch for 'usbip'?

Probably not, unless it's a tree-wide change.

Hope this helps,
Davidlohr