RE: [PATCH 08/23] libusbg: Fix wrong binding parsing.

2014-03-10 Thread Krzysztof Opasiak
 -Original Message-
 From: Sergei Shtylyov [mailto:sergei.shtyl...@cogentembedded.com]
 Sent: Wednesday, March 05, 2014 7:58 PM
 To: Krzysztof Opasiak; mpor...@linaro.org; linux-
 u...@vger.kernel.org
 Cc: Andrzej Pietrasiewicz; Karol Lewandowski; Stanislaw Wadas;
 ty317@samsung.org; Marek Szyprowski; Robert Baldyga
 Subject: Re: [PATCH 08/23] libusbg: Fix wrong binding parsing.
 
 Hello.
 
 On 03/05/2014 05:14 PM, Krzysztof Opasiak wrote:
 
  usbg_parse_bindings() function has done parsing incorrectly
  and in inefficent way. Changes made in this function provide
  better performance and fix wrong linking issue when having
  two instances of the same function.
 
  Signed-off-by: Krzysztof Opasiak k.opas...@samsung.com
  ---
src/usbg.c |   34 --
1 file changed, 20 insertions(+), 14 deletions(-)
 
  diff --git a/src/usbg.c b/src/usbg.c
  index 198fc7a..255074f 100644
  --- a/src/usbg.c
  +++ b/src/usbg.c
 [...]
  @@ -420,19 +423,22 @@ static void
 usbg_parse_config_bindings(usbg_config *c)
  TAILQ_INIT(c-bindings);
 
  n = scandir(bpath, dent, bindings_select, alphasort);
 [...]
  +   for (i = 0; i  n; i++) {
  +   sprintf(file_name, %s/%s, bpath, dent[i]-d_name);
  +   nmb = readlink(file_name, target,
 USBG_MAX_PATH_LENGTH);
  +   if (nmb  0)
  +   ERRORNO(bytes %d contents %s\n, n, target);
  +
  +   /* readlink() don't add this, so we have to do it
 manually */
  +   target[nmb] = '\0';
  +   /* Target contains a full path
  +*  but we need only function dir name */
  +   target_name = strrchr(target, '/') + 1;
 
 Why the indentation jumped suddenly to the right? I know I'm
 asking this
 question for the 2nd time already. :-)
 
Ohhh stupid mergetool. I was rebasing my patches to change their
order and I have used kdiff to solve conflicts but unexpectedly that
tool has done some wrong automerge like this. As you recommended earlier
I have used a checkpatch.pl script but it didn't found it as error or
warning. I will fix it for v2.

Thank you for your remarks,

BR's
Krzysiek


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 08/23] libusbg: Fix wrong binding parsing.

2014-03-05 Thread Sergei Shtylyov

Hello.

On 03/05/2014 05:14 PM, Krzysztof Opasiak wrote:


usbg_parse_bindings() function has done parsing incorrectly
and in inefficent way. Changes made in this function provide
better performance and fix wrong linking issue when having
two instances of the same function.



Signed-off-by: Krzysztof Opasiak k.opas...@samsung.com
---
  src/usbg.c |   34 --
  1 file changed, 20 insertions(+), 14 deletions(-)



diff --git a/src/usbg.c b/src/usbg.c
index 198fc7a..255074f 100644
--- a/src/usbg.c
+++ b/src/usbg.c

[...]

@@ -420,19 +423,22 @@ static void usbg_parse_config_bindings(usbg_config *c)
TAILQ_INIT(c-bindings);

n = scandir(bpath, dent, bindings_select, alphasort);

[...]

+   for (i = 0; i  n; i++) {
+   sprintf(file_name, %s/%s, bpath, dent[i]-d_name);
+   nmb = readlink(file_name, target, USBG_MAX_PATH_LENGTH);
+   if (nmb  0)
+   ERRORNO(bytes %d contents %s\n, n, target);
+
+   /* readlink() don't add this, so we have to do it manually */
+   target[nmb] = '\0';
+   /* Target contains a full path
+*  but we need only function dir name */
+   target_name = strrchr(target, '/') + 1;


   Why the indentation jumped suddenly to the right? I know I'm asking this 
question for the 2nd time already. :-)


WBR, Sergei

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html