[07/13] lib: fwts_ipmi: make fwts_ipmi_msg_id static, make some code style changes
diff mbox series

Message ID 20180814112435.22166-8-colin.king@canonical.com
State Accepted
Headers show
Series
  • lib: minor code clean up
Related show

Commit Message

Colin King Aug. 14, 2018, 11:24 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Variable fwts_ipmi_msg_id does not need to be in global scope so
make it static.  Make some fwts coding style changes and remove
some empty lines.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/src/fwts_ipmi.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Alex Hung Aug. 14, 2018, 7:15 p.m. UTC | #1
On 2018-08-14 04:24 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Variable fwts_ipmi_msg_id does not need to be in global scope so
> make it static.  Make some fwts coding style changes and remove
> some empty lines.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/src/fwts_ipmi.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/src/lib/src/fwts_ipmi.c b/src/lib/src/fwts_ipmi.c
> index a4c8a511..36acf6ee 100644
> --- a/src/lib/src/fwts_ipmi.c
> +++ b/src/lib/src/fwts_ipmi.c
> @@ -27,10 +27,11 @@
>   
>   #include "fwts.h"
>   
> -unsigned int fwts_ipmi_msg_id = 1;
> +static unsigned int fwts_ipmi_msg_id = 1;
>   static const char *fwts_ipmi_devnode = "/dev/ipmi0";
>   
> -bool fwts_ipmi_present(int fwts_ipmi_flags) {
> +bool fwts_ipmi_present(int fwts_ipmi_flags)
> +{
>   	return !access(fwts_ipmi_devnode, fwts_ipmi_flags);
>   }
>   
> @@ -49,7 +50,6 @@ int fwts_ipmi_exec_query(
>   		return FWTS_ERROR;
>   
>   	fwts_send_rc = ioctl(fd, IPMICTL_SEND_COMMAND, (char *)fwts_ipmi_req);
> -
>   	if (fwts_send_rc != 0) {
>   		(void)close(fd);
>   		return FWTS_ERROR;
> @@ -69,7 +69,6 @@ int fwts_ipmi_exec_query(
>   	fwts_ipmi_recv.addr = (unsigned char *)&fwts_ipmi_addr;
>   	fwts_ipmi_recv.addr_len = sizeof (fwts_ipmi_addr);
>   	fwts_recv_rc = ioctl(fd, IPMICTL_RECEIVE_MSG_TRUNC, &fwts_ipmi_recv);
> -
>   	if (fwts_recv_rc != 0) {
>   		(void)close(fd);
>   		return FWTS_ERROR;
> 

Acked-by: Alex Hung <alex.hung@canonical.com>
ivanhu Aug. 16, 2018, 9:04 a.m. UTC | #2
On 08/14/2018 07:24 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Variable fwts_ipmi_msg_id does not need to be in global scope so
> make it static.  Make some fwts coding style changes and remove
> some empty lines.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_ipmi.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/src/lib/src/fwts_ipmi.c b/src/lib/src/fwts_ipmi.c
> index a4c8a511..36acf6ee 100644
> --- a/src/lib/src/fwts_ipmi.c
> +++ b/src/lib/src/fwts_ipmi.c
> @@ -27,10 +27,11 @@
>  
>  #include "fwts.h"
>  
> -unsigned int fwts_ipmi_msg_id = 1;
> +static unsigned int fwts_ipmi_msg_id = 1;
>  static const char *fwts_ipmi_devnode = "/dev/ipmi0";
>  
> -bool fwts_ipmi_present(int fwts_ipmi_flags) {
> +bool fwts_ipmi_present(int fwts_ipmi_flags)
> +{
>  	return !access(fwts_ipmi_devnode, fwts_ipmi_flags);
>  }
>  
> @@ -49,7 +50,6 @@ int fwts_ipmi_exec_query(
>  		return FWTS_ERROR;
>  
>  	fwts_send_rc = ioctl(fd, IPMICTL_SEND_COMMAND, (char *)fwts_ipmi_req);
> -
>  	if (fwts_send_rc != 0) {
>  		(void)close(fd);
>  		return FWTS_ERROR;
> @@ -69,7 +69,6 @@ int fwts_ipmi_exec_query(
>  	fwts_ipmi_recv.addr = (unsigned char *)&fwts_ipmi_addr;
>  	fwts_ipmi_recv.addr_len = sizeof (fwts_ipmi_addr);
>  	fwts_recv_rc = ioctl(fd, IPMICTL_RECEIVE_MSG_TRUNC, &fwts_ipmi_recv);
> -
>  	if (fwts_recv_rc != 0) {
>  		(void)close(fd);
>  		return FWTS_ERROR;

Acked-by: Ivan Hu <ivan.hu@canonical.com>

Patch
diff mbox series

diff --git a/src/lib/src/fwts_ipmi.c b/src/lib/src/fwts_ipmi.c
index a4c8a511..36acf6ee 100644
--- a/src/lib/src/fwts_ipmi.c
+++ b/src/lib/src/fwts_ipmi.c
@@ -27,10 +27,11 @@ 
 
 #include "fwts.h"
 
-unsigned int fwts_ipmi_msg_id = 1;
+static unsigned int fwts_ipmi_msg_id = 1;
 static const char *fwts_ipmi_devnode = "/dev/ipmi0";
 
-bool fwts_ipmi_present(int fwts_ipmi_flags) {
+bool fwts_ipmi_present(int fwts_ipmi_flags)
+{
 	return !access(fwts_ipmi_devnode, fwts_ipmi_flags);
 }
 
@@ -49,7 +50,6 @@  int fwts_ipmi_exec_query(
 		return FWTS_ERROR;
 
 	fwts_send_rc = ioctl(fd, IPMICTL_SEND_COMMAND, (char *)fwts_ipmi_req);
-
 	if (fwts_send_rc != 0) {
 		(void)close(fd);
 		return FWTS_ERROR;
@@ -69,7 +69,6 @@  int fwts_ipmi_exec_query(
 	fwts_ipmi_recv.addr = (unsigned char *)&fwts_ipmi_addr;
 	fwts_ipmi_recv.addr_len = sizeof (fwts_ipmi_addr);
 	fwts_recv_rc = ioctl(fd, IPMICTL_RECEIVE_MSG_TRUNC, &fwts_ipmi_recv);
-
 	if (fwts_recv_rc != 0) {
 		(void)close(fd);
 		return FWTS_ERROR;