staging: sm750fb: Clean up variable names
Subsystems (2)
PATCH 1/1 staging: sm750fb: Clean up variable names
Variables in sm750_accel.c follow a mix of camelCase convention and hungarian shorthands. Rename it to adhere to kernel's snake_case naming convention and improve readability.
--- drivers/staging/sm750fb/sm750_accel.c | 116 +++++++++++++------------- 1 file changed, 58 insertions(+), 58 deletions(-)
drivers/staging/sm750fb/sm750_accel.c +58 -58
@@ -27,7 +27,7 @@ static inline u32 read_dpr(struct lynx_accel *accel, int offset)return readl (accel->dpr_base + offset); } -static inline void write_dpPort (struct lynx_accel *accel,u32 data) +static inline void write_dp_port (struct lynx_accel *accel,u32 data) {writel (data, accel->dp_port_base); }
@@ -132,12 +132,12 @@ int sm750_hw_fillrect(struct lynx_accel *accel,/** * sm750_hw_copyarea * @accel: Acceleration device data -* @sBase: Address of source: offset in frame buffer -* @sPitch: Pitch value of source surface in BYTE +* @s_base: Address of source: offset in frame buffer +* @s_pitch: Pitch value of source surface in BYTE * @sx: Starting x coordinate of source surface * @sy: Starting y coordinate of source surface -* @dBase: Address of destination: offset in frame buffer -* @dPitch: Pitch value of destination surface in BYTE +* @d_base: Address of destination: offset in frame buffer +* @d_pitch: Pitch value of destination surface in BYTE * @Bpp: Color depth of destination surface * @dx: Starting x coordinate of destination surface * @dy: Starting y coordinate of destination surface
@@ -146,21 +146,21 @@ int sm750_hw_fillrect(struct lynx_accel *accel,* @rop2: ROP value */ int sm750_hw_copyarea (struct lynx_accel *accel, -unsigned int sBase,unsigned int sPitch, +unsigned int s_base,unsigned int s_pitch,unsigned int sx,unsigned int sy, -unsigned int dBase,unsigned int dPitch, +unsigned int d_base,unsigned int d_pitch,unsigned int Bpp,unsigned int dx,unsigned int dy,unsigned int width,unsigned int height,unsigned int rop2) { -unsigned int nDirection, de_ctrl; +unsigned int direction, de_ctrl; - nDirection =LEFT_TO_RIGHT ; + direction =LEFT_TO_RIGHT ;/* Direction of ROP2 operation: 1 = Left to Right, (-1) = Right to Left */ de_ctrl =0 ;/* If source and destination are the same surface, need to check for overlay cases */ -if (sBase == dBase && sPitch == dPitch) { +if (s_base == d_base && s_pitch == d_pitch) {/* Determine direction of operation */ if (sy < dy) {/* +----------+
@@ -173,7 +173,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,* +----------+ */ - nDirection =BOTTOM_TO_TOP ; + direction =BOTTOM_TO_TOP ; }else if (sy > dy) {/* +----------+ * |D |
@@ -185,7 +185,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,* +----------+ */ - nDirection =TOP_TO_BOTTOM ; + direction =TOP_TO_BOTTOM ; }else {/* sy == dy */
@@ -198,7 +198,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,* +------+---+------+ */ - nDirection =RIGHT_TO_LEFT ; + direction =RIGHT_TO_LEFT ; }else {/* sx > dx */
@@ -210,12 +210,12 @@ int sm750_hw_copyarea(struct lynx_accel *accel,* +------+---+------+ */ - nDirection =LEFT_TO_RIGHT ; + direction =LEFT_TO_RIGHT ; } } } -if ((nDirection ==BOTTOM_TO_TOP ) || (nDirection ==RIGHT_TO_LEFT )) { +if ((direction ==BOTTOM_TO_TOP ) || (direction ==RIGHT_TO_LEFT )) { sx += width -1 ; sy += height -1 ; dx += width -1 ;
@@ -234,14 +234,14 @@ int sm750_hw_copyarea(struct lynx_accel *accel,* It is an address offset (128 bit aligned) * from the beginning of frame buffer. */ -write_dpr (accel,DE_WINDOW_SOURCE_BASE , sBase);/* dpr40 */ +write_dpr (accel,DE_WINDOW_SOURCE_BASE , s_base);/* dpr40 */ /* * 2D Destination Base. * It is an address offset (128 bit aligned) * from the beginning of frame buffer. */ -write_dpr (accel,DE_WINDOW_DESTINATION_BASE , dBase);/* dpr44 */ +write_dpr (accel,DE_WINDOW_DESTINATION_BASE , d_base);/* dpr44 */ /* * Program pitch (distance between the 1st points of two adjacent lines).
@@ -249,9 +249,9 @@ int sm750_hw_copyarea(struct lynx_accel *accel,* pixel values. Need Byte to pixel conversion. */ write_dpr (accel,DE_PITCH , - ((dPitch / Bpp <<DE_PITCH_DESTINATION_SHIFT ) & + ((d_pitch / Bpp <<DE_PITCH_DESTINATION_SHIFT ) &DE_PITCH_DESTINATION_MASK ) | - (sPitch / Bpp &DE_PITCH_SOURCE_MASK ));/* dpr10 */ + (s_pitch / Bpp &DE_PITCH_SOURCE_MASK ));/* dpr10 */ /* * Screen Window width in Pixels.
@@ -259,9 +259,9 @@ int sm750_hw_copyarea(struct lynx_accel *accel,* for a given point. */ write_dpr (accel,DE_WINDOW_WIDTH , - ((dPitch / Bpp <<DE_WINDOW_WIDTH_DST_SHIFT ) & + ((d_pitch / Bpp <<DE_WINDOW_WIDTH_DST_SHIFT ) &DE_WINDOW_WIDTH_DST_MASK ) | - (sPitch / Bpp &DE_WINDOW_WIDTH_SRC_MASK ));/* dpr3c */ + (s_pitch / Bpp &DE_WINDOW_WIDTH_SRC_MASK ));/* dpr3c */ if (accel->de_wait () !=0 )return -1 ;
@@ -277,7 +277,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel, (height & DE_DIMENSION_Y_ET_MASK)); /* dpr08 */ de_ctrl = (rop2 &DE_CONTROL_ROP_MASK ) |DE_CONTROL_ROP_SELECT | - ((nDirection ==RIGHT_TO_LEFT ) ?DE_CONTROL_DIRECTION :0 ) | + ((direction ==RIGHT_TO_LEFT ) ?DE_CONTROL_DIRECTION :0 ) |DE_CONTROL_COMMAND_BITBLT |DE_CONTROL_STATUS ;write_dpr (accel,DE_CONTROL , de_ctrl);/* dpr0c */
@@ -299,38 +299,38 @@ static unsigned int de_get_transparency(struct lynx_accel *accel)/** * sm750_hw_imageblit * @accel: Acceleration device data -* @pSrcbuf: pointer to start of source buffer in system memory -* @srcDelta: Pitch value (in bytes) of the source buffer, +ive means top down +* @src_buf: pointer to start of source buffer in system memory +* @src_delta: Pitch value (in bytes) of the source buffer, +ive means top down * and -ive mean button up -* @startBit: Mono data can start at any bit in a byte, this value should be +* @start_bit: Mono data can start at any bit in a byte, this value should be * 0 to 7 -* @dBase: Address of destination: offset in frame buffer -* @dPitch: Pitch value of destination surface in BYTE -* @bytePerPixel: Color depth of destination surface +* @d_base: Address of destination: offset in frame buffer +* @d_pitch: Pitch value of destination surface in BYTE +* @byte_per_pixel: Color depth of destination surface * @dx: Starting x coordinate of destination surface * @dy: Starting y coordinate of destination surface * @width: width of rectangle in pixel value * @height: height of rectangle in pixel value -* @fColor: Foreground color (corresponding to a 1 in the monochrome data -* @bColor: Background color (corresponding to a 0 in the monochrome data +* @fg_color: Foreground color (corresponding to a 1 in the monochrome data +* @bg_color: Background color (corresponding to a 0 in the monochrome data * @rop2: ROP value */ -int sm750_hw_imageblit (struct lynx_accel *accel,const char *pSrcbuf, -u32 srcDelta,u32 startBit,u32 dBase,u32 dPitch, -u32 bytePerPixel,u32 dx,u32 dy,u32 width, -u32 height,u32 fColor,u32 bColor,u32 rop2) +int sm750_hw_imageblit (struct lynx_accel *accel,const char *src_buf, +u32 src_delta,u32 start_bit,u32 d_base,u32 d_pitch, +u32 byte_per_pixel,u32 dx,u32 dy,u32 width, +u32 height,u32 fg_color,u32 bg_color,u32 rop2) { -unsigned int ulBytesPerScan; -unsigned int ul4BytesPerScan; -unsigned int ulBytesRemain; +unsigned int bytes_per_scan; +unsigned int words_per_scan; +unsigned int bytes_remain;unsigned int de_ctrl =0 ; -unsigned char ajRemain[4 ]; +unsigned char remain[4 ];int i, j; - startBit &=7 ;/* Just make sure the start bit is within legal range */ - ulBytesPerScan = (width + startBit +7 ) /8 ; - ul4BytesPerScan = ulBytesPerScan & ~3 ; - ulBytesRemain = ulBytesPerScan &3 ; + start_bit &=7 ;/* Just make sure the start bit is within legal range */ + bytes_per_scan = (width + start_bit +7 ) /8 ; + words_per_scan = bytes_per_scan & ~3 ; + bytes_remain = bytes_per_scan &3 ;if (accel->de_wait () !=0 )return -1 ;
@@ -345,7 +345,7 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,* It is an address offset (128 bit aligned) * from the beginning of frame buffer. */ -write_dpr (accel,DE_WINDOW_DESTINATION_BASE , dBase); +write_dpr (accel,DE_WINDOW_DESTINATION_BASE , d_base);/* * Program pitch (distance between the 1st points of two adjacent
@@ -353,9 +353,9 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,* register uses pixel values. Need Byte to pixel conversion. */ write_dpr (accel,DE_PITCH , - ((dPitch / bytePerPixel <<DE_PITCH_DESTINATION_SHIFT ) & + ((d_pitch / byte_per_pixel <<DE_PITCH_DESTINATION_SHIFT ) &DE_PITCH_DESTINATION_MASK ) | - (dPitch / bytePerPixel &DE_PITCH_SOURCE_MASK ));/* dpr10 */ + (d_pitch / byte_per_pixel &DE_PITCH_SOURCE_MASK ));/* dpr10 */ /* * Screen Window width in Pixels.
@@ -363,17 +363,17 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,* in frame buffer for a given point. */ write_dpr (accel,DE_WINDOW_WIDTH , - ((dPitch / bytePerPixel <<DE_WINDOW_WIDTH_DST_SHIFT ) & + ((d_pitch / byte_per_pixel <<DE_WINDOW_WIDTH_DST_SHIFT ) &DE_WINDOW_WIDTH_DST_MASK ) | - (dPitch / bytePerPixel &DE_WINDOW_WIDTH_SRC_MASK )); + (d_pitch / byte_per_pixel &DE_WINDOW_WIDTH_SRC_MASK ));/* * Note: For 2D Source in Host Write, only X_K1_MONO field is needed, * and Y_K2 field is not used. -* For mono bitmap, use startBit for X_K1. +* For mono bitmap, use start_bit for X_K1. */ write_dpr (accel,DE_SOURCE , - (startBit <<DE_SOURCE_X_K1_SHIFT ) & + (start_bit <<DE_SOURCE_X_K1_SHIFT ) &DE_SOURCE_X_K1_MONO_MASK );/* dpr00 */ write_dpr(accel, DE_DESTINATION,
@@ -384,8 +384,8 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf, ((width <<DE_DIMENSION_X_SHIFT ) &DE_DIMENSION_X_MASK ) | (height & DE_DIMENSION_Y_ET_MASK)); /* dpr08 */ -write_dpr (accel,DE_FOREGROUND , fColor); -write_dpr (accel,DE_BACKGROUND , bColor); +write_dpr (accel,DE_FOREGROUND , fg_color); +write_dpr (accel,DE_BACKGROUND , bg_color); de_ctrl = (rop2 &DE_CONTROL_ROP_MASK ) | DE_CONTROL_ROP_SELECT | DE_CONTROL_COMMAND_HOST_WRITE |
@@ -396,16 +396,16 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,/* Write MONO data (line by line) to 2D Engine data port */ for (i =0 ; i < height; i++) {/* For each line, send the data in chunks of 4 bytes */ -for (j =0 ; j < (ul4BytesPerScan /4 ); j++) -write_dpPort (accel, *(unsigned int *)(pSrcbuf + (j *4 ))); +for (j =0 ; j < (words_per_scan /4 ); j++) +write_dp_port (accel, *(unsigned int *)(src_buf + (j *4 ))); -if (ulBytesRemain) { -memcpy (ajRemain, pSrcbuf + ul4BytesPerScan, - ulBytesRemain); -write_dpPort (accel, *(unsigned int *)ajRemain); +if (bytes_remain) { +memcpy (remain, src_buf + words_per_scan, + bytes_remain); +write_dp_port (accel, *(unsigned int *)remain); } - pSrcbuf += srcDelta; + src_buf += src_delta; }return 0 ;
Signature · 1 line
2.43.0
Greg KH
maintainerQuoted 23 lines · Christine Ramacha
Variables in
sm750_accel.cfollow a mix of camelCase convention and hungarian shorthands. Rename it to adhere to kernel'ssnake_casenaming convention and improve readability.Signed-off-by Christine Ramacha <[email protected]>--- drivers/staging/sm750fb/sm750_accel.c | 116 +++++++++++++------------- 1 file changed, 58 insertions(+), 58 deletions(-)drivers/staging/sm750fb/sm750_accel.c +1
-1@@ -27,7 +27,7 @@ static inline u32 read_dpr(struct lynx_accel *accel, int offset)return readl (accel->dpr_base + offset); } -static inline void write_dpPort (struct lynx_accel *accel,u32 data) +static inline void write_dp_port (struct lynx_accel *accel,u32 data) {writel (data, accel->dp_port_base); }
drivers/staging/sm750fb/sm750_accel.c int sm750_hw_fillrect(struct lynx_accel *accel, · line 136
Quoted 7 lines
drivers/staging/sm750fb/sm750_accel.c +2
-2@@ -132,12 +132,12 @@ int sm750_hw_fillrect(struct lynx_accel *accel,/** * sm750_hw_copyarea * @accel: Acceleration device data -* @sBase: Address of source: offset in frame buffer -* @sPitch: Pitch value of source surface in BYTE +* @s_base: Address of source: offset in frame buffer +* @s_pitch: Pitch value of source surface in BYTE
Shouldn't these be source_base and source_pitch?
drivers/staging/sm750fb/sm750_accel.c int sm750_hw_fillrect(struct lynx_accel *accel, · line 140
Quoted 6 lines
drivers/staging/sm750fb/sm750_accel.c +2
-2* @sx: Starting x coordinate of source surface * @sy: Starting y coordinate of source surface -* @dBase: Address of destination: offset in frame buffer -* @dPitch: Pitch value of destination surface in BYTE +* @d_base: Address of destination: offset in frame buffer +* @d_pitch: Pitch value of destination surface in BYTE
Same here, dest_base and dest_pitch?
thanks,
greg k-h
PATCH 1/1 staging: sm750fb: Clean up variable names
Variables in sm750_accel.c follow a mix of camelCase convention and Hungarian shorthands. Rename it to adhere to kernel's snake_case naming convention and improve readability.
---
v2:
- Rename s_base/s_pitch to source_base/source_pitch
- Rename d_base/d_pitch to dest_base/dest_pitch
- Changed commit message spelling error
--- drivers/staging/sm750fb/sm750_accel.c | 116 +++++++++++++------------- 1 file changed, 58 insertions(+), 58 deletions(-)
drivers/staging/sm750fb/sm750_accel.c +58 -58
@@ -27,7 +27,7 @@ static inline u32 read_dpr(struct lynx_accel *accel, int offset)return readl (accel->dpr_base + offset); } -static inline void write_dpPort (struct lynx_accel *accel,u32 data) +static inline void write_dp_port (struct lynx_accel *accel,u32 data) {writel (data, accel->dp_port_base); }
@@ -132,12 +132,12 @@ int sm750_hw_fillrect(struct lynx_accel *accel,/** * sm750_hw_copyarea * @accel: Acceleration device data -* @sBase: Address of source: offset in frame buffer -* @sPitch: Pitch value of source surface in BYTE +* @source_base: Address of source: offset in frame buffer +* @source_pitch: Pitch value of source surface in BYTE * @sx: Starting x coordinate of source surface * @sy: Starting y coordinate of source surface -* @dBase: Address of destination: offset in frame buffer -* @dPitch: Pitch value of destination surface in BYTE +* @dest_base: Address of destination: offset in frame buffer +* @dest_pitch: Pitch value of destination surface in BYTE * @Bpp: Color depth of destination surface * @dx: Starting x coordinate of destination surface * @dy: Starting y coordinate of destination surface
@@ -146,21 +146,21 @@ int sm750_hw_fillrect(struct lynx_accel *accel,* @rop2: ROP value */ int sm750_hw_copyarea (struct lynx_accel *accel, -unsigned int sBase,unsigned int sPitch, +unsigned int source_base,unsigned int source_pitch,unsigned int sx,unsigned int sy, -unsigned int dBase,unsigned int dPitch, +unsigned int dest_base,unsigned int dest_pitch,unsigned int Bpp,unsigned int dx,unsigned int dy,unsigned int width,unsigned int height,unsigned int rop2) { -unsigned int nDirection, de_ctrl; +unsigned int direction, de_ctrl; - nDirection =LEFT_TO_RIGHT ; + direction =LEFT_TO_RIGHT ;/* Direction of ROP2 operation: 1 = Left to Right, (-1) = Right to Left */ de_ctrl =0 ;/* If source and destination are the same surface, need to check for overlay cases */ -if (sBase == dBase && sPitch == dPitch) { +if (source_base == dest_base && source_pitch == dest_pitch) {/* Determine direction of operation */ if (sy < dy) {/* +----------+
@@ -173,7 +173,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,* +----------+ */ - nDirection =BOTTOM_TO_TOP ; + direction =BOTTOM_TO_TOP ; }else if (sy > dy) {/* +----------+ * |D |
@@ -185,7 +185,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,* +----------+ */ - nDirection =TOP_TO_BOTTOM ; + direction =TOP_TO_BOTTOM ; }else {/* sy == dy */
@@ -198,7 +198,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,* +------+---+------+ */ - nDirection =RIGHT_TO_LEFT ; + direction =RIGHT_TO_LEFT ; }else {/* sx > dx */
@@ -210,12 +210,12 @@ int sm750_hw_copyarea(struct lynx_accel *accel,* +------+---+------+ */ - nDirection =LEFT_TO_RIGHT ; + direction =LEFT_TO_RIGHT ; } } } -if ((nDirection ==BOTTOM_TO_TOP ) || (nDirection ==RIGHT_TO_LEFT )) { +if ((direction ==BOTTOM_TO_TOP ) || (direction ==RIGHT_TO_LEFT )) { sx += width -1 ; sy += height -1 ; dx += width -1 ;
@@ -234,14 +234,14 @@ int sm750_hw_copyarea(struct lynx_accel *accel,* It is an address offset (128 bit aligned) * from the beginning of frame buffer. */ -write_dpr (accel,DE_WINDOW_SOURCE_BASE , sBase);/* dpr40 */ +write_dpr (accel,DE_WINDOW_SOURCE_BASE , source_base);/* dpr40 */ /* * 2D Destination Base. * It is an address offset (128 bit aligned) * from the beginning of frame buffer. */ -write_dpr (accel,DE_WINDOW_DESTINATION_BASE , dBase);/* dpr44 */ +write_dpr (accel,DE_WINDOW_DESTINATION_BASE , dest_base);/* dpr44 */ /* * Program pitch (distance between the 1st points of two adjacent lines).
@@ -249,9 +249,9 @@ int sm750_hw_copyarea(struct lynx_accel *accel,* pixel values. Need Byte to pixel conversion. */ write_dpr (accel,DE_PITCH , - ((dPitch / Bpp <<DE_PITCH_DESTINATION_SHIFT ) & + ((dest_pitch / Bpp <<DE_PITCH_DESTINATION_SHIFT ) &DE_PITCH_DESTINATION_MASK ) | - (sPitch / Bpp &DE_PITCH_SOURCE_MASK ));/* dpr10 */ + (source_pitch / Bpp &DE_PITCH_SOURCE_MASK ));/* dpr10 */ /* * Screen Window width in Pixels.
@@ -259,9 +259,9 @@ int sm750_hw_copyarea(struct lynx_accel *accel,* for a given point. */ write_dpr (accel,DE_WINDOW_WIDTH , - ((dPitch / Bpp <<DE_WINDOW_WIDTH_DST_SHIFT ) & + ((dest_pitch / Bpp <<DE_WINDOW_WIDTH_DST_SHIFT ) &DE_WINDOW_WIDTH_DST_MASK ) | - (sPitch / Bpp &DE_WINDOW_WIDTH_SRC_MASK ));/* dpr3c */ + (source_pitch / Bpp &DE_WINDOW_WIDTH_SRC_MASK ));/* dpr3c */ if (accel->de_wait () !=0 )return -1 ;
@@ -277,7 +277,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel, (height & DE_DIMENSION_Y_ET_MASK)); /* dpr08 */ de_ctrl = (rop2 &DE_CONTROL_ROP_MASK ) |DE_CONTROL_ROP_SELECT | - ((nDirection ==RIGHT_TO_LEFT ) ?DE_CONTROL_DIRECTION :0 ) | + ((direction ==RIGHT_TO_LEFT ) ?DE_CONTROL_DIRECTION :0 ) |DE_CONTROL_COMMAND_BITBLT |DE_CONTROL_STATUS ;write_dpr (accel,DE_CONTROL , de_ctrl);/* dpr0c */
@@ -299,38 +299,38 @@ static unsigned int de_get_transparency(struct lynx_accel *accel)/** * sm750_hw_imageblit * @accel: Acceleration device data -* @pSrcbuf: pointer to start of source buffer in system memory -* @srcDelta: Pitch value (in bytes) of the source buffer, +ive means top down +* @src_buf: pointer to start of source buffer in system memory +* @src_delta: Pitch value (in bytes) of the source buffer, +ive means top down * and -ive mean button up -* @startBit: Mono data can start at any bit in a byte, this value should be +* @start_bit: Mono data can start at any bit in a byte, this value should be * 0 to 7 -* @dBase: Address of destination: offset in frame buffer -* @dPitch: Pitch value of destination surface in BYTE -* @bytePerPixel: Color depth of destination surface +* @dest_base: Address of destination: offset in frame buffer +* @dest_pitch: Pitch value of destination surface in BYTE +* @byte_per_pixel: Color depth of destination surface * @dx: Starting x coordinate of destination surface * @dy: Starting y coordinate of destination surface * @width: width of rectangle in pixel value * @height: height of rectangle in pixel value -* @fColor: Foreground color (corresponding to a 1 in the monochrome data -* @bColor: Background color (corresponding to a 0 in the monochrome data +* @fg_color: Foreground color (corresponding to a 1 in the monochrome data +* @bg_color: Background color (corresponding to a 0 in the monochrome data * @rop2: ROP value */ -int sm750_hw_imageblit (struct lynx_accel *accel,const char *pSrcbuf, -u32 srcDelta,u32 startBit,u32 dBase,u32 dPitch, -u32 bytePerPixel,u32 dx,u32 dy,u32 width, -u32 height,u32 fColor,u32 bColor,u32 rop2) +int sm750_hw_imageblit (struct lynx_accel *accel,const char *src_buf, +u32 src_delta,u32 start_bit,u32 dest_base,u32 dest_pitch, +u32 byte_per_pixel,u32 dx,u32 dy,u32 width, +u32 height,u32 fg_color,u32 bg_color,u32 rop2) { -unsigned int ulBytesPerScan; -unsigned int ul4BytesPerScan; -unsigned int ulBytesRemain; +unsigned int bytes_per_scan; +unsigned int words_per_scan; +unsigned int bytes_remain;unsigned int de_ctrl =0 ; -unsigned char ajRemain[4 ]; +unsigned char remain[4 ];int i, j; - startBit &=7 ;/* Just make sure the start bit is within legal range */ - ulBytesPerScan = (width + startBit +7 ) /8 ; - ul4BytesPerScan = ulBytesPerScan & ~3 ; - ulBytesRemain = ulBytesPerScan &3 ; + start_bit &=7 ;/* Just make sure the start bit is within legal range */ + bytes_per_scan = (width + start_bit +7 ) /8 ; + words_per_scan = bytes_per_scan & ~3 ; + bytes_remain = bytes_per_scan &3 ;if (accel->de_wait () !=0 )return -1 ;
@@ -345,7 +345,7 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,* It is an address offset (128 bit aligned) * from the beginning of frame buffer. */ -write_dpr (accel,DE_WINDOW_DESTINATION_BASE , dBase); +write_dpr (accel,DE_WINDOW_DESTINATION_BASE , dest_base);/* * Program pitch (distance between the 1st points of two adjacent
@@ -353,9 +353,9 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,* register uses pixel values. Need Byte to pixel conversion. */ write_dpr (accel,DE_PITCH , - ((dPitch / bytePerPixel <<DE_PITCH_DESTINATION_SHIFT ) & + ((dest_pitch / byte_per_pixel <<DE_PITCH_DESTINATION_SHIFT ) &DE_PITCH_DESTINATION_MASK ) | - (dPitch / bytePerPixel &DE_PITCH_SOURCE_MASK ));/* dpr10 */ + (dest_pitch / byte_per_pixel &DE_PITCH_SOURCE_MASK ));/* dpr10 */ /* * Screen Window width in Pixels.
@@ -363,17 +363,17 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,* in frame buffer for a given point. */ write_dpr (accel,DE_WINDOW_WIDTH , - ((dPitch / bytePerPixel <<DE_WINDOW_WIDTH_DST_SHIFT ) & + ((dest_pitch / byte_per_pixel <<DE_WINDOW_WIDTH_DST_SHIFT ) &DE_WINDOW_WIDTH_DST_MASK ) | - (dPitch / bytePerPixel &DE_WINDOW_WIDTH_SRC_MASK )); + (dest_pitch / byte_per_pixel &DE_WINDOW_WIDTH_SRC_MASK ));/* * Note: For 2D Source in Host Write, only X_K1_MONO field is needed, * and Y_K2 field is not used. -* For mono bitmap, use startBit for X_K1. +* For mono bitmap, use start_bit for X_K1. */ write_dpr (accel,DE_SOURCE , - (startBit <<DE_SOURCE_X_K1_SHIFT ) & + (start_bit <<DE_SOURCE_X_K1_SHIFT ) &DE_SOURCE_X_K1_MONO_MASK );/* dpr00 */ write_dpr(accel, DE_DESTINATION,
@@ -384,8 +384,8 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf, ((width <<DE_DIMENSION_X_SHIFT ) &DE_DIMENSION_X_MASK ) | (height & DE_DIMENSION_Y_ET_MASK)); /* dpr08 */ -write_dpr (accel,DE_FOREGROUND , fColor); -write_dpr (accel,DE_BACKGROUND , bColor); +write_dpr (accel,DE_FOREGROUND , fg_color); +write_dpr (accel,DE_BACKGROUND , bg_color); de_ctrl = (rop2 &DE_CONTROL_ROP_MASK ) | DE_CONTROL_ROP_SELECT | DE_CONTROL_COMMAND_HOST_WRITE |
@@ -396,16 +396,16 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,/* Write MONO data (line by line) to 2D Engine data port */ for (i =0 ; i < height; i++) {/* For each line, send the data in chunks of 4 bytes */ -for (j =0 ; j < (ul4BytesPerScan /4 ); j++) -write_dpPort (accel, *(unsigned int *)(pSrcbuf + (j *4 ))); +for (j =0 ; j < (words_per_scan /4 ); j++) +write_dp_port (accel, *(unsigned int *)(src_buf + (j *4 ))); -if (ulBytesRemain) { -memcpy (ajRemain, pSrcbuf + ul4BytesPerScan, - ulBytesRemain); -write_dpPort (accel, *(unsigned int *)ajRemain); +if (bytes_remain) { +memcpy (remain, src_buf + words_per_scan, + bytes_remain); +write_dp_port (accel, *(unsigned int *)remain); } - pSrcbuf += srcDelta; + src_buf += src_delta; }return 0 ;
Signature · 1 line
2.43.0
PATCH v2 1/1 staging: sm750fb: Clean up variable names
In reply to Greg KHVariables in sm750_accel.c follow a mix of camelCase convention and Hungarian shorthands. Rename it to adhere to kernel's snake_case naming convention and improve readability.
---
v2:
- Rename s_base/s_pitch to source_base/source_pitch
- Rename d_base/d_pitch to dest_base/dest_pitch
- Changed commit message spelling error
--- drivers/staging/sm750fb/sm750_accel.c | 116 +++++++++++++------------- 1 file changed, 58 insertions(+), 58 deletions(-)
drivers/staging/sm750fb/sm750_accel.c +58 -58
@@ -27,7 +27,7 @@ static inline u32 read_dpr(struct lynx_accel *accel, int offset)return readl (accel->dpr_base + offset); } -static inline void write_dpPort (struct lynx_accel *accel,u32 data) +static inline void write_dp_port (struct lynx_accel *accel,u32 data) {writel (data, accel->dp_port_base); }
@@ -132,12 +132,12 @@ int sm750_hw_fillrect(struct lynx_accel *accel,/** * sm750_hw_copyarea * @accel: Acceleration device data -* @sBase: Address of source: offset in frame buffer -* @sPitch: Pitch value of source surface in BYTE +* @source_base: Address of source: offset in frame buffer +* @source_pitch: Pitch value of source surface in BYTE * @sx: Starting x coordinate of source surface * @sy: Starting y coordinate of source surface -* @dBase: Address of destination: offset in frame buffer -* @dPitch: Pitch value of destination surface in BYTE +* @dest_base: Address of destination: offset in frame buffer +* @dest_pitch: Pitch value of destination surface in BYTE * @Bpp: Color depth of destination surface * @dx: Starting x coordinate of destination surface * @dy: Starting y coordinate of destination surface
@@ -146,21 +146,21 @@ int sm750_hw_fillrect(struct lynx_accel *accel,* @rop2: ROP value */ int sm750_hw_copyarea (struct lynx_accel *accel, -unsigned int sBase,unsigned int sPitch, +unsigned int source_base,unsigned int source_pitch,unsigned int sx,unsigned int sy, -unsigned int dBase,unsigned int dPitch, +unsigned int dest_base,unsigned int dest_pitch,unsigned int Bpp,unsigned int dx,unsigned int dy,unsigned int width,unsigned int height,unsigned int rop2) { -unsigned int nDirection, de_ctrl; +unsigned int direction, de_ctrl; - nDirection =LEFT_TO_RIGHT ; + direction =LEFT_TO_RIGHT ;/* Direction of ROP2 operation: 1 = Left to Right, (-1) = Right to Left */ de_ctrl =0 ;/* If source and destination are the same surface, need to check for overlay cases */ -if (sBase == dBase && sPitch == dPitch) { +if (source_base == dest_base && source_pitch == dest_pitch) {/* Determine direction of operation */ if (sy < dy) {/* +----------+
@@ -173,7 +173,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,* +----------+ */ - nDirection =BOTTOM_TO_TOP ; + direction =BOTTOM_TO_TOP ; }else if (sy > dy) {/* +----------+ * |D |
@@ -185,7 +185,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,* +----------+ */ - nDirection =TOP_TO_BOTTOM ; + direction =TOP_TO_BOTTOM ; }else {/* sy == dy */
@@ -198,7 +198,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,* +------+---+------+ */ - nDirection =RIGHT_TO_LEFT ; + direction =RIGHT_TO_LEFT ; }else {/* sx > dx */
@@ -210,12 +210,12 @@ int sm750_hw_copyarea(struct lynx_accel *accel,* +------+---+------+ */ - nDirection =LEFT_TO_RIGHT ; + direction =LEFT_TO_RIGHT ; } } } -if ((nDirection ==BOTTOM_TO_TOP ) || (nDirection ==RIGHT_TO_LEFT )) { +if ((direction ==BOTTOM_TO_TOP ) || (direction ==RIGHT_TO_LEFT )) { sx += width -1 ; sy += height -1 ; dx += width -1 ;
@@ -234,14 +234,14 @@ int sm750_hw_copyarea(struct lynx_accel *accel,* It is an address offset (128 bit aligned) * from the beginning of frame buffer. */ -write_dpr (accel,DE_WINDOW_SOURCE_BASE , sBase);/* dpr40 */ +write_dpr (accel,DE_WINDOW_SOURCE_BASE , source_base);/* dpr40 */ /* * 2D Destination Base. * It is an address offset (128 bit aligned) * from the beginning of frame buffer. */ -write_dpr (accel,DE_WINDOW_DESTINATION_BASE , dBase);/* dpr44 */ +write_dpr (accel,DE_WINDOW_DESTINATION_BASE , dest_base);/* dpr44 */ /* * Program pitch (distance between the 1st points of two adjacent lines).
@@ -249,9 +249,9 @@ int sm750_hw_copyarea(struct lynx_accel *accel,* pixel values. Need Byte to pixel conversion. */ write_dpr (accel,DE_PITCH , - ((dPitch / Bpp <<DE_PITCH_DESTINATION_SHIFT ) & + ((dest_pitch / Bpp <<DE_PITCH_DESTINATION_SHIFT ) &DE_PITCH_DESTINATION_MASK ) | - (sPitch / Bpp &DE_PITCH_SOURCE_MASK ));/* dpr10 */ + (source_pitch / Bpp &DE_PITCH_SOURCE_MASK ));/* dpr10 */ /* * Screen Window width in Pixels.
@@ -259,9 +259,9 @@ int sm750_hw_copyarea(struct lynx_accel *accel,* for a given point. */ write_dpr (accel,DE_WINDOW_WIDTH , - ((dPitch / Bpp <<DE_WINDOW_WIDTH_DST_SHIFT ) & + ((dest_pitch / Bpp <<DE_WINDOW_WIDTH_DST_SHIFT ) &DE_WINDOW_WIDTH_DST_MASK ) | - (sPitch / Bpp &DE_WINDOW_WIDTH_SRC_MASK ));/* dpr3c */ + (source_pitch / Bpp &DE_WINDOW_WIDTH_SRC_MASK ));/* dpr3c */ if (accel->de_wait () !=0 )return -1 ;
@@ -277,7 +277,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel, (height & DE_DIMENSION_Y_ET_MASK)); /* dpr08 */ de_ctrl = (rop2 &DE_CONTROL_ROP_MASK ) |DE_CONTROL_ROP_SELECT | - ((nDirection ==RIGHT_TO_LEFT ) ?DE_CONTROL_DIRECTION :0 ) | + ((direction ==RIGHT_TO_LEFT ) ?DE_CONTROL_DIRECTION :0 ) |DE_CONTROL_COMMAND_BITBLT |DE_CONTROL_STATUS ;write_dpr (accel,DE_CONTROL , de_ctrl);/* dpr0c */
@@ -299,38 +299,38 @@ static unsigned int de_get_transparency(struct lynx_accel *accel)/** * sm750_hw_imageblit * @accel: Acceleration device data -* @pSrcbuf: pointer to start of source buffer in system memory -* @srcDelta: Pitch value (in bytes) of the source buffer, +ive means top down +* @src_buf: pointer to start of source buffer in system memory +* @src_delta: Pitch value (in bytes) of the source buffer, +ive means top down * and -ive mean button up -* @startBit: Mono data can start at any bit in a byte, this value should be +* @start_bit: Mono data can start at any bit in a byte, this value should be * 0 to 7 -* @dBase: Address of destination: offset in frame buffer -* @dPitch: Pitch value of destination surface in BYTE -* @bytePerPixel: Color depth of destination surface +* @dest_base: Address of destination: offset in frame buffer +* @dest_pitch: Pitch value of destination surface in BYTE +* @byte_per_pixel: Color depth of destination surface * @dx: Starting x coordinate of destination surface * @dy: Starting y coordinate of destination surface * @width: width of rectangle in pixel value * @height: height of rectangle in pixel value -* @fColor: Foreground color (corresponding to a 1 in the monochrome data -* @bColor: Background color (corresponding to a 0 in the monochrome data +* @fg_color: Foreground color (corresponding to a 1 in the monochrome data +* @bg_color: Background color (corresponding to a 0 in the monochrome data * @rop2: ROP value */ -int sm750_hw_imageblit (struct lynx_accel *accel,const char *pSrcbuf, -u32 srcDelta,u32 startBit,u32 dBase,u32 dPitch, -u32 bytePerPixel,u32 dx,u32 dy,u32 width, -u32 height,u32 fColor,u32 bColor,u32 rop2) +int sm750_hw_imageblit (struct lynx_accel *accel,const char *src_buf, +u32 src_delta,u32 start_bit,u32 dest_base,u32 dest_pitch, +u32 byte_per_pixel,u32 dx,u32 dy,u32 width, +u32 height,u32 fg_color,u32 bg_color,u32 rop2) { -unsigned int ulBytesPerScan; -unsigned int ul4BytesPerScan; -unsigned int ulBytesRemain; +unsigned int bytes_per_scan; +unsigned int words_per_scan; +unsigned int bytes_remain;unsigned int de_ctrl =0 ; -unsigned char ajRemain[4 ]; +unsigned char remain[4 ];int i, j; - startBit &=7 ;/* Just make sure the start bit is within legal range */ - ulBytesPerScan = (width + startBit +7 ) /8 ; - ul4BytesPerScan = ulBytesPerScan & ~3 ; - ulBytesRemain = ulBytesPerScan &3 ; + start_bit &=7 ;/* Just make sure the start bit is within legal range */ + bytes_per_scan = (width + start_bit +7 ) /8 ; + words_per_scan = bytes_per_scan & ~3 ; + bytes_remain = bytes_per_scan &3 ;if (accel->de_wait () !=0 )return -1 ;
@@ -345,7 +345,7 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,* It is an address offset (128 bit aligned) * from the beginning of frame buffer. */ -write_dpr (accel,DE_WINDOW_DESTINATION_BASE , dBase); +write_dpr (accel,DE_WINDOW_DESTINATION_BASE , dest_base);/* * Program pitch (distance between the 1st points of two adjacent
@@ -353,9 +353,9 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,* register uses pixel values. Need Byte to pixel conversion. */ write_dpr (accel,DE_PITCH , - ((dPitch / bytePerPixel <<DE_PITCH_DESTINATION_SHIFT ) & + ((dest_pitch / byte_per_pixel <<DE_PITCH_DESTINATION_SHIFT ) &DE_PITCH_DESTINATION_MASK ) | - (dPitch / bytePerPixel &DE_PITCH_SOURCE_MASK ));/* dpr10 */ + (dest_pitch / byte_per_pixel &DE_PITCH_SOURCE_MASK ));/* dpr10 */ /* * Screen Window width in Pixels.
@@ -363,17 +363,17 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,* in frame buffer for a given point. */ write_dpr (accel,DE_WINDOW_WIDTH , - ((dPitch / bytePerPixel <<DE_WINDOW_WIDTH_DST_SHIFT ) & + ((dest_pitch / byte_per_pixel <<DE_WINDOW_WIDTH_DST_SHIFT ) &DE_WINDOW_WIDTH_DST_MASK ) | - (dPitch / bytePerPixel &DE_WINDOW_WIDTH_SRC_MASK )); + (dest_pitch / byte_per_pixel &DE_WINDOW_WIDTH_SRC_MASK ));/* * Note: For 2D Source in Host Write, only X_K1_MONO field is needed, * and Y_K2 field is not used. -* For mono bitmap, use startBit for X_K1. +* For mono bitmap, use start_bit for X_K1. */ write_dpr (accel,DE_SOURCE , - (startBit <<DE_SOURCE_X_K1_SHIFT ) & + (start_bit <<DE_SOURCE_X_K1_SHIFT ) &DE_SOURCE_X_K1_MONO_MASK );/* dpr00 */ write_dpr(accel, DE_DESTINATION,
@@ -384,8 +384,8 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf, ((width <<DE_DIMENSION_X_SHIFT ) &DE_DIMENSION_X_MASK ) | (height & DE_DIMENSION_Y_ET_MASK)); /* dpr08 */ -write_dpr (accel,DE_FOREGROUND , fColor); -write_dpr (accel,DE_BACKGROUND , bColor); +write_dpr (accel,DE_FOREGROUND , fg_color); +write_dpr (accel,DE_BACKGROUND , bg_color); de_ctrl = (rop2 &DE_CONTROL_ROP_MASK ) | DE_CONTROL_ROP_SELECT | DE_CONTROL_COMMAND_HOST_WRITE |
@@ -396,16 +396,16 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,/* Write MONO data (line by line) to 2D Engine data port */ for (i =0 ; i < height; i++) {/* For each line, send the data in chunks of 4 bytes */ -for (j =0 ; j < (ul4BytesPerScan /4 ); j++) -write_dpPort (accel, *(unsigned int *)(pSrcbuf + (j *4 ))); +for (j =0 ; j < (words_per_scan /4 ); j++) +write_dp_port (accel, *(unsigned int *)(src_buf + (j *4 ))); -if (ulBytesRemain) { -memcpy (ajRemain, pSrcbuf + ul4BytesPerScan, - ulBytesRemain); -write_dpPort (accel, *(unsigned int *)ajRemain); +if (bytes_remain) { +memcpy (remain, src_buf + words_per_scan, + bytes_remain); +write_dp_port (accel, *(unsigned int *)remain); } - pSrcbuf += srcDelta; + src_buf += src_delta; }return 0 ;
Signature · 1 line
2.43.0