Seeking a bit of advice from the community
Hello, my name is Mario Rugiero, and I'm in the process of resurrecting the attempts to get the via driver in shape, and had a few questions on the proper etiquette for such a thing. As some may know, there are talks about removing dri1 support on X.org, so we (the users interested) should update the kernel and userspace drivers if we want to still be able to use them with newer distributions, so I volunteered to try and get it done for the kernel driver. Looking at the driver code I found there are some style issues, along with some potential code smell. I've found a lot of checkpatch and sparse warnings. My original plan was to get it clean in those aspects first, issue by issue, then start replacing deprectated interfaces and lastly get it to work with dri2/3 and KMS, this based on James Simmons work and the advices he got when he sent an RFC patchset. First and foremost, I wanted to know if this roadmap makes sense for some more experienced kernel developers, and if style patches are accepted in the drm list (I know for staging they are, but could be different there), as they would be the first ones. Also, I was wondering what's the right approach when there is a preexistent style issue in a line your patch touches. Should I fix the issue in the same patch, send a patch fixing the issue first or just send the patch as is and ignore the issue. For example, in a local copy of drm-testing I have, I replaced all __inline__ by inline, as suggested by checkpatch. One of the lines had a misplaced * operator, and thus checkpatch complains about it. My plan for that patch was to send it as is, and fix all misplaced operators in a later patch. What do you think about this? Is this right? Wrong? Awfully wrong? Sorry for the long mail, but I tried googling and found nothing answering these questions, and I preferred to bother with the questions first instead of wasting reviewers time with fundamentally wrong patches. Thanks for any advice, Mario Rugiero. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/1] staging: Fix bitshifts by wrong offsets in wilc1000/host_interface.c
El 18/12/15 a las 19:50, Greg KH escribió: On Tue, Dec 01, 2015 at 11:49:55PM -0300, Mario J. Rugiero wrote: struct set_multicast uses (implicitly) sizeof(bool) to determine how many bytes to copy in Handle_SetMulticastFilter. Since that is implementation defined, it triggered sparse to rightfully complain about shifting a bigger value than supported. Since it was used as if assuming it was 32 bits, I replaced the bool member by a u32. Also, time_out and buf_size members of ba_session_info are u16, but while copying their bytes into ptr in Handle_AddBASession shift 16 bits for the second byte instead of 8 bits. This patch fixes those two issues. Signed-off-by: Mario J. Rugiero --- drivers/staging/wilc1000/host_interface.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) How did you test this is correct? Doesn't apply to my tree :( thanks, greg k-h Because I lack the hardware, I only tested it built with allmodconfig and tried to be very careful about my reasoning. I know I *should* be testing it, and am sorry about it. Should I try and update the patch? Maybe it conflicts with a different one. I made the changes on top of staging-testing. In retrospect, I believe the issues should be handled in different patches anyway, so I would like to do a second version anyway. Regards, Mario. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3] staging: wilc1000: replace 'ptr > 0' check by 'ptr' check.
This silences a sparse warning about incompatible comparisons, while making the intent of the check a bit clearer. Signed-off-by: Mario J. Rugiero --- drivers/staging/wilc1000/host_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index d5b7725..0c87f6c 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2270,7 +2270,7 @@ static void Handle_AddBeacon(struct host_if_drv *hif_drv, *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 16) & 0xFF); *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 24) & 0xFF); - if (pstrSetBeaconParam->tail > 0) + if (pstrSetBeaconParam->tail) memcpy(pu8CurrByte, pstrSetBeaconParam->tail, pstrSetBeaconParam->tail_len); pu8CurrByte += pstrSetBeaconParam->tail_len; -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/1] staging: cleanup: Fix incompatible type comparison in wilc1000/host_interface.c
Would be v3, or remains v2 because of the lack of further changes afterwards? Regards, Mario. El 03/12/15 a las 12:17, Dan Carpenter escribió: On Thu, Dec 03, 2015 at 12:13:59PM -0300, Mario J. Rugiero wrote: Thank you. Then the patch itself should see no changes as of now, am I right? Should I submit a new one anyway to fix the subject line? Yes, please. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/1] staging: cleanup: Fix incompatible type comparison in wilc1000/host_interface.c
Thank you. Then the patch itself should see no changes as of now, am I right? Should I submit a new one anyway to fix the subject line? Regards, Mario. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/1] staging: cleanup: Fix incompatible type comparison in wilc1000/host_interface.c
OK. Since the maintainers are CC'd, I guess I should wait for a clarification about this? El 02/12/15 a las 10:29, Dan Carpenter escribió: Put v2 in the subject. Also the subsystem prefix is: [PATCH v3] staging: wilc1000: ... On Mon, Nov 30, 2015 at 09:09:04PM -0300, Mario J. Rugiero wrote: This patch replaces an "if (ptr > 0)" comparison that seems to be a confusing way to check for null by a simpler "if (ptr)" check. Signed-off-by: Mario J. Rugiero --- v2: Remove the != NULL because checkpatch complains. drivers/staging/wilc1000/host_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index d5b7725..0c87f6c 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2270,7 +2270,7 @@ static void Handle_AddBeacon(struct host_if_drv *hif_drv, *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 16) & 0xFF); *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 24) & 0xFF); - if (pstrSetBeaconParam->tail > 0) + if (pstrSetBeaconParam->tail) Probably the intention was to check if "pstrSetBeaconParam->tail_len > 0" but I'm not sure. The wilc1000 maintainers are very responsive though so maybe they will know for sure. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/1] staging: Fix bitshifts by wrong offsets in wilc1000/host_interface.c
struct set_multicast uses (implicitly) sizeof(bool) to determine how many bytes to copy in Handle_SetMulticastFilter. Since that is implementation defined, it triggered sparse to rightfully complain about shifting a bigger value than supported. Since it was used as if assuming it was 32 bits, I replaced the bool member by a u32. Also, time_out and buf_size members of ba_session_info are u16, but while copying their bytes into ptr in Handle_AddBASession shift 16 bits for the second byte instead of 8 bits. This patch fixes those two issues. Signed-off-by: Mario J. Rugiero --- drivers/staging/wilc1000/host_interface.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 0c87f6c..fcfd70a 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -142,7 +142,7 @@ struct beacon_attr { }; struct set_multicast { - bool enabled; + u32 enabled; u32 cnt; }; @@ -2752,9 +2752,9 @@ static s32 Handle_AddBASession(struct host_if_drv *hif_drv, *ptr++ = strHostIfBASessionInfo->tid; *ptr++ = 1; *ptr++ = (strHostIfBASessionInfo->buf_size & 0xFF); - *ptr++ = ((strHostIfBASessionInfo->buf_size >> 16) & 0xFF); + *ptr++ = ((strHostIfBASessionInfo->buf_size >> 8) & 0xFF); *ptr++ = (strHostIfBASessionInfo->time_out & 0xFF); - *ptr++ = ((strHostIfBASessionInfo->time_out >> 16) & 0xFF); + *ptr++ = ((strHostIfBASessionInfo->time_out >> 8) & 0xFF); *ptr++ = (AddbaTimeout & 0xFF); *ptr++ = ((AddbaTimeout >> 16) & 0xFF); *ptr++ = 8; @@ -2777,7 +2777,7 @@ static s32 Handle_AddBASession(struct host_if_drv *hif_drv, *ptr++ = strHostIfBASessionInfo->tid; *ptr++ = 8; *ptr++ = (strHostIfBASessionInfo->buf_size & 0xFF); - *ptr++ = ((strHostIfBASessionInfo->time_out >> 16) & 0xFF); + *ptr++ = ((strHostIfBASessionInfo->time_out >> 8) & 0xFF); *ptr++ = 3; result = send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); -- 2.6.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/1] staging: cleanup: Fix incompatible type comparison in wilc1000/host_interface.c
This patch replaces an "if (ptr > 0)" comparison that seems to be a confusing way to check for null by a simpler "if (ptr)" check. Signed-off-by: Mario J. Rugiero --- drivers/staging/wilc1000/host_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index d5b7725..0c87f6c 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2270,7 +2270,7 @@ static void Handle_AddBeacon(struct host_if_drv *hif_drv, *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 16) & 0xFF); *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 24) & 0xFF); - if (pstrSetBeaconParam->tail > 0) + if (pstrSetBeaconParam->tail) memcpy(pu8CurrByte, pstrSetBeaconParam->tail, pstrSetBeaconParam->tail_len); pu8CurrByte += pstrSetBeaconParam->tail_len; -- 2.6.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] [sparse-cleanup] Fix incompatible type comparison in wilc1000/host_interface.c
Signed-off-by: Mario J. Rugiero --- drivers/staging/wilc1000/host_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index d5b7725..9ce1d22 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2270,7 +2270,7 @@ static void Handle_AddBeacon(struct host_if_drv *hif_drv, *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 16) & 0xFF); *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 24) & 0xFF); - if (pstrSetBeaconParam->tail > 0) + if (pstrSetBeaconParam->tail != NULL) memcpy(pu8CurrByte, pstrSetBeaconParam->tail, pstrSetBeaconParam->tail_len); pu8CurrByte += pstrSetBeaconParam->tail_len; -- 2.6.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 3/4] staging/lustre: use __aligned(size) instead of __attribute__(aligned(size))
OK, I'll do that, thanks. Mario. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 3/4] staging/lustre: use __aligned(size) instead of __attribute__(aligned(size))
I didn't expect that. Maybe I used the wrong linux-next? Just to make sure, what should I be making the patches against? I made them against the latest next branch I was able to find on Linus tree, is that right? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/4] staging/lustre: use __packed instead of __attribute__(packed)
Replace __attribute__(packed) by __packed as suggested by checkpatch. Signed-off-by: Mario J. Rugiero --- .../include/linux/libcfs/libcfs_kernelcomm.h | 2 +- .../staging/lustre/include/linux/lnet/lib-types.h | 2 +- .../lustre/lustre/include/lustre/lustre_idl.h | 44 +++--- .../lustre/lustre/include/lustre/lustre_user.h | 14 +++ 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h index 4688770..a989d26 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h @@ -107,7 +107,7 @@ typedef struct lustre_kernelcomm { __u32 lk_group; __u32 lk_data; __u32 lk_flags; -} __attribute__((packed)) lustre_kernelcomm; +} __packed lustre_kernelcomm; /* Userspace methods */ int libcfs_ukuc_start(lustre_kernelcomm *l, int groups); diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index 50537668..feffca2 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -48,7 +48,7 @@ #include #include "types.h" -#define WIRE_ATTR __attribute__((packed)) +#define WIRE_ATTR __packed /* Packed version of lnet_process_id_t to transfer via network */ typedef struct { diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index 5382bf4..0553043 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -2954,7 +2954,7 @@ typedef enum { struct llog_logid { struct ost_id lgl_oi; __u32 lgl_ogen; -} __attribute__((packed)); +} __packed; /** Records written to the CATALOGS list */ #define CATLIST "CATALOGS" @@ -2963,7 +2963,7 @@ struct llog_catid { __u32 lci_padding1; __u32 lci_padding2; __u32 lci_padding3; -} __attribute__((packed)); +} __packed; /* Log data record types - there is no specific reason that these need to * be related to the RPC opcodes, but no reason not to (may be handy later?) @@ -3027,7 +3027,7 @@ struct llog_logid_rec { __u64 lid_padding2; __u64 lid_padding3; struct llog_rec_taillid_tail; -} __attribute__((packed)); +} __packed; struct llog_unlink_rec { struct llog_rec_hdr lur_hdr; @@ -3035,7 +3035,7 @@ struct llog_unlink_rec { __u32 lur_oseq; __u32 lur_count; struct llog_rec_taillur_tail; -} __attribute__((packed)); +} __packed; struct llog_unlink64_rec { struct llog_rec_hdr lur_hdr; @@ -3045,7 +3045,7 @@ struct llog_unlink64_rec { __u64 lur_padding2; __u64 lur_padding3; struct llog_rec_taillur_tail; -} __attribute__((packed)); +} __packed; struct llog_setattr64_rec { struct llog_rec_hdr lsr_hdr; @@ -3056,7 +3056,7 @@ struct llog_setattr64_rec { __u32 lsr_gid_h; __u64 lsr_padding; struct llog_rec_taillsr_tail; -} __attribute__((packed)); +} __packed; struct llog_size_change_rec { struct llog_rec_hdr lsc_hdr; @@ -3066,7 +3066,7 @@ struct llog_size_change_rec { __u64 lsc_padding2; __u64 lsc_padding3; struct llog_rec_taillsc_tail; -} __attribute__((packed)); +} __packed; #define CHANGELOG_MAGIC 0xca103000 @@ -3083,20 +3083,20 @@ struct llog_size_change_rec { struct changelog_setinfo { __u64 cs_recno; __u32 cs_id; -} __attribute__((packed)); +} __packed; /** changelog record */ struct llog_changelog_rec { struct llog_rec_hdr cr_hdr; struct changelog_rec cr; struct llog_rec_tail cr_tail; /**< for_sizezof_only */ -} __attribute__((packed)); +} __packed; struct llog_changelog_ext_rec { struct llog_rec_hdr cr_hdr; struct changelog_ext_rec cr; struct llog_rec_tail cr_tail; /**< for_sizezof_only */ -} __attribute__((packed)); +} __packed; #define CHANGELOG_USER_PREFIX "cl" @@ -3106,7 +3106,7 @@ struct llog_changelog_user_rec { __u32cur_padding; __u64cur_endrec; struct llog_rec_tail cur_tail; -} __attribute__((packed)); +} __packed; enum agent_req_status { ARS_WAITING, @@ -3152,13 +3152,13 @@ struct llog_agent_req_rec { __u64 arr_req_change; /**< req. status change time */ struct hsm_action_item arr_hai;/
[PATCH 0/4] staging/lustre: checkpatch cleanup
This patchset attempts to fix the following issues catched by checkpatch: trailing semicolons in macros use of __attribute__(format(printf,...)) where __printf(...) would suffice use of __attribute__(aligned(size)) where __aligned(size) would suffice use of __attribute__(packed) where __packed would suffice Mario J. Rugiero (4): staging/lustre: checkpatch cleanup: macros should not use a trailing semicolon staging/lustre: checkpatch cleanup: __printf(string-index, first-to-check) is preferred over __attribute__((format(printf, string-index, first-to-check))) staging/lustre: checkpatch cleanup: __aligned(size) is preferred over __attribute__((aligned(size))) staging/lustre: checkpatch cleanup: __packed is preferred over __attribute__((packed)) .../lustre/include/linux/libcfs/libcfs_debug.h | 6 +-- .../include/linux/libcfs/libcfs_kernelcomm.h | 4 +- .../lustre/include/linux/libcfs/libcfs_private.h | 4 +- .../staging/lustre/include/linux/lnet/lib-types.h | 2 +- .../staging/lustre/lustre/include/lprocfs_status.h | 6 +-- drivers/staging/lustre/lustre/include/lu_object.h | 2 +- .../lustre/lustre/include/lustre/lustre_idl.h | 44 +++--- .../lustre/lustre/include/lustre/lustre_user.h | 14 +++ drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 +- drivers/staging/lustre/lustre/include/lustre_net.h | 2 +- 10 files changed, 43 insertions(+), 43 deletions(-) -- 2.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/4] staging/lustre: use __printf(...) instead of __attribute__(format(__printf, ...))
Replace uses of __attribute__(format(__printf,...)) by __printf(...), as suggested by checkpatch. Signed-off-by: Mario J. Rugiero --- drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h | 4 ++-- drivers/staging/lustre/lustre/include/lu_object.h | 2 +- drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 +- drivers/staging/lustre/lustre/include/lustre_net.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h index 840dd1b..8251ac9 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h @@ -244,12 +244,12 @@ do { \ int libcfs_debug_msg(struct libcfs_debug_msg_data *msgdata, const char *format1, ...) - __attribute__ ((format (printf, 2, 3))); + __printf(2, 3); int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata, const char *format1, va_list args, const char *format2, ...) - __attribute__ ((format (printf, 4, 5))); + __printf(4, 5); /* other external symbols that tracefile provides: */ int cfs_trace_copyin_string(char *knl_buffer, int knl_buffer_nob, diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h index fc3f234..7f8871e 100644 --- a/drivers/staging/lustre/lustre/include/lu_object.h +++ b/drivers/staging/lustre/lustre/include/lu_object.h @@ -192,7 +192,7 @@ struct lu_object_conf { */ typedef int (*lu_printer_t)(const struct lu_env *env, void *cookie, const char *format, ...) - __attribute__ ((format (printf, 3, 4))); + __printf(3, 4); /** * Operations specific for particular lu_object. diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index 6be6079..b682a60 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -1075,7 +1075,7 @@ extern char *ldlm_it2str(int it); void _ldlm_lock_debug(struct ldlm_lock *lock, struct libcfs_debug_msg_data *data, const char *fmt, ...) - __attribute__ ((format (printf, 3, 4))); + __printf(3, 4); /** * Rate-limited version of lock printing function. diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index 36396d1..e2805bd 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -1673,7 +1673,7 @@ ptlrpc_rqphase2str(struct ptlrpc_request *req) void _debug_req(struct ptlrpc_request *req, struct libcfs_debug_msg_data *data, const char *fmt, ...) - __attribute__ ((format (printf, 3, 4))); + __printf(3, 4); /** * Helper that decides if we need to print request according to current debug -- 2.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/4] staging/lustre: clean trailing semicolons in macros
Remove trailing semicolons from macros, as suggested by checkpatch. Signed-off-by: Mario J. Rugiero --- drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h | 2 +- drivers/staging/lustre/include/linux/libcfs/libcfs_private.h | 4 ++-- drivers/staging/lustre/lustre/include/lprocfs_status.h | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h index 2e5a9e5..840dd1b 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h @@ -196,7 +196,7 @@ do { \ .msg_fn = __func__, \ .msg_line = __LINE__, \ .msg_cdls = (cdls) }; \ - dataname.msg_mask = (mask); + dataname.msg_mask = (mask) /** * Filters out logging messages based on mask and subsystem. diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h index ac9238a..515a54e 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h @@ -317,8 +317,8 @@ do { \ #define LASSERT_ATOMIC_ZERO(a) LASSERT_ATOMIC_EQ(a, 0) #define LASSERT_ATOMIC_POS(a) LASSERT_ATOMIC_GT(a, 0) -#define CFS_ALLOC_PTR(ptr) LIBCFS_ALLOC(ptr, sizeof(*(ptr))); -#define CFS_FREE_PTR(ptr) LIBCFS_FREE(ptr, sizeof(*(ptr))); +#define CFS_ALLOC_PTR(ptr) LIBCFS_ALLOC(ptr, sizeof(*(ptr))) +#define CFS_FREE_PTR(ptr) LIBCFS_FREE(ptr, sizeof(*(ptr))) /* * percpu partition lock diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h index 8a25cf6..d030847 100644 --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h @@ -679,7 +679,7 @@ extern int lprocfs_seq_release(struct inode *, struct file *); } \ } while (0) #define LPROCFS_CLIMP_EXIT(obd) \ - up_read(&(obd)->u.cli.cl_sem); + up_read(&(obd)->u.cli.cl_sem) /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only @@ -723,7 +723,7 @@ static struct file_operations name##_fops = { \ return lprocfs_wr_##type(file, buffer, \ count, seq->private); \ } \ - LPROC_SEQ_FOPS(name##_##type); + LPROC_SEQ_FOPS(name##_##type) #define LPROC_SEQ_FOPS_WR_ONLY(name, type) \ static ssize_t name##_##type##_write(struct file *file, \ @@ -740,7 +740,7 @@ static struct file_operations name##_fops = { \ .open = name##_##type##_open, \ .write = name##_##type##_write,\ .release = lprocfs_single_release, \ - }; + } /* lproc_ptlrpc.c */ struct ptlrpc_request; -- 2.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/4] staging/lustre: use __aligned(size) instead of __attribute__(aligned(size))
Replace uses of __attribute__(aligned(size)) by __aligned(size), as suggested by checkpatch. Signed-off-by: Mario J. Rugiero --- drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h index f19a121..4688770 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h @@ -58,7 +58,7 @@ struct kuc_hdr { __u8 kuc_flags; __u16 kuc_msgtype;/* Message type or opcode, transport-specific */ __u16 kuc_msglen; /* Including header */ -} __attribute__((aligned(sizeof(__u64; +} __aligned(sizeof(__u64)); #define KUC_CHANGELOG_MSG_MAXSIZE (sizeof(struct kuc_hdr)+CR_MAXSIZE) -- 2.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/4] staging/lustre: use __aligned(size) instead of the
Replace uses of __attribute__(aligned(size)) by __aligned(size), as recommended by checkpatch. Signed-off-by: Mario J. Rugiero --- drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h index f19a121..4688770 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h @@ -58,7 +58,7 @@ struct kuc_hdr { __u8 kuc_flags; __u16 kuc_msgtype;/* Message type or opcode, transport-specific */ __u16 kuc_msglen; /* Including header */ -} __attribute__((aligned(sizeof(__u64; +} __aligned(sizeof(__u64)); #define KUC_CHANGELOG_MSG_MAXSIZE (sizeof(struct kuc_hdr)+CR_MAXSIZE) -- 2.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/4] staging/lustre: use __printf(...) instead of its
Substitute uses of __attribute__(format(printf(...)) by __printf(...), as recommended by checkpatch. Signed-off-by: Mario J. Rugiero --- drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h | 4 ++-- drivers/staging/lustre/lustre/include/lu_object.h | 2 +- drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 +- drivers/staging/lustre/lustre/include/lustre_net.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h index 840dd1b..8251ac9 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h @@ -244,12 +244,12 @@ do { \ int libcfs_debug_msg(struct libcfs_debug_msg_data *msgdata, const char *format1, ...) - __attribute__ ((format (printf, 2, 3))); + __printf(2, 3); int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata, const char *format1, va_list args, const char *format2, ...) - __attribute__ ((format (printf, 4, 5))); + __printf(4, 5); /* other external symbols that tracefile provides: */ int cfs_trace_copyin_string(char *knl_buffer, int knl_buffer_nob, diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h index fc3f234..7f8871e 100644 --- a/drivers/staging/lustre/lustre/include/lu_object.h +++ b/drivers/staging/lustre/lustre/include/lu_object.h @@ -192,7 +192,7 @@ struct lu_object_conf { */ typedef int (*lu_printer_t)(const struct lu_env *env, void *cookie, const char *format, ...) - __attribute__ ((format (printf, 3, 4))); + __printf(3, 4); /** * Operations specific for particular lu_object. diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index 6be6079..b682a60 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -1075,7 +1075,7 @@ extern char *ldlm_it2str(int it); void _ldlm_lock_debug(struct ldlm_lock *lock, struct libcfs_debug_msg_data *data, const char *fmt, ...) - __attribute__ ((format (printf, 3, 4))); + __printf(3, 4); /** * Rate-limited version of lock printing function. diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index 36396d1..e2805bd 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -1673,7 +1673,7 @@ ptlrpc_rqphase2str(struct ptlrpc_request *req) void _debug_req(struct ptlrpc_request *req, struct libcfs_debug_msg_data *data, const char *fmt, ...) - __attribute__ ((format (printf, 3, 4))); + __printf(3, 4); /** * Helper that decides if we need to print request according to current debug -- 2.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/4] staging/lustre: clean trailing semicolon in macros
Cleanup trailing semicolons in macros, as recommended by cleanpatch. Signed-off-by: Mario J. Rugiero --- drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h | 2 +- drivers/staging/lustre/include/linux/libcfs/libcfs_private.h | 4 ++-- drivers/staging/lustre/lustre/include/lprocfs_status.h | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h index 2e5a9e5..840dd1b 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h @@ -196,7 +196,7 @@ do { \ .msg_fn = __func__, \ .msg_line = __LINE__, \ .msg_cdls = (cdls) }; \ - dataname.msg_mask = (mask); + dataname.msg_mask = (mask) /** * Filters out logging messages based on mask and subsystem. diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h index ac9238a..515a54e 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h @@ -317,8 +317,8 @@ do { \ #define LASSERT_ATOMIC_ZERO(a) LASSERT_ATOMIC_EQ(a, 0) #define LASSERT_ATOMIC_POS(a) LASSERT_ATOMIC_GT(a, 0) -#define CFS_ALLOC_PTR(ptr) LIBCFS_ALLOC(ptr, sizeof(*(ptr))); -#define CFS_FREE_PTR(ptr) LIBCFS_FREE(ptr, sizeof(*(ptr))); +#define CFS_ALLOC_PTR(ptr) LIBCFS_ALLOC(ptr, sizeof(*(ptr))) +#define CFS_FREE_PTR(ptr) LIBCFS_FREE(ptr, sizeof(*(ptr))) /* * percpu partition lock diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h index 8a25cf6..d030847 100644 --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h @@ -679,7 +679,7 @@ extern int lprocfs_seq_release(struct inode *, struct file *); } \ } while (0) #define LPROCFS_CLIMP_EXIT(obd) \ - up_read(&(obd)->u.cli.cl_sem); + up_read(&(obd)->u.cli.cl_sem) /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only @@ -723,7 +723,7 @@ static struct file_operations name##_fops = { \ return lprocfs_wr_##type(file, buffer, \ count, seq->private); \ } \ - LPROC_SEQ_FOPS(name##_##type); + LPROC_SEQ_FOPS(name##_##type) #define LPROC_SEQ_FOPS_WR_ONLY(name, type) \ static ssize_t name##_##type##_write(struct file *file, \ @@ -740,7 +740,7 @@ static struct file_operations name##_fops = { \ .open = name##_##type##_open, \ .write = name##_##type##_write,\ .release = lprocfs_single_release, \ - }; + } /* lproc_ptlrpc.c */ struct ptlrpc_request; -- 2.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/4] staging/lustre: use __packed instead of
Replace __attribute__(packed) by __packed, as recommended by checkpatch. Signed-off-by: Mario J. Rugiero --- .../include/linux/libcfs/libcfs_kernelcomm.h | 2 +- .../staging/lustre/include/linux/lnet/lib-types.h | 2 +- .../lustre/lustre/include/lustre/lustre_idl.h | 44 +++--- .../lustre/lustre/include/lustre/lustre_user.h | 14 +++ 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h index 4688770..a989d26 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h @@ -107,7 +107,7 @@ typedef struct lustre_kernelcomm { __u32 lk_group; __u32 lk_data; __u32 lk_flags; -} __attribute__((packed)) lustre_kernelcomm; +} __packed lustre_kernelcomm; /* Userspace methods */ int libcfs_ukuc_start(lustre_kernelcomm *l, int groups); diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index 50537668..feffca2 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -48,7 +48,7 @@ #include #include "types.h" -#define WIRE_ATTR __attribute__((packed)) +#define WIRE_ATTR __packed /* Packed version of lnet_process_id_t to transfer via network */ typedef struct { diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index 5382bf4..0553043 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -2954,7 +2954,7 @@ typedef enum { struct llog_logid { struct ost_id lgl_oi; __u32 lgl_ogen; -} __attribute__((packed)); +} __packed; /** Records written to the CATALOGS list */ #define CATLIST "CATALOGS" @@ -2963,7 +2963,7 @@ struct llog_catid { __u32 lci_padding1; __u32 lci_padding2; __u32 lci_padding3; -} __attribute__((packed)); +} __packed; /* Log data record types - there is no specific reason that these need to * be related to the RPC opcodes, but no reason not to (may be handy later?) @@ -3027,7 +3027,7 @@ struct llog_logid_rec { __u64 lid_padding2; __u64 lid_padding3; struct llog_rec_taillid_tail; -} __attribute__((packed)); +} __packed; struct llog_unlink_rec { struct llog_rec_hdr lur_hdr; @@ -3035,7 +3035,7 @@ struct llog_unlink_rec { __u32 lur_oseq; __u32 lur_count; struct llog_rec_taillur_tail; -} __attribute__((packed)); +} __packed; struct llog_unlink64_rec { struct llog_rec_hdr lur_hdr; @@ -3045,7 +3045,7 @@ struct llog_unlink64_rec { __u64 lur_padding2; __u64 lur_padding3; struct llog_rec_taillur_tail; -} __attribute__((packed)); +} __packed; struct llog_setattr64_rec { struct llog_rec_hdr lsr_hdr; @@ -3056,7 +3056,7 @@ struct llog_setattr64_rec { __u32 lsr_gid_h; __u64 lsr_padding; struct llog_rec_taillsr_tail; -} __attribute__((packed)); +} __packed; struct llog_size_change_rec { struct llog_rec_hdr lsc_hdr; @@ -3066,7 +3066,7 @@ struct llog_size_change_rec { __u64 lsc_padding2; __u64 lsc_padding3; struct llog_rec_taillsc_tail; -} __attribute__((packed)); +} __packed; #define CHANGELOG_MAGIC 0xca103000 @@ -3083,20 +3083,20 @@ struct llog_size_change_rec { struct changelog_setinfo { __u64 cs_recno; __u32 cs_id; -} __attribute__((packed)); +} __packed; /** changelog record */ struct llog_changelog_rec { struct llog_rec_hdr cr_hdr; struct changelog_rec cr; struct llog_rec_tail cr_tail; /**< for_sizezof_only */ -} __attribute__((packed)); +} __packed; struct llog_changelog_ext_rec { struct llog_rec_hdr cr_hdr; struct changelog_ext_rec cr; struct llog_rec_tail cr_tail; /**< for_sizezof_only */ -} __attribute__((packed)); +} __packed; #define CHANGELOG_USER_PREFIX "cl" @@ -3106,7 +3106,7 @@ struct llog_changelog_user_rec { __u32cur_padding; __u64cur_endrec; struct llog_rec_tail cur_tail; -} __attribute__((packed)); +} __packed; enum agent_req_status { ARS_WAITING, @@ -3152,13 +3152,13 @@ struct llog_agent_req_rec { __u64 arr_req_change; /**< req. status change time */ struct hsm_action_item
[PATCH 0/4] staging/lustre: checkpatch cleanup
This patches cleans the following checkpatch issues: trailing semicolons in macros __attribute__(format(printf,...)) instead of __printf(...) __attribute__(aligned(size)) instead of __aligned(size) __attribute__(packed) instead of __packed Mario J. Rugiero (4): staging/lustre: checkpatch cleanup: macros should not use a trailing semicolon staging/lustre: checkpatch cleanup: __printf(string-index, first-to-check) is preferred over __attribute__((format(printf, string-index, first-to-check))) staging/lustre: checkpatch cleanup: __aligned(size) is preferred over __attribute__((aligned(size))) staging/lustre: checkpatch cleanup: __packed is preferred over __attribute__((packed)) .../lustre/include/linux/libcfs/libcfs_debug.h | 6 +-- .../include/linux/libcfs/libcfs_kernelcomm.h | 4 +- .../lustre/include/linux/libcfs/libcfs_private.h | 4 +- .../staging/lustre/include/linux/lnet/lib-types.h | 2 +- .../staging/lustre/lustre/include/lprocfs_status.h | 6 +-- drivers/staging/lustre/lustre/include/lu_object.h | 2 +- .../lustre/lustre/include/lustre/lustre_idl.h | 44 +++--- .../lustre/lustre/include/lustre/lustre_user.h | 14 +++ drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 +- drivers/staging/lustre/lustre/include/lustre_net.h | 2 +- 10 files changed, 43 insertions(+), 43 deletions(-) -- 2.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/4] staging/lustre: checkpatch cleanup: macros should not use a trailing semicolon
OK, thanks, I'll fix it. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/4] staging/lustre: checkpatch cleanup: macros should not use a trailing semicolon
Do you mean a description, or the diffstats? I thought it was enough to describe it in the cover letter, I'll fix it and resend, thank you. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/4] staging/lustre: checkpatch cleanup: macros should not use a trailing semicolon
Signed-off-by: Mario J. Rugiero --- drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h | 2 +- drivers/staging/lustre/include/linux/libcfs/libcfs_private.h | 4 ++-- drivers/staging/lustre/lustre/include/lprocfs_status.h | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h index 2e5a9e5..840dd1b 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h @@ -196,7 +196,7 @@ do { \ .msg_fn = __func__, \ .msg_line = __LINE__, \ .msg_cdls = (cdls) }; \ - dataname.msg_mask = (mask); + dataname.msg_mask = (mask) /** * Filters out logging messages based on mask and subsystem. diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h index ac9238a..515a54e 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h @@ -317,8 +317,8 @@ do { \ #define LASSERT_ATOMIC_ZERO(a) LASSERT_ATOMIC_EQ(a, 0) #define LASSERT_ATOMIC_POS(a) LASSERT_ATOMIC_GT(a, 0) -#define CFS_ALLOC_PTR(ptr) LIBCFS_ALLOC(ptr, sizeof(*(ptr))); -#define CFS_FREE_PTR(ptr) LIBCFS_FREE(ptr, sizeof(*(ptr))); +#define CFS_ALLOC_PTR(ptr) LIBCFS_ALLOC(ptr, sizeof(*(ptr))) +#define CFS_FREE_PTR(ptr) LIBCFS_FREE(ptr, sizeof(*(ptr))) /* * percpu partition lock diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h index 8a25cf6..d030847 100644 --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h @@ -679,7 +679,7 @@ extern int lprocfs_seq_release(struct inode *, struct file *); } \ } while (0) #define LPROCFS_CLIMP_EXIT(obd) \ - up_read(&(obd)->u.cli.cl_sem); + up_read(&(obd)->u.cli.cl_sem) /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only @@ -723,7 +723,7 @@ static struct file_operations name##_fops = { \ return lprocfs_wr_##type(file, buffer, \ count, seq->private); \ } \ - LPROC_SEQ_FOPS(name##_##type); + LPROC_SEQ_FOPS(name##_##type) #define LPROC_SEQ_FOPS_WR_ONLY(name, type) \ static ssize_t name##_##type##_write(struct file *file, \ @@ -740,7 +740,7 @@ static struct file_operations name##_fops = { \ .open = name##_##type##_open, \ .write = name##_##type##_write,\ .release = lprocfs_single_release, \ - }; + } /* lproc_ptlrpc.c */ struct ptlrpc_request; -- 2.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/4] staging/lustre: checkpatch cleanup: __aligned(size) is preferred over __attribute__((aligned(size)))
Signed-off-by: Mario J. Rugiero --- drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h index f19a121..4688770 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h @@ -58,7 +58,7 @@ struct kuc_hdr { __u8 kuc_flags; __u16 kuc_msgtype;/* Message type or opcode, transport-specific */ __u16 kuc_msglen; /* Including header */ -} __attribute__((aligned(sizeof(__u64; +} __aligned(sizeof(__u64)); #define KUC_CHANGELOG_MSG_MAXSIZE (sizeof(struct kuc_hdr)+CR_MAXSIZE) -- 2.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/4] staging/lustre: checkpatch cleanup: __packed is preferred over __attribute__((packed))
Signed-off-by: Mario J. Rugiero --- .../include/linux/libcfs/libcfs_kernelcomm.h | 2 +- .../staging/lustre/include/linux/lnet/lib-types.h | 2 +- .../lustre/lustre/include/lustre/lustre_idl.h | 44 +++--- .../lustre/lustre/include/lustre/lustre_user.h | 14 +++ 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h index 4688770..a989d26 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h @@ -107,7 +107,7 @@ typedef struct lustre_kernelcomm { __u32 lk_group; __u32 lk_data; __u32 lk_flags; -} __attribute__((packed)) lustre_kernelcomm; +} __packed lustre_kernelcomm; /* Userspace methods */ int libcfs_ukuc_start(lustre_kernelcomm *l, int groups); diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index 50537668..feffca2 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -48,7 +48,7 @@ #include #include "types.h" -#define WIRE_ATTR __attribute__((packed)) +#define WIRE_ATTR __packed /* Packed version of lnet_process_id_t to transfer via network */ typedef struct { diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index 5382bf4..0553043 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -2954,7 +2954,7 @@ typedef enum { struct llog_logid { struct ost_id lgl_oi; __u32 lgl_ogen; -} __attribute__((packed)); +} __packed; /** Records written to the CATALOGS list */ #define CATLIST "CATALOGS" @@ -2963,7 +2963,7 @@ struct llog_catid { __u32 lci_padding1; __u32 lci_padding2; __u32 lci_padding3; -} __attribute__((packed)); +} __packed; /* Log data record types - there is no specific reason that these need to * be related to the RPC opcodes, but no reason not to (may be handy later?) @@ -3027,7 +3027,7 @@ struct llog_logid_rec { __u64 lid_padding2; __u64 lid_padding3; struct llog_rec_taillid_tail; -} __attribute__((packed)); +} __packed; struct llog_unlink_rec { struct llog_rec_hdr lur_hdr; @@ -3035,7 +3035,7 @@ struct llog_unlink_rec { __u32 lur_oseq; __u32 lur_count; struct llog_rec_taillur_tail; -} __attribute__((packed)); +} __packed; struct llog_unlink64_rec { struct llog_rec_hdr lur_hdr; @@ -3045,7 +3045,7 @@ struct llog_unlink64_rec { __u64 lur_padding2; __u64 lur_padding3; struct llog_rec_taillur_tail; -} __attribute__((packed)); +} __packed; struct llog_setattr64_rec { struct llog_rec_hdr lsr_hdr; @@ -3056,7 +3056,7 @@ struct llog_setattr64_rec { __u32 lsr_gid_h; __u64 lsr_padding; struct llog_rec_taillsr_tail; -} __attribute__((packed)); +} __packed; struct llog_size_change_rec { struct llog_rec_hdr lsc_hdr; @@ -3066,7 +3066,7 @@ struct llog_size_change_rec { __u64 lsc_padding2; __u64 lsc_padding3; struct llog_rec_taillsc_tail; -} __attribute__((packed)); +} __packed; #define CHANGELOG_MAGIC 0xca103000 @@ -3083,20 +3083,20 @@ struct llog_size_change_rec { struct changelog_setinfo { __u64 cs_recno; __u32 cs_id; -} __attribute__((packed)); +} __packed; /** changelog record */ struct llog_changelog_rec { struct llog_rec_hdr cr_hdr; struct changelog_rec cr; struct llog_rec_tail cr_tail; /**< for_sizezof_only */ -} __attribute__((packed)); +} __packed; struct llog_changelog_ext_rec { struct llog_rec_hdr cr_hdr; struct changelog_ext_rec cr; struct llog_rec_tail cr_tail; /**< for_sizezof_only */ -} __attribute__((packed)); +} __packed; #define CHANGELOG_USER_PREFIX "cl" @@ -3106,7 +3106,7 @@ struct llog_changelog_user_rec { __u32cur_padding; __u64cur_endrec; struct llog_rec_tail cur_tail; -} __attribute__((packed)); +} __packed; enum agent_req_status { ARS_WAITING, @@ -3152,13 +3152,13 @@ struct llog_agent_req_rec { __u64 arr_req_change; /**< req. status change time */ struct hsm_action_item arr_hai;/**< req. to the agent */ struct llog_rec_taila
[PATCH 2/4] staging/lustre: checkpatch cleanup: __printf(string-index, first-to-check) is preferred over __attribute__((format(printf, string-index, first-to-check)))
Signed-off-by: Mario J. Rugiero --- drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h | 4 ++-- drivers/staging/lustre/lustre/include/lu_object.h | 2 +- drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 +- drivers/staging/lustre/lustre/include/lustre_net.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h index 840dd1b..8251ac9 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h @@ -244,12 +244,12 @@ do { \ int libcfs_debug_msg(struct libcfs_debug_msg_data *msgdata, const char *format1, ...) - __attribute__ ((format (printf, 2, 3))); + __printf(2, 3); int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata, const char *format1, va_list args, const char *format2, ...) - __attribute__ ((format (printf, 4, 5))); + __printf(4, 5); /* other external symbols that tracefile provides: */ int cfs_trace_copyin_string(char *knl_buffer, int knl_buffer_nob, diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h index fc3f234..7f8871e 100644 --- a/drivers/staging/lustre/lustre/include/lu_object.h +++ b/drivers/staging/lustre/lustre/include/lu_object.h @@ -192,7 +192,7 @@ struct lu_object_conf { */ typedef int (*lu_printer_t)(const struct lu_env *env, void *cookie, const char *format, ...) - __attribute__ ((format (printf, 3, 4))); + __printf(3, 4); /** * Operations specific for particular lu_object. diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index 6be6079..b682a60 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -1075,7 +1075,7 @@ extern char *ldlm_it2str(int it); void _ldlm_lock_debug(struct ldlm_lock *lock, struct libcfs_debug_msg_data *data, const char *fmt, ...) - __attribute__ ((format (printf, 3, 4))); + __printf(3, 4); /** * Rate-limited version of lock printing function. diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index 36396d1..e2805bd 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -1673,7 +1673,7 @@ ptlrpc_rqphase2str(struct ptlrpc_request *req) void _debug_req(struct ptlrpc_request *req, struct libcfs_debug_msg_data *data, const char *fmt, ...) - __attribute__ ((format (printf, 3, 4))); + __printf(3, 4); /** * Helper that decides if we need to print request according to current debug -- 2.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/4] staging/lustre: checkpatch cleanup
As Dan Carpenter (thank you!) noticed, my original patchset had an extra from field and lacked the signed-off-by. I'm not sure the first was fixed, but I would be really confused if it isn't. I checked that the signed-off-by was generated this time. As a reminder, this patchset aims to fix the following checkpatch warnings: occurences of trailing semicolons in macros uses of __attribute__(format(printf, ...)) where __printf(...) can be used uses of __attribute__(aligned(size)) where __aligned(size) can be used uses of __attribute__(packed) where __packed can be used Regards, Mario. Mario J. Rugiero (4): staging/lustre: checkpatch cleanup: macros should not use a trailing semicolon staging/lustre: checkpatch cleanup: __printf(string-index, first-to-check) is preferred over __attribute__((format(printf, string-index, first-to-check))) staging/lustre: checkpatch cleanup: __aligned(size) is preferred over __attribute__((aligned(size))) staging/lustre: checkpatch cleanup: __packed is preferred over __attribute__((packed)) .../lustre/include/linux/libcfs/libcfs_debug.h | 6 +-- .../include/linux/libcfs/libcfs_kernelcomm.h | 4 +- .../lustre/include/linux/libcfs/libcfs_private.h | 4 +- .../staging/lustre/include/linux/lnet/lib-types.h | 2 +- .../staging/lustre/lustre/include/lprocfs_status.h | 6 +-- drivers/staging/lustre/lustre/include/lu_object.h | 2 +- .../lustre/lustre/include/lustre/lustre_idl.h | 44 +++--- .../lustre/lustre/include/lustre/lustre_user.h | 14 +++ drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 +- drivers/staging/lustre/lustre/include/lustre_net.h | 2 +- 10 files changed, 43 insertions(+), 43 deletions(-) -- 2.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/4] staging/lustre: checkpatch cleanup: macros should not use a trailing semicolon
That's weird, I passed the parameter signed-off-by to git-send-email. The from header must have been my mistake, I thought that parameter was mandatory. Thanks for the hint. Regards, Mario. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/1] Lustre: single statement macros should not use do {} while (0)
This fixes all appearances of the warning but one, as that one seems to be intentional: WARNING: Single statement macros should not use a do {} while (0) loop #1221: FILE: lustre/include/lustre_dlm.h:1221: +#define LDLM_LOCK_RELEASE(lock) \ +do { \ + /*LDLM_DEBUG((lock), "put");*/ \ + ldlm_lock_put(lock);\ +} while (0) I didn't know if I should touch this debug statement, and if uncommented it would certainly be incorrect to erase the do-while construct. Regards, Mario. >From 01a11dfacba84065a69deed929acaa84d249b7b5 Mon Sep 17 00:00:00 2001 From: "Mario J. Rugiero" Date: Wed, 18 Feb 2015 17:23:39 -0300 Subject: [PATCH] Lustre: single statement macros should not use a do {} while (0) loop. Signed-off-by: Mario J. Rugiero --- .../lustre/include/linux/libcfs/libcfs_private.h | 36 ++ .../lustre/include/linux/libcfs/linux/linux-mem.h | 4 +-- drivers/staging/lustre/lustre/include/lu_object.h | 4 +-- .../lustre/lustre/include/lustre/lustre_idl.h | 4 +-- .../staging/lustre/lustre/include/lustre_capa.h| 4 +-- drivers/staging/lustre/lustre/include/lustre_dlm.h | 10 +++--- .../staging/lustre/lustre/include/lustre_export.h | 4 +-- drivers/staging/lustre/lustre/include/obd_class.h | 8 ++--- 8 files changed, 22 insertions(+), 52 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h index 3d86fb5..ac9238a 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h @@ -97,14 +97,10 @@ extern atomic_t libcfs_kmemory; */ # define libcfs_kmem_inc(ptr, size) \ -do { \ - atomic_add(size, &libcfs_kmemory); \ -} while (0) + atomic_add(size, &libcfs_kmemory) # define libcfs_kmem_dec(ptr, size) \ -do { \ - atomic_sub(size, &libcfs_kmemory); \ -} while (0) + atomic_sub(size, &libcfs_kmemory) # define libcfs_kmem_read() \ atomic_read(&libcfs_kmemory) @@ -114,11 +110,9 @@ do { \ #endif #define LIBCFS_ALLOC_PRE(size, mask) \ -do { \ LASSERT(!in_interrupt() || \ ((size) <= LIBCFS_VMALLOC_SIZE && \ - ((mask) & __GFP_WAIT) == 0));\ -} while (0) + ((mask) & __GFP_WAIT) == 0)) #define LIBCFS_ALLOC_POST(ptr, size) \ do { \ @@ -249,45 +243,33 @@ void cfs_array_free(void *vars); /** assert value of @a is equal to @v */ #define LASSERT_ATOMIC_EQ(a, v) \ -do { \ LASSERTF(atomic_read(a) == v, \ - "value: %d\n", atomic_read((a))); \ -} while (0) + "value: %d\n", atomic_read((a))) /** assert value of @a is unequal to @v */ #define LASSERT_ATOMIC_NE(a, v) \ -do { \ LASSERTF(atomic_read(a) != v, \ - "value: %d\n", atomic_read((a))); \ -} while (0) + "value: %d\n", atomic_read((a))) /** assert value of @a is little than @v */ #define LASSERT_ATOMIC_LT(a, v) \ -do { \ LASSERTF(atomic_read(a) < v, \ - "value: %d\n", atomic_read((a))); \ -} while (0) + "value: %d\n", atomic_read((a))) /** assert value of @a is little/equal to @v */ #define LASSERT_ATOMIC_LE(a, v) \ -do { \ LASSERTF(atomic_read(a) <= v, \ - "value: %d\n", atomic_read((a))); \ -} while (0) + "value: %d\n", atomic_read((a))) /** assert value of @a is great than @v */ #define LASSERT_ATOMIC_GT(a, v) \ -do { \ LASSERTF(atomic_read(a) > v, \ - "value: %d\n", atomic_read((a))); \ -} while (0) + "value: %d\n", atomic_read((a))) /** assert value of @a is great/equal to @v */ #define LASSERT_ATOMIC_GE(a, v) \ -do { \ LASSERTF(atomic_read(a) >= v, \ - "value: %d\n", atomic_read((a))); \ -} while (0) + "value: %d\n", atomic_read((a))) /** assert value of @a is great than @v1 and little than @v2 */ #define LASSERT_ATOMIC_GT_LT(a, v1, v2) \ diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h b/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h index 0f2fd79..be9006c 100644 --- a/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h +++ b/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h @@ -61,8 +61,8 @@ #define page_index(p) ((p)->index) #define memory_pressure_get() (current->flags & PF_MEMALLOC) -#define memory_pressure_set() do { current->flags |= PF_MEMALLOC; } while (0) -#define memory_pressure_clr() do { current->flags &= ~PF_MEMALLOC; } while (0) +#define memory_pressure_set() (current->flags |= PF_MEMALLOC) +#define memory_pressure_clr() (current->flags &= ~PF_MEMALLO