Skip to content

Commit ab67d4c

Browse files
Chris-ops4573gregkh
authored andcommitted
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. Signed-off-by: Christine Ramacha <christine.rv4573@gmail.com> Link: https://patch.msgid.link/20260204145107.5521-1-christine.rv4573@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 41460a1 commit ab67d4c

1 file changed

Lines changed: 58 additions & 58 deletions

File tree

drivers/staging/sm750fb/sm750_accel.c

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static inline u32 read_dpr(struct lynx_accel *accel, int offset)
2727
return readl(accel->dpr_base + offset);
2828
}
2929

30-
static inline void write_dpPort(struct lynx_accel *accel, u32 data)
30+
static inline void write_dp_port(struct lynx_accel *accel, u32 data)
3131
{
3232
writel(data, accel->dp_port_base);
3333
}
@@ -132,12 +132,12 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
132132
/**
133133
* sm750_hw_copyarea
134134
* @accel: Acceleration device data
135-
* @sBase: Address of source: offset in frame buffer
136-
* @sPitch: Pitch value of source surface in BYTE
135+
* @source_base: Address of source: offset in frame buffer
136+
* @source_pitch: Pitch value of source surface in BYTE
137137
* @sx: Starting x coordinate of source surface
138138
* @sy: Starting y coordinate of source surface
139-
* @dBase: Address of destination: offset in frame buffer
140-
* @dPitch: Pitch value of destination surface in BYTE
139+
* @dest_base: Address of destination: offset in frame buffer
140+
* @dest_pitch: Pitch value of destination surface in BYTE
141141
* @Bpp: Color depth of destination surface
142142
* @dx: Starting x coordinate of destination surface
143143
* @dy: Starting y coordinate of destination surface
@@ -146,21 +146,21 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
146146
* @rop2: ROP value
147147
*/
148148
int sm750_hw_copyarea(struct lynx_accel *accel,
149-
unsigned int sBase, unsigned int sPitch,
149+
unsigned int source_base, unsigned int source_pitch,
150150
unsigned int sx, unsigned int sy,
151-
unsigned int dBase, unsigned int dPitch,
151+
unsigned int dest_base, unsigned int dest_pitch,
152152
unsigned int Bpp, unsigned int dx, unsigned int dy,
153153
unsigned int width, unsigned int height,
154154
unsigned int rop2)
155155
{
156-
unsigned int nDirection, de_ctrl;
156+
unsigned int direction, de_ctrl;
157157

158-
nDirection = LEFT_TO_RIGHT;
158+
direction = LEFT_TO_RIGHT;
159159
/* Direction of ROP2 operation: 1 = Left to Right, (-1) = Right to Left */
160160
de_ctrl = 0;
161161

162162
/* If source and destination are the same surface, need to check for overlay cases */
163-
if (sBase == dBase && sPitch == dPitch) {
163+
if (source_base == dest_base && source_pitch == dest_pitch) {
164164
/* Determine direction of operation */
165165
if (sy < dy) {
166166
/* +----------+
@@ -173,7 +173,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
173173
* +----------+
174174
*/
175175

176-
nDirection = BOTTOM_TO_TOP;
176+
direction = BOTTOM_TO_TOP;
177177
} else if (sy > dy) {
178178
/* +----------+
179179
* |D |
@@ -185,7 +185,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
185185
* +----------+
186186
*/
187187

188-
nDirection = TOP_TO_BOTTOM;
188+
direction = TOP_TO_BOTTOM;
189189
} else {
190190
/* sy == dy */
191191

@@ -198,7 +198,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
198198
* +------+---+------+
199199
*/
200200

201-
nDirection = RIGHT_TO_LEFT;
201+
direction = RIGHT_TO_LEFT;
202202
} else {
203203
/* sx > dx */
204204

@@ -210,12 +210,12 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
210210
* +------+---+------+
211211
*/
212212

213-
nDirection = LEFT_TO_RIGHT;
213+
direction = LEFT_TO_RIGHT;
214214
}
215215
}
216216
}
217217

218-
if ((nDirection == BOTTOM_TO_TOP) || (nDirection == RIGHT_TO_LEFT)) {
218+
if ((direction == BOTTOM_TO_TOP) || (direction == RIGHT_TO_LEFT)) {
219219
sx += width - 1;
220220
sy += height - 1;
221221
dx += width - 1;
@@ -234,34 +234,34 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
234234
* It is an address offset (128 bit aligned)
235235
* from the beginning of frame buffer.
236236
*/
237-
write_dpr(accel, DE_WINDOW_SOURCE_BASE, sBase); /* dpr40 */
237+
write_dpr(accel, DE_WINDOW_SOURCE_BASE, source_base); /* dpr40 */
238238

239239
/*
240240
* 2D Destination Base.
241241
* It is an address offset (128 bit aligned)
242242
* from the beginning of frame buffer.
243243
*/
244-
write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dBase); /* dpr44 */
244+
write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dest_base); /* dpr44 */
245245

246246
/*
247247
* Program pitch (distance between the 1st points of two adjacent lines).
248248
* Note that input pitch is BYTE value, but the 2D Pitch register uses
249249
* pixel values. Need Byte to pixel conversion.
250250
*/
251251
write_dpr(accel, DE_PITCH,
252-
((dPitch / Bpp << DE_PITCH_DESTINATION_SHIFT) &
252+
((dest_pitch / Bpp << DE_PITCH_DESTINATION_SHIFT) &
253253
DE_PITCH_DESTINATION_MASK) |
254-
(sPitch / Bpp & DE_PITCH_SOURCE_MASK)); /* dpr10 */
254+
(source_pitch / Bpp & DE_PITCH_SOURCE_MASK)); /* dpr10 */
255255

256256
/*
257257
* Screen Window width in Pixels.
258258
* 2D engine uses this value to calculate the linear address in frame buffer
259259
* for a given point.
260260
*/
261261
write_dpr(accel, DE_WINDOW_WIDTH,
262-
((dPitch / Bpp << DE_WINDOW_WIDTH_DST_SHIFT) &
262+
((dest_pitch / Bpp << DE_WINDOW_WIDTH_DST_SHIFT) &
263263
DE_WINDOW_WIDTH_DST_MASK) |
264-
(sPitch / Bpp & DE_WINDOW_WIDTH_SRC_MASK)); /* dpr3c */
264+
(source_pitch / Bpp & DE_WINDOW_WIDTH_SRC_MASK)); /* dpr3c */
265265

266266
if (accel->de_wait() != 0)
267267
return -1;
@@ -277,7 +277,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
277277
(height & DE_DIMENSION_Y_ET_MASK)); /* dpr08 */
278278

279279
de_ctrl = (rop2 & DE_CONTROL_ROP_MASK) | DE_CONTROL_ROP_SELECT |
280-
((nDirection == RIGHT_TO_LEFT) ? DE_CONTROL_DIRECTION : 0) |
280+
((direction == RIGHT_TO_LEFT) ? DE_CONTROL_DIRECTION : 0) |
281281
DE_CONTROL_COMMAND_BITBLT | DE_CONTROL_STATUS;
282282
write_dpr(accel, DE_CONTROL, de_ctrl); /* dpr0c */
283283

@@ -299,38 +299,38 @@ static unsigned int de_get_transparency(struct lynx_accel *accel)
299299
/**
300300
* sm750_hw_imageblit
301301
* @accel: Acceleration device data
302-
* @pSrcbuf: pointer to start of source buffer in system memory
303-
* @srcDelta: Pitch value (in bytes) of the source buffer, +ive means top down
302+
* @src_buf: pointer to start of source buffer in system memory
303+
* @src_delta: Pitch value (in bytes) of the source buffer, +ive means top down
304304
* and -ive mean button up
305-
* @startBit: Mono data can start at any bit in a byte, this value should be
305+
* @start_bit: Mono data can start at any bit in a byte, this value should be
306306
* 0 to 7
307-
* @dBase: Address of destination: offset in frame buffer
308-
* @dPitch: Pitch value of destination surface in BYTE
309-
* @bytePerPixel: Color depth of destination surface
307+
* @dest_base: Address of destination: offset in frame buffer
308+
* @dest_pitch: Pitch value of destination surface in BYTE
309+
* @byte_per_pixel: Color depth of destination surface
310310
* @dx: Starting x coordinate of destination surface
311311
* @dy: Starting y coordinate of destination surface
312312
* @width: width of rectangle in pixel value
313313
* @height: height of rectangle in pixel value
314-
* @fColor: Foreground color (corresponding to a 1 in the monochrome data
315-
* @bColor: Background color (corresponding to a 0 in the monochrome data
314+
* @fg_color: Foreground color (corresponding to a 1 in the monochrome data
315+
* @bg_color: Background color (corresponding to a 0 in the monochrome data
316316
* @rop2: ROP value
317317
*/
318-
int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,
319-
u32 srcDelta, u32 startBit, u32 dBase, u32 dPitch,
320-
u32 bytePerPixel, u32 dx, u32 dy, u32 width,
321-
u32 height, u32 fColor, u32 bColor, u32 rop2)
318+
int sm750_hw_imageblit(struct lynx_accel *accel, const char *src_buf,
319+
u32 src_delta, u32 start_bit, u32 dest_base, u32 dest_pitch,
320+
u32 byte_per_pixel, u32 dx, u32 dy, u32 width,
321+
u32 height, u32 fg_color, u32 bg_color, u32 rop2)
322322
{
323-
unsigned int ulBytesPerScan;
324-
unsigned int ul4BytesPerScan;
325-
unsigned int ulBytesRemain;
323+
unsigned int bytes_per_scan;
324+
unsigned int words_per_scan;
325+
unsigned int bytes_remain;
326326
unsigned int de_ctrl = 0;
327-
unsigned char ajRemain[4];
327+
unsigned char remain[4];
328328
int i, j;
329329

330-
startBit &= 7; /* Just make sure the start bit is within legal range */
331-
ulBytesPerScan = (width + startBit + 7) / 8;
332-
ul4BytesPerScan = ulBytesPerScan & ~3;
333-
ulBytesRemain = ulBytesPerScan & 3;
330+
start_bit &= 7; /* Just make sure the start bit is within legal range */
331+
bytes_per_scan = (width + start_bit + 7) / 8;
332+
words_per_scan = bytes_per_scan & ~3;
333+
bytes_remain = bytes_per_scan & 3;
334334

335335
if (accel->de_wait() != 0)
336336
return -1;
@@ -345,35 +345,35 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,
345345
* It is an address offset (128 bit aligned)
346346
* from the beginning of frame buffer.
347347
*/
348-
write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dBase);
348+
write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dest_base);
349349

350350
/*
351351
* Program pitch (distance between the 1st points of two adjacent
352352
* lines). Note that input pitch is BYTE value, but the 2D Pitch
353353
* register uses pixel values. Need Byte to pixel conversion.
354354
*/
355355
write_dpr(accel, DE_PITCH,
356-
((dPitch / bytePerPixel << DE_PITCH_DESTINATION_SHIFT) &
356+
((dest_pitch / byte_per_pixel << DE_PITCH_DESTINATION_SHIFT) &
357357
DE_PITCH_DESTINATION_MASK) |
358-
(dPitch / bytePerPixel & DE_PITCH_SOURCE_MASK)); /* dpr10 */
358+
(dest_pitch / byte_per_pixel & DE_PITCH_SOURCE_MASK)); /* dpr10 */
359359

360360
/*
361361
* Screen Window width in Pixels.
362362
* 2D engine uses this value to calculate the linear address
363363
* in frame buffer for a given point.
364364
*/
365365
write_dpr(accel, DE_WINDOW_WIDTH,
366-
((dPitch / bytePerPixel << DE_WINDOW_WIDTH_DST_SHIFT) &
366+
((dest_pitch / byte_per_pixel << DE_WINDOW_WIDTH_DST_SHIFT) &
367367
DE_WINDOW_WIDTH_DST_MASK) |
368-
(dPitch / bytePerPixel & DE_WINDOW_WIDTH_SRC_MASK));
368+
(dest_pitch / byte_per_pixel & DE_WINDOW_WIDTH_SRC_MASK));
369369

370370
/*
371371
* Note: For 2D Source in Host Write, only X_K1_MONO field is needed,
372372
* and Y_K2 field is not used.
373-
* For mono bitmap, use startBit for X_K1.
373+
* For mono bitmap, use start_bit for X_K1.
374374
*/
375375
write_dpr(accel, DE_SOURCE,
376-
(startBit << DE_SOURCE_X_K1_SHIFT) &
376+
(start_bit << DE_SOURCE_X_K1_SHIFT) &
377377
DE_SOURCE_X_K1_MONO_MASK); /* dpr00 */
378378

379379
write_dpr(accel, DE_DESTINATION,
@@ -384,8 +384,8 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,
384384
((width << DE_DIMENSION_X_SHIFT) & DE_DIMENSION_X_MASK) |
385385
(height & DE_DIMENSION_Y_ET_MASK)); /* dpr08 */
386386

387-
write_dpr(accel, DE_FOREGROUND, fColor);
388-
write_dpr(accel, DE_BACKGROUND, bColor);
387+
write_dpr(accel, DE_FOREGROUND, fg_color);
388+
write_dpr(accel, DE_BACKGROUND, bg_color);
389389

390390
de_ctrl = (rop2 & DE_CONTROL_ROP_MASK) |
391391
DE_CONTROL_ROP_SELECT | DE_CONTROL_COMMAND_HOST_WRITE |
@@ -396,16 +396,16 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,
396396
/* Write MONO data (line by line) to 2D Engine data port */
397397
for (i = 0; i < height; i++) {
398398
/* For each line, send the data in chunks of 4 bytes */
399-
for (j = 0; j < (ul4BytesPerScan / 4); j++)
400-
write_dpPort(accel, *(unsigned int *)(pSrcbuf + (j * 4)));
399+
for (j = 0; j < (words_per_scan / 4); j++)
400+
write_dp_port(accel, *(unsigned int *)(src_buf + (j * 4)));
401401

402-
if (ulBytesRemain) {
403-
memcpy(ajRemain, pSrcbuf + ul4BytesPerScan,
404-
ulBytesRemain);
405-
write_dpPort(accel, *(unsigned int *)ajRemain);
402+
if (bytes_remain) {
403+
memcpy(remain, src_buf + words_per_scan,
404+
bytes_remain);
405+
write_dp_port(accel, *(unsigned int *)remain);
406406
}
407407

408-
pSrcbuf += srcDelta;
408+
src_buf += src_delta;
409409
}
410410

411411
return 0;

0 commit comments

Comments
 (0)