staging: media: intel-ipu3: replace bit shifts with BIT() macro
Subsystems (3)
PATCH 1/6 staging: media: intel-ipu3: replace bit shifts with BIT() macro
In reply to a message not in the archiveAdded #include <linux/bitops.h> and replaced bit shifts by BIT() macro. This BIT() macro from linux/bitops.h is used to define IPU3_UAPI_GRID_Y_START_EN and IPU3_UAPI_AWB_RGBS_THR_B_* bitmask.
Use of macro is better and neater. It maintains consistency. Reported by checkpatch.
--- drivers/staging/media/ipu3/include/intel-ipu3.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/media/ipu3/include/intel-ipu3.h +4 -3
@@ -5,6 +5,7 @@#define __IPU3_UAPI_H#include <linux/types.h> +#include <linux/bitops.h> /* from /drivers/staging/media/ipu3/include/videodev2.h */
@@ -22,11 +23,11 @@#define IPU3_UAPI_MAX_BUBBLE_SIZE 10#define IPU3_UAPI_GRID_START_MASK ((1 << 12) - 1) -#define IPU3_UAPI_GRID_Y_START_EN (1 << 15) +#define IPU3_UAPI_GRID_Y_START_EN BIT(15)/* controls generation of meta_data (like FF enable/disable) */ -#define IPU3_UAPI_AWB_RGBS_THR_B_EN (1 << 14) -#define IPU3_UAPI_AWB_RGBS_THR_B_INCL_SAT (1 << 15) +#define IPU3_UAPI_AWB_RGBS_THR_B_EN BIT(14) +#define IPU3_UAPI_AWB_RGBS_THR_B_INCL_SAT BIT(15)/** * struct ipu3_uapi_grid_config - Grid plane config
Signature · 1 line
2.30.2
PATCH 2/6 staging: media: intel-ipu3: preferred __aligned(size) over __attribute__aligned(size)
In reply to a message not in the archiveThis patch fixes the warning identified by checkpatch.pl by replacing __attribute__aligned(size) with __aligned(size)
--- .../staging/media/ipu3/include/intel-ipu3.h | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-)
drivers/staging/media/ipu3/include/intel-ipu3.h +37 -37
@@ -84,7 +84,7 @@ struct ipu3_uapi_grid_config {*/ struct ipu3_uapi_awb_raw_buffer {__u8 meta_data[IPU3_UAPI_AWB_MAX_BUFFER_SIZE ] - __attribute__((aligned (32 ))); +__aligned(32) ; } __packed;/**
@@ -105,7 +105,7 @@ struct ipu3_uapi_awb_config_s {__u16 rgbs_thr_gb;__u16 rgbs_thr_b;struct ipu3_uapi_grid_config grid; -} __attribute__((aligned(32))) __packed; +}__aligned(32) __packed;/** * struct ipu3_uapi_awb_config - AWB config wrapper
@@ -113,7 +113,7 @@ struct ipu3_uapi_awb_config_s {* @config: config for auto white balance as defined by &ipu3_uapi_awb_config_s */ struct ipu3_uapi_awb_config { -struct ipu3_uapi_awb_config_s config __attribute__((aligned (32 ))); +struct ipu3_uapi_awb_config_s config__aligned(32) ; } __packed;#define IPU3_UAPI_AE_COLORS 4/* R, G, B, Y */
@@ -138,7 +138,7 @@ struct ipu3_uapi_ae_raw_buffer {* @buff: &ipu3_uapi_ae_raw_buffer to hold full frame meta data. */ struct ipu3_uapi_ae_raw_buffer_aligned { -struct ipu3_uapi_ae_raw_buffer buff __attribute__((aligned (32 ))); +struct ipu3_uapi_ae_raw_buffer buff__aligned(32) ; } __packed;/**
@@ -244,10 +244,10 @@ struct ipu3_uapi_ae_ccm {* Calculate AE grid from image resolution, resample ae weights. */ struct ipu3_uapi_ae_config { -struct ipu3_uapi_ae_grid_config grid_cfg __attribute__((aligned (32 ))); +struct ipu3_uapi_ae_grid_config grid_cfg__aligned(32) ;struct ipu3_uapi_ae_weight_elem weights[ -IPU3_UAPI_AE_WEIGHTS ] __attribute__((aligned (32 ))); -struct ipu3_uapi_ae_ccm ae_ccm __attribute__((aligned (32 ))); +IPU3_UAPI_AE_WEIGHTS ]__aligned(32) ; +struct ipu3_uapi_ae_ccm ae_ccm__aligned(32) ; } __packed;/**
@@ -389,7 +389,7 @@ struct ipu3_uapi_af_filter_config {* each cell. */ struct ipu3_uapi_af_raw_buffer { -__u8 y_table[IPU3_UAPI_AF_Y_TABLE_MAX_SIZE ] __attribute__((aligned (32 ))); +__u8 y_table[IPU3_UAPI_AF_Y_TABLE_MAX_SIZE ]__aligned(32) ; } __packed;/**
@@ -402,9 +402,9 @@ struct ipu3_uapi_af_raw_buffer {* grid size for large image and vice versa. */ struct ipu3_uapi_af_config_s { -struct ipu3_uapi_af_filter_config filter_config __attribute__((aligned (32 ))); +struct ipu3_uapi_af_filter_config filter_config__aligned(32) ;__u8 padding[4 ]; -struct ipu3_uapi_grid_config grid_cfg __attribute__((aligned (32 ))); +struct ipu3_uapi_grid_config grid_cfg__aligned(32) ; } __packed;#define IPU3_UAPI_AWB_FR_MAX_SETS 24
@@ -425,7 +425,7 @@ struct ipu3_uapi_af_config_s {*/ struct ipu3_uapi_awb_fr_raw_buffer {__u8 meta_data[IPU3_UAPI_AWB_FR_BAYER_TABLE_MAX_SIZE ] - __attribute__((aligned (32 ))); +__aligned(32) ; } __packed;/**
@@ -463,12 +463,12 @@ struct ipu3_uapi_awb_fr_config_s {* @awb_fr_config: &ipu3_uapi_awb_fr_config_s, default resolution 16x16 */ struct ipu3_uapi_4a_config { -struct ipu3_uapi_awb_config_s awb_config __attribute__((aligned (32 ))); +struct ipu3_uapi_awb_config_s awb_config__aligned(32) ;struct ipu3_uapi_ae_grid_config ae_grd_config;__u8 padding[20 ];struct ipu3_uapi_af_config_s af_config;struct ipu3_uapi_awb_fr_config_s awb_fr_config - __attribute__((aligned (32 ))); +__aligned(32) ; } __packed;/**
@@ -487,7 +487,7 @@ struct ipu3_uapi_4a_config {* @padding3: padding bytes. */ struct ipu3_uapi_bubble_info { -__u32 num_of_stripes __attribute__((aligned (32 ))); +__u32 num_of_stripes__aligned(32) ;__u8 padding[28 ];__u32 num_sets;__u8 padding1[28 ];
@@ -519,7 +519,7 @@ struct ipu3_uapi_stats_3a_bubble_info_per_stripe {* @padding3: padding config */ struct ipu3_uapi_ff_status { -__u32 awb_en __attribute__((aligned (32 ))); +__u32 awb_en__aligned(32) ;__u8 padding[28 ];__u32 ae_en;__u8 padding1[28 ];
@@ -992,8 +992,8 @@ struct ipu3_uapi_gamma_corr_lut {* @gc_lut: lookup table of gamma correction &ipu3_uapi_gamma_corr_lut */ struct ipu3_uapi_gamma_config { -struct ipu3_uapi_gamma_corr_ctrl gc_ctrl __attribute__((aligned (32 ))); -struct ipu3_uapi_gamma_corr_lut gc_lut __attribute__((aligned (32 ))); +struct ipu3_uapi_gamma_corr_ctrl gc_ctrl__aligned(32) ; +struct ipu3_uapi_gamma_corr_lut gc_lut__aligned(32) ; } __packed;/**
@@ -1196,8 +1196,8 @@ struct ipu3_uapi_shd_lut {* @shd_lut: shading lookup table &ipu3_uapi_shd_lut */ struct ipu3_uapi_shd_config { -struct ipu3_uapi_shd_config_static shd __attribute__((aligned (32 ))); -struct ipu3_uapi_shd_lut shd_lut __attribute__((aligned (32 ))); +struct ipu3_uapi_shd_config_static shd__aligned(32) ; +struct ipu3_uapi_shd_lut shd_lut__aligned(32) ; } __packed;/* Image Enhancement Filter directed */
@@ -2421,8 +2421,8 @@ struct ipu3_uapi_anr_stitch_config {* @stitch: create 4x4 patch from 4 surrounding 8x8 patches. */ struct ipu3_uapi_anr_config { -struct ipu3_uapi_anr_transform_config transform __attribute__((aligned (32 ))); -struct ipu3_uapi_anr_stitch_config stitch __attribute__((aligned (32 ))); +struct ipu3_uapi_anr_transform_config transform__aligned(32) ; +struct ipu3_uapi_anr_stitch_config stitch__aligned(32) ; } __packed;/**
@@ -2463,21 +2463,21 @@ struct ipu3_uapi_anr_config {struct ipu3_uapi_acc_param {struct ipu3_uapi_bnr_static_config bnr;struct ipu3_uapi_bnr_static_config_green_disparity - green_disparity __attribute__((aligned (32 ))); -struct ipu3_uapi_dm_config dm __attribute__((aligned (32 ))); -struct ipu3_uapi_ccm_mat_config ccm __attribute__((aligned (32 ))); -struct ipu3_uapi_gamma_config gamma __attribute__((aligned (32 ))); -struct ipu3_uapi_csc_mat_config csc __attribute__((aligned (32 ))); -struct ipu3_uapi_cds_params cds __attribute__((aligned (32 ))); -struct ipu3_uapi_shd_config shd __attribute__((aligned (32 ))); -struct ipu3_uapi_yuvp1_iefd_config iefd __attribute__((aligned (32 ))); -struct ipu3_uapi_yuvp1_yds_config yds_c0 __attribute__((aligned (32 ))); -struct ipu3_uapi_yuvp1_chnr_config chnr_c0 __attribute__((aligned (32 ))); -struct ipu3_uapi_yuvp1_y_ee_nr_config y_ee_nr __attribute__((aligned (32 ))); -struct ipu3_uapi_yuvp1_yds_config yds __attribute__((aligned (32 ))); -struct ipu3_uapi_yuvp1_chnr_config chnr __attribute__((aligned (32 ))); -struct ipu3_uapi_yuvp1_yds_config yds2 __attribute__((aligned (32 ))); -struct ipu3_uapi_yuvp2_tcc_static_config tcc __attribute__((aligned (32 ))); + green_disparity__aligned(32) ; +struct ipu3_uapi_dm_config dm__aligned(32) ; +struct ipu3_uapi_ccm_mat_config ccm__aligned(32) ; +struct ipu3_uapi_gamma_config gamma__aligned(32) ; +struct ipu3_uapi_csc_mat_config csc__aligned(32) ; +struct ipu3_uapi_cds_params cds__aligned(32) ; +struct ipu3_uapi_shd_config shd__aligned(32) ; +struct ipu3_uapi_yuvp1_iefd_config iefd__aligned(32) ; +struct ipu3_uapi_yuvp1_yds_config yds_c0__aligned(32) ; +struct ipu3_uapi_yuvp1_chnr_config chnr_c0__aligned(32) ; +struct ipu3_uapi_yuvp1_y_ee_nr_config y_ee_nr__aligned(32) ; +struct ipu3_uapi_yuvp1_yds_config yds__aligned(32) ; +struct ipu3_uapi_yuvp1_chnr_config chnr__aligned(32) ; +struct ipu3_uapi_yuvp1_yds_config yds2__aligned(32) ; +struct ipu3_uapi_yuvp2_tcc_static_config tcc__aligned(32) ;struct ipu3_uapi_anr_config anr;struct ipu3_uapi_awb_fr_config_s awb_fr;struct ipu3_uapi_ae_config ae;
@@ -2765,7 +2765,7 @@ struct ipu3_uapi_flags {*/ struct ipu3_uapi_params {/* Flags which of the settings below are to be applied */ -struct ipu3_uapi_flags use __attribute__((aligned (32 ))); +struct ipu3_uapi_flags use__aligned(32) ;/* Accelerator cluster parameters */ struct ipu3_uapi_acc_param acc_param;
Signature · 1 line
2.30.2
PATCH 3/6 staging: media: intel-ipu3: remove unnecessary blank line
In reply to a message not in the archiveRemoved an unnecessary blank line to meet linux kernel coding style. Reported by checkpatch.pl
--- drivers/staging/media/ipu3/include/intel-ipu3.h | 1 - 1 file changed, 1 deletion(-)
drivers/staging/media/ipu3/include/intel-ipu3.h +0 -1
@@ -75,7 +75,6 @@ struct ipu3_uapi_grid_config { (IPU3_UAPI_AWB_MAX_SETS * \ (IPU3_UAPI_AWB_SET_SIZE +IPU3_UAPI_AWB_SPARE_FOR_BUBBLES )) -/** * struct ipu3_uapi_awb_raw_buffer - AWB raw buffer *
Signature · 1 line
2.30.2
PATCH 4/6 staging: media: intel-ipu3: reduce length of line
In reply to a message not in the archiveReduced length of line as it was exceeding 100 characters by removing comments from same line and adding it to previous line. This makes code neater, and meets linux kernel coding style.
Reported by checkpatch.
--- drivers/staging/media/ipu3/include/intel-ipu3.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/media/ipu3/include/intel-ipu3.h +4 -2
@@ -10,8 +10,10 @@/* from /drivers/staging/media/ipu3/include/videodev2.h */ /* Vendor specific - used for IPU3 camera sub-system */ -#define V4L2_META_FMT_IPU3_PARAMS v4l2_fourcc('i', 'p', '3', 'p')/* IPU3 processing parameters */ -#define V4L2_META_FMT_IPU3_STAT_3A v4l2_fourcc('i', 'p', '3', 's')/* IPU3 3A statistics */ +/* IPU3 processing parameters */ +#define V4L2_META_FMT_IPU3_PARAMS v4l2_fourcc('i', 'p', '3', 'p') +/* IPU3 3A statistics */ +#define V4L2_META_FMT_IPU3_STAT_3A v4l2_fourcc('i', 'p', '3', 's')/* from include/uapi/linux/v4l2-controls.h */ #define V4L2_CID_INTEL_IPU3_BASE (V4L2_CID_USER_BASE + 0x10c0)
Signature · 1 line
2.30.2
PATCH 5/6 staging: media: intel-ipu3: line should not end with '['
In reply to a message not in the archiveFixed the issue of line should not end with '[' by moving arguments from next line to line ending with '['
Reported by checkpatch.
--- drivers/staging/media/ipu3/include/intel-ipu3.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/media/ipu3/include/intel-ipu3.h +1 -2
@@ -246,8 +246,7 @@ struct ipu3_uapi_ae_ccm {*/ struct ipu3_uapi_ae_config {struct ipu3_uapi_ae_grid_config grid_cfg__aligned(32) ; -struct ipu3_uapi_ae_weight_elem weights[ -IPU3_UAPI_AE_WEIGHTS ]__aligned(32) ; +struct ipu3_uapi_ae_weight_elem weights[IPU3_UAPI_AE_WEIGHTS ]__aligned(32) ;struct ipu3_uapi_ae_ccm ae_ccm__aligned(32) ; } __packed;
Signature · 1 line
2.30.2
PATCH 6/6 staging: media: intel-ipu3: remove space before tabs
In reply to a message not in the archiveRemoved unnecessary space before tabs to adhere to linux kernel coding style.
Reported by checkpatch.
--- drivers/staging/media/ipu3/include/intel-ipu3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/ipu3/include/intel-ipu3.h +1 -1
@@ -631,7 +631,7 @@ struct ipu3_uapi_bnr_static_config_wb_gains_thr_config {* @cg: Gain coefficient for threshold calculation, [0, 31], default 8. * @ci: Intensity coefficient for threshold calculation. range [0, 0x1f] * default 6. -* format: u3.2 (3 most significant bits represent whole number, +* format: u3.2 (3 most significant bits represent whole number, * 2 least significant bits represent the fractional part * with each count representing 0.25) * e.g. 6 in binary format is 00110, that translates to 1.5
Signature · 1 line
2.30.2
Sakari Ailus
maintainerHi Mitali,
Quoted 24 lines · Mitali Borkar
Added #include <
linux/bitops.h> and replaced bit shifts byBIT()macro. ThisBIT()macro fromlinux/bitops.his used to defineIPU3_UAPI_GRID_Y_START_ENand IPU3_UAPI_AWB_RGBS_THR_B_* bitmask.
Use of macro is better and neater. It maintains consistency. Reported by checkpatch.Signed-off-by Mitali Borkar <[email protected]>--- drivers/staging/media/ipu3/include/intel-ipu3.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/staging/media/ipu3/include/intel-ipu3.h +1
-0@@ -5,6 +5,7 @@#define __IPU3_UAPI_H#include <linux/types.h> +#include <linux/bitops.h> /* from /drivers/staging/media/ipu3/include/videodev2.h */
drivers/staging/media/ipu3/include/intel-ipu3.h line 26
Quoted 5 lines
drivers/staging/media/ipu3/include/intel-ipu3.h +1
-1@@ -22,11 +23,11 @@#define IPU3_UAPI_MAX_BUBBLE_SIZE 10#define IPU3_UAPI_GRID_START_MASK ((1 << 12) - 1) -#define IPU3_UAPI_GRID_Y_START_EN (1 << 15) +#define IPU3_UAPI_GRID_Y_START_EN BIT(15)
This header is used in user space where you don't have the BIT() macro.
Quoted 9 lines
drivers/staging/media/ipu3/include/intel-ipu3.h +2
-2/* controls generation of meta_data (like FF enable/disable) */ -#define IPU3_UAPI_AWB_RGBS_THR_B_EN (1 << 14) -#define IPU3_UAPI_AWB_RGBS_THR_B_INCL_SAT (1 << 15) +#define IPU3_UAPI_AWB_RGBS_THR_B_EN BIT(14) +#define IPU3_UAPI_AWB_RGBS_THR_B_INCL_SAT BIT(15)/** * struct ipu3_uapi_grid_config - Grid plane config
Signature · 3 lines
Kind regards, Sakari Ailus
Sakari Ailus
maintainerRe: [PATCH 2/6] staging: media: intel-ipu3: preferred __aligned(size) over __attribute__aligned(size)
In reply to Mitali BorkarHi Mitali,
Quoted 2 lines · Mitali Borkar
This patch fixes the warning identified by checkpatch.pl by replacing
__attribute__aligned(size)with__aligned(size)
Same comments on this than the 1st patch.
It's a staging driver so even if this is a user space header, it's not under include/uapi/linux.
Signature · 3 lines
Kind regards, Sakari Ailus
Greg KH
maintainerQuoted 26 lines · Sakari Ailus
Hi Mitali,
Quoted 23 lines · Mitali Borkar
Added #include <
linux/bitops.h> and replaced bit shifts byBIT()macro. ThisBIT()macro fromlinux/bitops.his used to defineIPU3_UAPI_GRID_Y_START_ENand IPU3_UAPI_AWB_RGBS_THR_B_* bitmask.
Use of macro is better and neater. It maintains consistency. Reported by checkpatch.Signed-off-by Mitali Borkar <[email protected]>--- drivers/staging/media/ipu3/include/intel-ipu3.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/staging/media/ipu3/include/intel-ipu3.h +1
-0@@ -5,6 +5,7 @@#define __IPU3_UAPI_H#include <linux/types.h> +#include <linux/bitops.h> /* from /drivers/staging/media/ipu3/include/videodev2.h */
Quoted 8 lines
drivers/staging/media/ipu3/include/intel-ipu3.h line 26
Quoted 6 lines
drivers/staging/media/ipu3/include/intel-ipu3.h +1
-1@@ -22,11 +23,11 @@#define IPU3_UAPI_MAX_BUBBLE_SIZE 10#define IPU3_UAPI_GRID_START_MASK ((1 << 12) - 1) -#define IPU3_UAPI_GRID_Y_START_EN (1 << 15) +#define IPU3_UAPI_GRID_Y_START_EN BIT(15)This header is used in user space where you don't have the
BIT()macro.
If that is true, why is it not in a "uapi" subdir within this driver?
Otherwise it is not obvious at all that this is the case :(
thanks,
greg k-h
Sakari Ailus
maintainerRe: [PATCH 5/6] staging: media: intel-ipu3: line should not end with '['
In reply to Mitali BorkarHi Mitali,
Quoted 14 lines · Mitali Borkar
Fixed the issue of line should not end with '[' by moving arguments from next line to line ending with '['
Reported by checkpatch.Signed-off-by Mitali Borkar <[email protected]>--- drivers/staging/media/ipu3/include/intel-ipu3.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/staging/media/ipu3/include/intel-ipu3.h +0
-0
drivers/staging/media/ipu3/include/intel-ipu3.h struct ipu3_uapi_ae_ccm { · line 249
Quoted 6 lines
drivers/staging/media/ipu3/include/intel-ipu3.h +1
-2@@ -246,8 +246,7 @@ struct ipu3_uapi_ae_ccm {*/ struct ipu3_uapi_ae_config {struct ipu3_uapi_ae_grid_config grid_cfg__aligned(32) ; -struct ipu3_uapi_ae_weight_elem weights[ -IPU3_UAPI_AE_WEIGHTS ]__aligned(32) ; +struct ipu3_uapi_ae_weight_elem weights[IPU3_UAPI_AE_WEIGHTS ]__aligned(32) ;
Could you still wrap it to stay under 80?
Quoted 3 lines
drivers/staging/media/ipu3/include/intel-ipu3.h +0
-0struct ipu3_uapi_ae_ccm ae_ccm__aligned(32) ; } __packed;
Signature · 1 line
Sakari Ailus
Quoted 25 lines · Greg KH
Quoted 24 lines · Sakari Ailus
Hi Mitali,
Quoted 21 lines · Mitali Borkar
Added #include <
linux/bitops.h> and replaced bit shifts byBIT()macro. ThisBIT()macro fromlinux/bitops.his used to defineIPU3_UAPI_GRID_Y_START_ENand IPU3_UAPI_AWB_RGBS_THR_B_* bitmask.
Use of macro is better and neater. It maintains consistency. Reported by checkpatch.Signed-off-by Mitali Borkar <[email protected]>--- drivers/staging/media/ipu3/include/intel-ipu3.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/staging/media/ipu3/include/intel-ipu3.h +1
-0@@ -5,6 +5,7 @@#define __IPU3_UAPI_H#include <linux/types.h> +#include <linux/bitops.h>
Quoted 6 lines
Quoted 6 lines
drivers/staging/media/ipu3/include/intel-ipu3.h line 25
Quoted 6 lines
drivers/staging/media/ipu3/include/intel-ipu3.h +0
-0/* from /drivers/staging/media/ipu3/include/videodev2.h */ @@ -22,11 +23,11 @@#define IPU3_UAPI_MAX_BUBBLE_SIZE 10#define IPU3_UAPI_GRID_START_MASK ((1 << 12) - 1)
Mitali,
It's not very relevant given the use of this header, but if the 1 << 15 translation was correct, you could have changed the 1 << 12 computation as well.
julia
Quoted 18 lines
Quoted 4 lines
drivers/staging/media/ipu3/include/intel-ipu3.h line 26
Quoted 2 lines
drivers/staging/media/ipu3/include/intel-ipu3.h +1
-1-#define IPU3_UAPI_GRID_Y_START_EN (1 << 15) +#define IPU3_UAPI_GRID_Y_START_EN BIT(15)This header is used in user space where you don't have the
BIT()macro.If that is true, why is it not in a "uapi" subdir within this driver?
Otherwise it is not obvious at all that this is the case :(
thanks,
greg k-h
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/YHQXty07oAP1L0W9%40kroah.com.
Sakari Ailus
maintainerHi Greg,
Quoted 36 lines · Greg KH
Quoted 26 lines · Sakari Ailus
Hi Mitali,
Quoted 23 lines · Mitali Borkar
Added #include <
linux/bitops.h> and replaced bit shifts byBIT()macro. ThisBIT()macro fromlinux/bitops.his used to defineIPU3_UAPI_GRID_Y_START_ENand IPU3_UAPI_AWB_RGBS_THR_B_* bitmask.
Use of macro is better and neater. It maintains consistency. Reported by checkpatch.Signed-off-by Mitali Borkar <[email protected]>--- drivers/staging/media/ipu3/include/intel-ipu3.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/staging/media/ipu3/include/intel-ipu3.h +1
-0@@ -5,6 +5,7 @@#define __IPU3_UAPI_H#include <linux/types.h> +#include <linux/bitops.h> /* from /drivers/staging/media/ipu3/include/videodev2.h */ Quoted 8 lines
drivers/staging/media/ipu3/include/intel-ipu3.h line 26
Quoted 6 lines
drivers/staging/media/ipu3/include/intel-ipu3.h +1
-1@@ -22,11 +23,11 @@#define IPU3_UAPI_MAX_BUBBLE_SIZE 10#define IPU3_UAPI_GRID_START_MASK ((1 << 12) - 1) -#define IPU3_UAPI_GRID_Y_START_EN (1 << 15) +#define IPU3_UAPI_GRID_Y_START_EN BIT(15)This header is used in user space where you don't have the
BIT()macro.
Quoted 3 lines
If that is true, why is it not in a "uapi" subdir within this driver?
Otherwise it is not obvious at all that this is the case :(
It defines an interface towards the user space and the argument has been a staging driver shouldn't be doing that (for the lack of ABI stability), hence leaving it where it is currently.
Also CC Laurent.
Signature · 3 lines
Kind regards, Sakari Ailus
Greg KH
maintainerQuoted 39 lines · Sakari Ailus
Hi Greg,
Quoted 36 lines · Greg KH
Quoted 34 lines · Sakari Ailus
Hi Mitali,
Quoted 24 lines · Mitali Borkar
Added #include <
linux/bitops.h> and replaced bit shifts byBIT()macro. ThisBIT()macro fromlinux/bitops.his used to defineIPU3_UAPI_GRID_Y_START_ENand IPU3_UAPI_AWB_RGBS_THR_B_* bitmask.
Use of macro is better and neater. It maintains consistency. Reported by checkpatch.Signed-off-by Mitali Borkar <[email protected]>--- drivers/staging/media/ipu3/include/intel-ipu3.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/staging/media/ipu3/include/intel-ipu3.h +1
-0@@ -5,6 +5,7 @@#define __IPU3_UAPI_H#include <linux/types.h> +#include <linux/bitops.h> /* from /drivers/staging/media/ipu3/include/videodev2.h */ drivers/staging/media/ipu3/include/intel-ipu3.h line 26
Quoted 5 lines
drivers/staging/media/ipu3/include/intel-ipu3.h +1
-1@@ -22,11 +23,11 @@#define IPU3_UAPI_MAX_BUBBLE_SIZE 10#define IPU3_UAPI_GRID_START_MASK ((1 << 12) - 1) -#define IPU3_UAPI_GRID_Y_START_EN (1 << 15) +#define IPU3_UAPI_GRID_Y_START_EN BIT(15)This header is used in user space where you don't have the
BIT()macro.
Quoted 7 lines
Quoted 3 lines
If that is true, why is it not in a "uapi" subdir within this driver?
Otherwise it is not obvious at all that this is the case :(
It defines an interface towards the user space and the argument has been a staging driver shouldn't be doing that (for the lack of ABI stability), hence leaving it where it is currently.
I think we are talking past each other here...
If you have a userspace api, then put that in a .h file that has a "uapi" in the path. Just because you have this in a staging driver does not mean you should not have such a thing, otherwise you are going to constantly fight against people sending you patches like this as there is no obvious way to determine this.
So how about moving this file to:
drivers/staging/media/ipu3/include/uapi/intel-ipu3.h
thanks,
greg k-h
Sakari Ailus
maintainerQuoted 50 lines · Greg KH
Quoted 39 lines · Sakari Ailus
Hi Greg,
Quoted 36 lines · Greg KH
Quoted 34 lines · Sakari Ailus
Hi Mitali,
Quoted 24 lines · Mitali Borkar
Added #include <
linux/bitops.h> and replaced bit shifts byBIT()macro. ThisBIT()macro fromlinux/bitops.his used to defineIPU3_UAPI_GRID_Y_START_ENand IPU3_UAPI_AWB_RGBS_THR_B_* bitmask.
Use of macro is better and neater. It maintains consistency. Reported by checkpatch.Signed-off-by Mitali Borkar <[email protected]>--- drivers/staging/media/ipu3/include/intel-ipu3.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/staging/media/ipu3/include/intel-ipu3.h +1
-0@@ -5,6 +5,7 @@#define __IPU3_UAPI_H#include <linux/types.h> +#include <linux/bitops.h> /* from /drivers/staging/media/ipu3/include/videodev2.h */ drivers/staging/media/ipu3/include/intel-ipu3.h line 26
Quoted 5 lines
drivers/staging/media/ipu3/include/intel-ipu3.h +1
-1@@ -22,11 +23,11 @@#define IPU3_UAPI_MAX_BUBBLE_SIZE 10#define IPU3_UAPI_GRID_START_MASK ((1 << 12) - 1) -#define IPU3_UAPI_GRID_Y_START_EN (1 << 15) +#define IPU3_UAPI_GRID_Y_START_EN BIT(15)This header is used in user space where you don't have the
BIT()macro.Quoted 7 lines
Quoted 3 lines
If that is true, why is it not in a "uapi" subdir within this driver?
Otherwise it is not obvious at all that this is the case :(
It defines an interface towards the user space and the argument has been a staging driver shouldn't be doing that (for the lack of ABI stability), hence leaving it where it is currently.
I think we are talking past each other here...
Quoted 8 lines
If you have a userspace api, then put that in a .h file that has a "uapi" in the path. Just because you have this in a staging driver does not mean you should not have such a thing, otherwise you are going to constantly fight against people sending you patches like this as there is no obvious way to determine this.
So how about moving this file to:
drivers/staging/media/ipu3/include/uapi/intel-ipu3.h
Ah, sure! I'll send a patch.
Signature · 1 line
Sakari Ailus
Re: [Outreachy kernel] Re: [PATCH 2/6] staging: media: intel-ipu3: preferred __aligned(size) over __attribute__aligned(size)
In reply to Sakari AilusQuoted 11 lines · Sakari Ailus
Hi Mitali,
Quoted 2 lines · Mitali Borkar
This patch fixes the warning identified by checkpatch.pl by replacing
__attribute__aligned(size)with__aligned(size)Same comments on this than the 1st patch.
It's a staging driver so even if this is a user space header, it's not under
include/uapi/linux.
Sir, I am not able to understandd what you are trying to say in this. As you mentioned in patch 1/6, I removed and added header where BIT() macro under apprpriate userpace, but what should I modify in this patch?
Quoted 9 lines
Signature · 8 lines
Kind regards, Sakari Ailus -- You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20210412094315.GJ3%40paasikivi.fi.intel.com.
Sakari Ailus
maintainerRe: [Outreachy kernel] Re: [PATCH 2/6] staging: media: intel-ipu3: preferred __aligned(size) over __attribute__aligned(size)
Hi Mitali,
Quoted 7 lines · Mitali Borkar
Quoted 6 lines · Sakari Ailus
Hi Mitali,
Quoted 2 lines · Mitali Borkar
This patch fixes the warning identified by checkpatch.pl by replacing
__attribute__aligned(size)with__aligned(size)
Quoted 8 lines
Quoted 5 lines
Same comments on this than the 1st patch.
It's a staging driver so even if this is a user space header, it's not under
include/uapi/linux.Sir, I am not able to understandd what you are trying to say in this. As you mentioned in patch 1/6, I removed and added header where
BIT()macro under apprpriate userpace, but what should I modify in this patch?
The comment on the 1st patch and above was a weird way of saying "please drop patches 1 and 2".
BIT(), __aligned() and __packed are macros in kernel headers that generally are not available in headers exported for user space consumption.
Signature · 3 lines
Kind regards, Sakari Ailus
RE: [PATCH 2/6] staging: media: intel-ipu3: preferred __aligned(size) over __attribute__aligned(size)
In reply to Mitali BorkarFrom: Mitali Borkar
Quoted 16 lines
Sent: 12 April 2021 00:09
This patch fixes the warning identified by checkpatch.pl by replacing
__attribute__aligned(size)with__aligned(size)Signed-off-by Mitali Borkar <[email protected]>--- .../staging/media/ipu3/include/intel-ipu3.h | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-)drivers/staging/media/ipu3/include/intel-ipu3.h +0
-0
drivers/staging/media/ipu3/include/intel-ipu3.h struct ipu3_uapi_grid_config { · line 88
Quoted 6 lines
drivers/staging/media/ipu3/include/intel-ipu3.h +1
-1@@ -84,7 +84,7 @@ struct ipu3_uapi_grid_config {*/ struct ipu3_uapi_awb_raw_buffer {__u8 meta_data[IPU3_UAPI_AWB_MAX_BUFFER_SIZE ] - __attribute__((aligned (32 ))); +__aligned(32) ; } __packed;
WTF?
It either has 1-byte alignment because it is just __u8, 32-byte because of the aligned(32),
or 1 byte because of the outer packed.
What alignment does this (and all the other) structures actually need?
Specifying 'packed' isn't free.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
[email protected]
maintainerRe: [PATCH 2/6] staging: media: intel-ipu3: preferred __aligned(size) over __attribute__aligned(size)
Hi David,
Quoted 26 lines · David Laight
From: Mitali Borkar
Quoted 16 lines
Sent: 12 April 2021 00:09
This patch fixes the warning identified by checkpatch.pl by replacing
__attribute__aligned(size)with__aligned(size)Signed-off-by Mitali Borkar <[email protected]>--- .../staging/media/ipu3/include/intel-ipu3.h | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-)drivers/staging/media/ipu3/include/intel-ipu3.h +0
-0drivers/staging/media/ipu3/include/intel-ipu3.h struct ipu3_uapi_grid_config { · line 88
Quoted 6 lines
drivers/staging/media/ipu3/include/intel-ipu3.h +1
-1@@ -84,7 +84,7 @@ struct ipu3_uapi_grid_config {*/ struct ipu3_uapi_awb_raw_buffer {__u8 meta_data[IPU3_UAPI_AWB_MAX_BUFFER_SIZE ] - __attribute__((aligned (32 ))); +__aligned(32) ; } __packed;WTF?
Quoted 6 lines
It either has 1-byte alignment because it is just
__u8, 32-byte because of the aligned(32),
or 1 byte because of the outer packed.What alignment does this (and all the other) structures actually need?
32 as noted above. Here packed makes no difference though.
Some of these structs are used embedded in other structs or alone. I haven't checked this one.
It's also possible to have __packed and __aligned() conflict (in which case a decent compiler would give you a warning) --- which does not happen currently AFAIK.
Quoted 2 lines
Specifying 'packed' isn't free.
It may be free if the packed alignment of the fields corresponds to architecture's packing. Here __aligned() is used to satisfy hardware alignment requirements and __packed is used to ensure the same memory layout independently of ABI rules.
Signature · 3 lines
Regards, Sakari Ailus
RE: [PATCH 2/6] staging: media: intel-ipu3: preferred __aligned(size) over __attribute__aligned(size)
From: [email protected]
Quoted 31 lines
Sent: 13 April 2021 10:56
Hi David,
Quoted 26 lines · David Laight
From: Mitali Borkar
Quoted 16 lines
Sent: 12 April 2021 00:09
This patch fixes the warning identified by checkpatch.pl by replacing
__attribute__aligned(size)with__aligned(size)Signed-off-by Mitali Borkar <[email protected]>--- .../staging/media/ipu3/include/intel-ipu3.h | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-)drivers/staging/media/ipu3/include/intel-ipu3.h +0
-0drivers/staging/media/ipu3/include/intel-ipu3.h struct ipu3_uapi_grid_config { · line 88
Quoted 6 lines
drivers/staging/media/ipu3/include/intel-ipu3.h +1
-1@@ -84,7 +84,7 @@ struct ipu3_uapi_grid_config {*/ struct ipu3_uapi_awb_raw_buffer {__u8 meta_data[IPU3_UAPI_AWB_MAX_BUFFER_SIZE ] - __attribute__((aligned (32 ))); +__aligned(32) ; } __packed;WTF?
Quoted 8 lines
Quoted 6 lines
It either has 1-byte alignment because it is just
__u8, 32-byte because of the aligned(32),
or 1 byte because of the outer packed.What alignment does this (and all the other) structures actually need?
32 as noted above. Here packed makes no difference though.
Bollocks - it ought to override the __aligned(32);
Quoted 6 lines
Some of these structs are used embedded in other structs or alone. I haven't checked this one.
It's also possible to have
__packedand__aligned()conflict (in which case a decent compiler would give you a warning) --- which does not happen currently AFAIK.
At least one compiler is objecting to some similar constructs.
Quoted 7 lines
Quoted 2 lines
Specifying 'packed' isn't free.
It may be free if the packed alignment of the fields corresponds to architecture's packing. Here
__aligned()is used to satisfy hardware alignment requirements and__packedis used to ensure the same memory layout independently of ABI rules.
No that isn't what packed is for.
'packed' also tells the compiler that the structure may 'exist' at an unaligned address.
On many architectures this requires the compiler use byte sized access and shifts for all members.
If you are worried that the compiler/ABI might have inserted padding then add a compile-time assert on the structure size. But most kernel code assumes that structures where everything is on its natural boundary won't have any padding.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)