This patch series fixes several checkpatch issues with the greybus Documentation/firmware files.
Michael Sartain (4): Remove trailing semicolon from FW_TIMEOUT_DEFAULT define Remove extra braces from single line if conditionals Change long long unsigned int to unsigned long long int Convert sscanf calls to strtoul
.../greybus/Documentation/firmware/authenticate.c | 2 +- .../greybus/Documentation/firmware/firmware.c | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-)
Fixes checkpatch warning: macros should not use a trailing semicolon
Signed-off-by: Michael Sartain mikesart@fastmail.com --- drivers/staging/greybus/Documentation/firmware/firmware.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git drivers/staging/greybus/Documentation/firmware/firmware.c drivers/staging/greybus/Documentation/firmware/firmware.c index ff9382401030..10ef86120815 100644 --- drivers/staging/greybus/Documentation/firmware/firmware.c +++ drivers/staging/greybus/Documentation/firmware/firmware.c @@ -64,7 +64,7 @@ #define FW_TAG_INT_DEFAULT "s3f" #define FW_TAG_BCND_DEFAULT "bf_01" #define FW_UPDATE_TYPE_DEFAULT 0 -#define FW_TIMEOUT_DEFAULT 10000; +#define FW_TIMEOUT_DEFAULT 10000
static const char *firmware_tag; static const char *fwdev = FW_DEV_DEFAULT;
On 07-03-17, 22:48, Michael Sartain wrote:
Fixes checkpatch warning: macros should not use a trailing semicolon
Signed-off-by: Michael Sartain mikesart@fastmail.com
drivers/staging/greybus/Documentation/firmware/firmware.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git drivers/staging/greybus/Documentation/firmware/firmware.c drivers/staging/greybus/Documentation/firmware/firmware.c index ff9382401030..10ef86120815 100644 --- drivers/staging/greybus/Documentation/firmware/firmware.c +++ drivers/staging/greybus/Documentation/firmware/firmware.c @@ -64,7 +64,7 @@ #define FW_TAG_INT_DEFAULT "s3f" #define FW_TAG_BCND_DEFAULT "bf_01" #define FW_UPDATE_TYPE_DEFAULT 0 -#define FW_TIMEOUT_DEFAULT 10000; +#define FW_TIMEOUT_DEFAULT 10000 static const char *firmware_tag; static const char *fwdev = FW_DEV_DEFAULT;
Acked-by: Viresh Kumar viresh.kumar@linaro.org
Fixes checkpatch warning: braces {} are not necessary for any arm of this statement
Signed-off-by: Michael Sartain mikesart@fastmail.com --- drivers/staging/greybus/Documentation/firmware/firmware.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git drivers/staging/greybus/Documentation/firmware/firmware.c drivers/staging/greybus/Documentation/firmware/firmware.c index 10ef86120815..70b7fcbba5ad 100644 --- drivers/staging/greybus/Documentation/firmware/firmware.c +++ drivers/staging/greybus/Documentation/firmware/firmware.c @@ -217,13 +217,12 @@ int main(int argc, char *argv[]) if (argc > 2) sscanf(argv[2], "%u", &fw_update_type);
- if (argc > 3) { + if (argc > 3) firmware_tag = argv[3]; - } else if (!fw_update_type) { + else if (!fw_update_type) firmware_tag = FW_TAG_INT_DEFAULT; - } else { + else firmware_tag = FW_TAG_BCND_DEFAULT; - }
if (argc > 4) sscanf(argv[4], "%u", &fw_timeout);
On 07-03-17, 22:48, Michael Sartain wrote:
Fixes checkpatch warning: braces {} are not necessary for any arm of this statement
Well checkpatch isn't supposed to be run on userspace example code. But anyway, I am fine with the improvements.
Signed-off-by: Michael Sartain mikesart@fastmail.com
drivers/staging/greybus/Documentation/firmware/firmware.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git drivers/staging/greybus/Documentation/firmware/firmware.c drivers/staging/greybus/Documentation/firmware/firmware.c index 10ef86120815..70b7fcbba5ad 100644 --- drivers/staging/greybus/Documentation/firmware/firmware.c +++ drivers/staging/greybus/Documentation/firmware/firmware.c @@ -217,13 +217,12 @@ int main(int argc, char *argv[]) if (argc > 2) sscanf(argv[2], "%u", &fw_update_type);
- if (argc > 3) {
- if (argc > 3) firmware_tag = argv[3];
- } else if (!fw_update_type) {
- else if (!fw_update_type) firmware_tag = FW_TAG_INT_DEFAULT;
- } else {
- else firmware_tag = FW_TAG_BCND_DEFAULT;
- }
if (argc > 4) sscanf(argv[4], "%u", &fw_timeout);
Acked-by: Viresh Kumar viresh.kumar@linaro.org
Fixes checkpatch warning: type 'long long unsigned int' should be specified in [[un]signed] [short|int|long|long long] order
Signed-off-by: Michael Sartain mikesart@fastmail.com --- drivers/staging/greybus/Documentation/firmware/authenticate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git drivers/staging/greybus/Documentation/firmware/authenticate.c drivers/staging/greybus/Documentation/firmware/authenticate.c index ab0688ad1e37..b836f0a20c36 100644 --- drivers/staging/greybus/Documentation/firmware/authenticate.c +++ drivers/staging/greybus/Documentation/firmware/authenticate.c @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) goto close_fd; }
- printf("UID received: 0x%llx\n", *(long long unsigned int *)(uid.uid)); + printf("UID received: 0x%llx\n", *(unsigned long long int *)(uid.uid));
/* Get certificate */ printf("Get IMS certificate\n");
On 07-03-17, 22:48, Michael Sartain wrote:
Fixes checkpatch warning: type 'long long unsigned int' should be specified in [[un]signed] [short|int|long|long long] order
Signed-off-by: Michael Sartain mikesart@fastmail.com
drivers/staging/greybus/Documentation/firmware/authenticate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git drivers/staging/greybus/Documentation/firmware/authenticate.c drivers/staging/greybus/Documentation/firmware/authenticate.c index ab0688ad1e37..b836f0a20c36 100644 --- drivers/staging/greybus/Documentation/firmware/authenticate.c +++ drivers/staging/greybus/Documentation/firmware/authenticate.c @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) goto close_fd; }
- printf("UID received: 0x%llx\n", *(long long unsigned int *)(uid.uid));
- printf("UID received: 0x%llx\n", *(unsigned long long int *)(uid.uid));
/* Get certificate */ printf("Get IMS certificate\n");
Acked-by: Viresh Kumar viresh.kumar@linaro.org
Also convert the fw_update_type and fw_timeout variables to unsigned and update the printf specifier to %u.
The FW_MGMT_IOC_SET_TIMEOUT_MS ioctl takes an unsigned int and checkpatch was complaining about not checking the sscanf return values.
Signed-off-by: Michael Sartain mikesart@fastmail.com --- drivers/staging/greybus/Documentation/firmware/firmware.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git drivers/staging/greybus/Documentation/firmware/firmware.c drivers/staging/greybus/Documentation/firmware/firmware.c index 70b7fcbba5ad..c73dee9d13c1 100644 --- drivers/staging/greybus/Documentation/firmware/firmware.c +++ drivers/staging/greybus/Documentation/firmware/firmware.c @@ -52,6 +52,7 @@ */
#include <stdio.h> +#include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/ioctl.h> @@ -68,8 +69,8 @@
static const char *firmware_tag; static const char *fwdev = FW_DEV_DEFAULT; -static int fw_update_type = FW_UPDATE_TYPE_DEFAULT; -static int fw_timeout = FW_TIMEOUT_DEFAULT; +static unsigned int fw_update_type = FW_UPDATE_TYPE_DEFAULT; +static unsigned int fw_timeout = FW_TIMEOUT_DEFAULT;
static struct fw_mgmt_ioc_get_intf_version intf_fw_info; static struct fw_mgmt_ioc_get_backend_version backend_fw_info; @@ -204,6 +205,7 @@ static int update_backend_firmware(int fd) int main(int argc, char *argv[]) { int fd, ret; + char *endptr;
if (argc > 1 && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))) { @@ -215,7 +217,7 @@ int main(int argc, char *argv[]) fwdev = argv[1];
if (argc > 2) - sscanf(argv[2], "%u", &fw_update_type); + fw_update_type = strtoul(argv[2], &endptr, 10);
if (argc > 3) firmware_tag = argv[3]; @@ -225,9 +227,9 @@ int main(int argc, char *argv[]) firmware_tag = FW_TAG_BCND_DEFAULT;
if (argc > 4) - sscanf(argv[4], "%u", &fw_timeout); + fw_timeout = strtoul(argv[4], &endptr, 10);
- printf("Trying Firmware update: fwdev: %s, type: %s, tag: %s, timeout: %d\n", + printf("Trying Firmware update: fwdev: %s, type: %s, tag: %s, timeout: %u\n", fwdev, fw_update_type == 0 ? "interface" : "backend", firmware_tag, fw_timeout);
On 07-03-17, 22:48, Michael Sartain wrote:
Also convert the fw_update_type and fw_timeout variables to unsigned and update the printf specifier to %u.
The FW_MGMT_IOC_SET_TIMEOUT_MS ioctl takes an unsigned int and checkpatch was complaining about not checking the sscanf return values.
Signed-off-by: Michael Sartain mikesart@fastmail.com
drivers/staging/greybus/Documentation/firmware/firmware.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git drivers/staging/greybus/Documentation/firmware/firmware.c drivers/staging/greybus/Documentation/firmware/firmware.c index 70b7fcbba5ad..c73dee9d13c1 100644 --- drivers/staging/greybus/Documentation/firmware/firmware.c +++ drivers/staging/greybus/Documentation/firmware/firmware.c @@ -52,6 +52,7 @@ */ #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/ioctl.h> @@ -68,8 +69,8 @@ static const char *firmware_tag; static const char *fwdev = FW_DEV_DEFAULT; -static int fw_update_type = FW_UPDATE_TYPE_DEFAULT; -static int fw_timeout = FW_TIMEOUT_DEFAULT; +static unsigned int fw_update_type = FW_UPDATE_TYPE_DEFAULT; +static unsigned int fw_timeout = FW_TIMEOUT_DEFAULT; static struct fw_mgmt_ioc_get_intf_version intf_fw_info; static struct fw_mgmt_ioc_get_backend_version backend_fw_info; @@ -204,6 +205,7 @@ static int update_backend_firmware(int fd) int main(int argc, char *argv[]) { int fd, ret;
- char *endptr;
if (argc > 1 && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))) { @@ -215,7 +217,7 @@ int main(int argc, char *argv[]) fwdev = argv[1]; if (argc > 2)
sscanf(argv[2], "%u", &fw_update_type);
fw_update_type = strtoul(argv[2], &endptr, 10);
if (argc > 3) firmware_tag = argv[3]; @@ -225,9 +227,9 @@ int main(int argc, char *argv[]) firmware_tag = FW_TAG_BCND_DEFAULT; if (argc > 4)
sscanf(argv[4], "%u", &fw_timeout);
fw_timeout = strtoul(argv[4], &endptr, 10);
- printf("Trying Firmware update: fwdev: %s, type: %s, tag: %s, timeout: %d\n",
- printf("Trying Firmware update: fwdev: %s, type: %s, tag: %s, timeout: %u\n", fwdev, fw_update_type == 0 ? "interface" : "backend", firmware_tag, fw_timeout);
Acked-by: Viresh Kumar viresh.kumar@linaro.org
On 07-03-17, 22:47, Michael Sartain wrote:
This patch series fixes several checkpatch issues with the greybus Documentation/firmware files.
I have Acked all the patch, but you need to resend them with my Acks on them as the subject lines don't look good.
Please include "staging: greybus:" prefix for them as you have used in the cover letter.