* [PATCH] Staging: sm750fb: Fix coding style issue in ddk750_sii164.c
@ 2017-11-25 17:59 ` Jeremy Lacomis
0 siblings, 0 replies; 16+ messages in thread
From: Jeremy Lacomis @ 2017-11-25 17:59 UTC (permalink / raw)
To: sudipm.mukherjee, teddy.wang, gregkh
Cc: linux-fbdev, devel, linux-kernel, Jeremy Lacomis
This is a patch to the ddk750_sii164.c file that fixes line length warnings
found by the checkpatch.pl script
Signed-off-by: Jeremy Lacomis <j.lacomis@gmail.com>
---
drivers/staging/sm750fb/ddk750_sii164.c | 39 +++++++++++++++++++--------------
1 file changed, 23 insertions(+), 16 deletions(-)
diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c
index c787a74c4f9c..d081ecbb3e3d 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.c
+++ b/drivers/staging/sm750fb/ddk750_sii164.c
@@ -39,8 +39,10 @@ unsigned short sii164GetVendorID(void)
{
unsigned short vendorID;
- vendorID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_HIGH) << 8) |
- (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_LOW);
+ vendorID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS,
+ SII164_VENDOR_ID_HIGH) << 8) |
+ (unsigned short) i2cReadReg(SII164_I2C_ADDRESS,
+ SII164_VENDOR_ID_LOW);
return vendorID;
}
@@ -56,15 +58,20 @@ unsigned short sii164GetDeviceID(void)
{
unsigned short deviceID;
- deviceID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_HIGH) << 8) |
- (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_LOW);
+ deviceID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS,
+ SII164_DEVICE_ID_HIGH) << 8) |
+ (unsigned short) i2cReadReg(SII164_I2C_ADDRESS,
+ SII164_DEVICE_ID_LOW);
return deviceID;
}
-/* DVI.C will handle all SiI164 chip stuffs and try it best to make code minimal and useful */
+/*
+ * DVI.C will handle all SiI164 chip stuffs and try it best to make code minimal
+ * and useful
+ */
/*
* sii164InitChip
@@ -72,10 +79,10 @@ unsigned short sii164GetDeviceID(void)
*
* Input:
* edgeSelect - Edge Select:
- * 0 = Input data is falling edge latched (falling edge
- * latched first in dual edge mode)
- * 1 = Input data is rising edge latched (rising edge
- * latched first in dual edge mode)
+ * 0 = Input data is falling edge latched (falling
+ * edge latched first in dual edge mode)
+ * 1 = Input data is rising edge latched (rising
+ * edge latched first in dual edge mode)
* busSelect - Input Bus Select:
* 0 = Input data bus is 12-bits wide
* 1 = Input data bus is 24-bits wide
@@ -135,7 +142,8 @@ long sii164InitChip(unsigned char edgeSelect,
#endif
/* Check if SII164 Chip exists */
- if ((sii164GetVendorID() == SII164_VENDOR_ID) && (sii164GetDeviceID() == SII164_DEVICE_ID)) {
+ if ((sii164GetVendorID() == SII164_VENDOR_ID) &&
+ (sii164GetDeviceID() == SII164_DEVICE_ID)) {
/*
* Initialize SII164 controller chip.
*/
@@ -260,8 +268,8 @@ void sii164ResetChip(void)
/*
* sii164GetChipString
- * This function returns a char string name of the current DVI Controller chip.
- * It's convenient for application need to display the chip name.
+ * This function returns a char string name of the current DVI Controller
+ * chip. It's convenient for application need to display the chip name.
*/
char *sii164GetChipString(void)
{
@@ -336,8 +344,9 @@ void sii164EnableHotPlugDetection(unsigned char enableHotPlug)
detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT);
- /* Depending on each DVI controller, need to enable the hot plug based on each
- * individual chip design.
+ /*
+ * Depending on each DVI controller, need to enable the hot plug based
+ * on each individual chip design.
*/
if (enableHotPlug != 0)
sii164SelectHotPlugDetectionMode(SII164_HOTPLUG_USE_MDI);
@@ -402,5 +411,3 @@ void sii164ClearInterrupt(void)
#endif
#endif
-
-
--
2.11.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH] Staging: sm750fb: Fix coding style issue in ddk750_sii164.c
@ 2017-11-25 17:59 ` Jeremy Lacomis
0 siblings, 0 replies; 16+ messages in thread
From: Jeremy Lacomis @ 2017-11-25 17:59 UTC (permalink / raw)
To: sudipm.mukherjee, teddy.wang, gregkh
Cc: linux-fbdev, devel, linux-kernel, Jeremy Lacomis
This is a patch to the ddk750_sii164.c file that fixes line length warnings
found by the checkpatch.pl script
Signed-off-by: Jeremy Lacomis <j.lacomis@gmail.com>
---
drivers/staging/sm750fb/ddk750_sii164.c | 39 +++++++++++++++++++--------------
1 file changed, 23 insertions(+), 16 deletions(-)
diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c
index c787a74c4f9c..d081ecbb3e3d 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.c
+++ b/drivers/staging/sm750fb/ddk750_sii164.c
@@ -39,8 +39,10 @@ unsigned short sii164GetVendorID(void)
{
unsigned short vendorID;
- vendorID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_HIGH) << 8) |
- (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_LOW);
+ vendorID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS,
+ SII164_VENDOR_ID_HIGH) << 8) |
+ (unsigned short) i2cReadReg(SII164_I2C_ADDRESS,
+ SII164_VENDOR_ID_LOW);
return vendorID;
}
@@ -56,15 +58,20 @@ unsigned short sii164GetDeviceID(void)
{
unsigned short deviceID;
- deviceID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_HIGH) << 8) |
- (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_LOW);
+ deviceID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS,
+ SII164_DEVICE_ID_HIGH) << 8) |
+ (unsigned short) i2cReadReg(SII164_I2C_ADDRESS,
+ SII164_DEVICE_ID_LOW);
return deviceID;
}
-/* DVI.C will handle all SiI164 chip stuffs and try it best to make code minimal and useful */
+/*
+ * DVI.C will handle all SiI164 chip stuffs and try it best to make code minimal
+ * and useful
+ */
/*
* sii164InitChip
@@ -72,10 +79,10 @@ unsigned short sii164GetDeviceID(void)
*
* Input:
* edgeSelect - Edge Select:
- * 0 = Input data is falling edge latched (falling edge
- * latched first in dual edge mode)
- * 1 = Input data is rising edge latched (rising edge
- * latched first in dual edge mode)
+ * 0 = Input data is falling edge latched (falling
+ * edge latched first in dual edge mode)
+ * 1 = Input data is rising edge latched (rising
+ * edge latched first in dual edge mode)
* busSelect - Input Bus Select:
* 0 = Input data bus is 12-bits wide
* 1 = Input data bus is 24-bits wide
@@ -135,7 +142,8 @@ long sii164InitChip(unsigned char edgeSelect,
#endif
/* Check if SII164 Chip exists */
- if ((sii164GetVendorID() = SII164_VENDOR_ID) && (sii164GetDeviceID() = SII164_DEVICE_ID)) {
+ if ((sii164GetVendorID() = SII164_VENDOR_ID) &&
+ (sii164GetDeviceID() = SII164_DEVICE_ID)) {
/*
* Initialize SII164 controller chip.
*/
@@ -260,8 +268,8 @@ void sii164ResetChip(void)
/*
* sii164GetChipString
- * This function returns a char string name of the current DVI Controller chip.
- * It's convenient for application need to display the chip name.
+ * This function returns a char string name of the current DVI Controller
+ * chip. It's convenient for application need to display the chip name.
*/
char *sii164GetChipString(void)
{
@@ -336,8 +344,9 @@ void sii164EnableHotPlugDetection(unsigned char enableHotPlug)
detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT);
- /* Depending on each DVI controller, need to enable the hot plug based on each
- * individual chip design.
+ /*
+ * Depending on each DVI controller, need to enable the hot plug based
+ * on each individual chip design.
*/
if (enableHotPlug != 0)
sii164SelectHotPlugDetectionMode(SII164_HOTPLUG_USE_MDI);
@@ -402,5 +411,3 @@ void sii164ClearInterrupt(void)
#endif
#endif
-
-
--
2.11.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH] Staging: sm750fb: Fix coding style issue in ddk750_sii164.c
2017-11-25 17:59 ` Jeremy Lacomis
@ 2017-11-25 22:36 ` Joe Perches
-1 siblings, 0 replies; 16+ messages in thread
From: Joe Perches @ 2017-11-25 22:36 UTC (permalink / raw)
To: Jeremy Lacomis, sudipm.mukherjee, teddy.wang, gregkh
Cc: linux-fbdev, devel, linux-kernel
On Sat, 2017-11-25 at 12:59 -0500, Jeremy Lacomis wrote:
> This is a patch to the ddk750_sii164.c file that fixes line length warnings
> found by the checkpatch.pl script
>
> Signed-off-by: Jeremy Lacomis <j.lacomis@gmail.com>
> ---
> drivers/staging/sm750fb/ddk750_sii164.c | 39 +++++++++++++++++++--------------
> 1 file changed, 23 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c
> index c787a74c4f9c..d081ecbb3e3d 100644
> --- a/drivers/staging/sm750fb/ddk750_sii164.c
> +++ b/drivers/staging/sm750fb/ddk750_sii164.c
> @@ -39,8 +39,10 @@ unsigned short sii164GetVendorID(void)
> {
> unsigned short vendorID;
>
> - vendorID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_HIGH) << 8) |
> - (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_LOW);
> + vendorID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS,
> + SII164_VENDOR_ID_HIGH) << 8) |
> + (unsigned short) i2cReadReg(SII164_I2C_ADDRESS,
> + SII164_VENDOR_ID_LOW);
>
> return vendorID;
> }
> @@ -56,15 +58,20 @@ unsigned short sii164GetDeviceID(void)
> {
> unsigned short deviceID;
>
> - deviceID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_HIGH) << 8) |
> - (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_LOW);
> + deviceID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS,
> + SII164_DEVICE_ID_HIGH) << 8) |
> + (unsigned short) i2cReadReg(SII164_I2C_ADDRESS,
> + SII164_DEVICE_ID_LOW);
>
> return deviceID;
> }
i2cReadReg is always used with SII154_I2C_ADDRESS.
Perhaps it'd be better to redefine i2cReadReg to something else.
i2cReadReg also returns an unsigned char so this cast isn't
particularly sensible.
Perhaps something like:
#define sii164_i2c_read_reg(reg) i2cReadReg(SII164_I2C_ADDRESS, reg)
device_id = sii164_i2c_read_reg(SII164_DEVICE_ID_HIGH) << 8 |
sii164_i2c_read_reg(SII164_DEVICE_ID_LOW);
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Staging: sm750fb: Fix coding style issue in ddk750_sii164.c
@ 2017-11-25 22:36 ` Joe Perches
0 siblings, 0 replies; 16+ messages in thread
From: Joe Perches @ 2017-11-25 22:36 UTC (permalink / raw)
To: Jeremy Lacomis, sudipm.mukherjee, teddy.wang, gregkh
Cc: linux-fbdev, devel, linux-kernel
On Sat, 2017-11-25 at 12:59 -0500, Jeremy Lacomis wrote:
> This is a patch to the ddk750_sii164.c file that fixes line length warnings
> found by the checkpatch.pl script
>
> Signed-off-by: Jeremy Lacomis <j.lacomis@gmail.com>
> ---
> drivers/staging/sm750fb/ddk750_sii164.c | 39 +++++++++++++++++++--------------
> 1 file changed, 23 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c
> index c787a74c4f9c..d081ecbb3e3d 100644
> --- a/drivers/staging/sm750fb/ddk750_sii164.c
> +++ b/drivers/staging/sm750fb/ddk750_sii164.c
> @@ -39,8 +39,10 @@ unsigned short sii164GetVendorID(void)
> {
> unsigned short vendorID;
>
> - vendorID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_HIGH) << 8) |
> - (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_LOW);
> + vendorID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS,
> + SII164_VENDOR_ID_HIGH) << 8) |
> + (unsigned short) i2cReadReg(SII164_I2C_ADDRESS,
> + SII164_VENDOR_ID_LOW);
>
> return vendorID;
> }
> @@ -56,15 +58,20 @@ unsigned short sii164GetDeviceID(void)
> {
> unsigned short deviceID;
>
> - deviceID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_HIGH) << 8) |
> - (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_LOW);
> + deviceID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS,
> + SII164_DEVICE_ID_HIGH) << 8) |
> + (unsigned short) i2cReadReg(SII164_I2C_ADDRESS,
> + SII164_DEVICE_ID_LOW);
>
> return deviceID;
> }
i2cReadReg is always used with SII154_I2C_ADDRESS.
Perhaps it'd be better to redefine i2cReadReg to something else.
i2cReadReg also returns an unsigned char so this cast isn't
particularly sensible.
Perhaps something like:
#define sii164_i2c_read_reg(reg) i2cReadReg(SII164_I2C_ADDRESS, reg)
device_id = sii164_i2c_read_reg(SII164_DEVICE_ID_HIGH) << 8 |
sii164_i2c_read_reg(SII164_DEVICE_ID_LOW);
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2] staging: sm750b: Fix coding style issues in sm750_accel.c
2017-11-25 22:36 ` Joe Perches
@ 2017-11-25 22:48 ` Jeremy Lacomis
-1 siblings, 0 replies; 16+ messages in thread
From: Jeremy Lacomis @ 2017-11-25 22:48 UTC (permalink / raw)
Cc: Jeremy Lacomis, Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman,
linux-fbdev, devel, linux-kernel
This is a patch to sm750_accel.c that fixes 80-character line length
warnings found by checkpatch.pl. It also fixes some grammatical errors
in comments and moves parameter-specific comments from inline to before
the function.
Signed-off-by: Jeremy Lacomis <j.lacomis@gmail.com>
---
Changes in v2:
- Change function comments to the kernel-doc format
drivers/staging/sm750fb/sm750_accel.c | 189 ++++++++++++++++++----------------
1 file changed, 103 insertions(+), 86 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c
index 1035e91e7cd3..42cd920111bf 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
@@ -68,11 +68,10 @@ void sm750_hw_de_init(struct lynx_accel *accel)
}
/*
- * set2dformat only be called from setmode functions
- * but if you need dual framebuffer driver,need call set2dformat
- * every time you use 2d function
+ * set2dformat can only be called from setmode functions, but if you need a dual
+ * framebuffer driver, set2dformat must be called every time a 2D function is
+ * used
*/
-
void sm750_hw_set2dformat(struct lynx_accel *accel, int fmt)
{
u32 reg;
@@ -94,7 +93,7 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
if (accel->de_wait() != 0) {
/*
- * int time wait and always busy,seems hardware
+ * int time wait and always busy, seems hardware
* got something error
*/
pr_debug("De engine always busy\n");
@@ -130,80 +129,88 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
return 0;
}
-int sm750_hw_copyarea(
-struct lynx_accel *accel,
-unsigned int sBase, /* Address of source: offset in frame buffer */
-unsigned int sPitch, /* Pitch value of source surface in BYTE */
-unsigned int sx,
-unsigned int sy, /* Starting coordinate of source surface */
-unsigned int dBase, /* Address of destination: offset in frame buffer */
-unsigned int dPitch, /* Pitch value of destination surface in BYTE */
-unsigned int Bpp, /* Color depth of destination surface */
-unsigned int dx,
-unsigned int dy, /* Starting coordinate of destination surface */
-unsigned int width,
-unsigned int height, /* width and height of rectangle in pixel value */
-unsigned int rop2) /* ROP value */
+/**
+ * sm750_hw_copyarea()
+ * @sBase: Address of the source offset in the frame buffer
+ * @sPitch: Pitch value of the source surface in BYTE
+ * @sx: Starting x-coordinate of the source surface
+ * @sy: Starting y-coordinate of the source surface
+ * @dBase: Address of the destination offset in the frame buffer
+ * @dPitch: Pitch value of the destination surface in BYTE
+ * @Bpp: Color depth of the destination surface
+ * @dx: Starting x-coordinate of the destination surface
+ * @dy: Starting y-coordinate of the destination surface
+ * @width: Width of the rectangle in pixels
+ * @height: Height of the rectangle in pixels
+ * @rop2: ROP value
+ */
+int sm750_hw_copyarea(struct lynx_accel *accel, unsigned int sBase,
+ unsigned int sPitch, unsigned int sx, unsigned int sy,
+ unsigned int dBase, unsigned int dPitch, unsigned int Bpp,
+ unsigned int dx, unsigned int dy, unsigned int width,
+ unsigned int height, unsigned int rop2)
{
unsigned int nDirection, de_ctrl;
nDirection = LEFT_TO_RIGHT;
- /* Direction of ROP2 operation: 1 = Left to Right, (-1) = Right to Left */
+ /*
+ * 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 the source and destination are the same surface, need to check for
+ * overlay cases
+ */
if (sBase == dBase && sPitch == dPitch) {
/* Determine direction of operation */
- if (sy < dy) {
- /* +----------+
- * |S |
- * | +----------+
- * | | | |
- * | | | |
- * +---|------+ |
- * | D|
- * +----------+
- */
+ /* +----------+
+ * |S |
+ * | +----------+
+ * | | | |
+ * | | | |
+ * +---|------+ |
+ * | D|
+ * +----------+
+ */
+ if (sy < dy) {
nDirection = BOTTOM_TO_TOP;
- } else if (sy > dy) {
- /* +----------+
- * |D |
- * | +----------+
- * | | | |
- * | | | |
- * +---|------+ |
- * | S|
- * +----------+
- */
+ /* +----------+
+ * |D |
+ * | +----------+
+ * | | | |
+ * | | | |
+ * +---|------+ |
+ * | S|
+ * +----------+
+ */
+ } else if (sy > dy) {
nDirection = TOP_TO_BOTTOM;
- } else {
- /* sy == dy */
-
- if (sx <= dx) {
- /* +------+---+------+
- * |S | | D|
- * | | | |
- * | | | |
- * | | | |
- * +------+---+------+
- */
+ } else {
+ /* +------+---+------+
+ * |S | | D|
+ * | | | |
+ * | | | |
+ * | | | |
+ * +------+---+------+
+ */
+ if (sx <= dx)
nDirection = RIGHT_TO_LEFT;
- } else {
- /* sx > dx */
-
- /* +------+---+------+
- * |D | | S|
- * | | | |
- * | | | |
- * | | | |
- * +------+---+------+
- */
+ /* +------+---+------+
+ * |D | | S|
+ * | | | |
+ * | | | |
+ * | | | |
+ * +------+---+------+
+ */
+ else
nDirection = LEFT_TO_RIGHT;
- }
}
}
@@ -288,20 +295,28 @@ static unsigned int deGetTransparency(struct lynx_accel *accel)
return de_ctrl;
}
-int sm750_hw_imageblit(struct lynx_accel *accel,
- const char *pSrcbuf, /* pointer to start of source buffer in system memory */
- u32 srcDelta, /* Pitch value (in bytes) of the source buffer, +ive means top down and -ive mean button up */
- u32 startBit, /* Mono data can start at any bit in a byte, this value should be 0 to 7 */
- u32 dBase, /* Address of destination: offset in frame buffer */
- u32 dPitch, /* Pitch value of destination surface in BYTE */
- u32 bytePerPixel, /* Color depth of destination surface */
- u32 dx,
- u32 dy, /* Starting coordinate of destination surface */
- u32 width,
- u32 height, /* width and height of rectangle in pixel value */
- u32 fColor, /* Foreground color (corresponding to a 1 in the monochrome data */
- u32 bColor, /* Background color (corresponding to a 0 in the monochrome data */
- u32 rop2) /* ROP value */
+/**
+ * sm750_hw_imageblit()
+ * @pSrcbuf: Start of the source buffer in system memory
+ * @srcDelta: Pitch value of the source buffer in bytes. A positive value means
+ * top-down, while a negative value means bottom-up
+ * @startBit: Mono data can start at any bit in a byte, this value should be in
+ * the range 0-7
+ * @dBase: Address of the destination offset in the frame buffer
+ * @dPitch: Pitch value of the destination surface in BYTE
+ * @bytePerPixel: Color depth of the destination surface
+ * @dx: Starting x-coordinate of the destination surface
+ * @dy: Starting y-coordinate of the destination surface
+ * @width: Width of the rectangle in pixels
+ * @height: Height of the rectangle in pixels
+ * @fColor: Foreground color (cooresponding to a 1 in monochrome data)
+ * @bColor: Background color (corresponding to a 0 in 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)
{
unsigned int ulBytesPerScan;
unsigned int ul4BytesPerScan;
@@ -310,7 +325,8 @@ int sm750_hw_imageblit(struct lynx_accel *accel,
unsigned char ajRemain[4];
int i, j;
- startBit &= 7; /* Just make sure the start bit is within legal range */
+ /* Make sure that the start bit is within legal range */
+ startBit &= 7;
ulBytesPerScan = (width + startBit + 7) / 8;
ul4BytesPerScan = ulBytesPerScan & ~3;
ulBytesRemain = ulBytesPerScan & 3;
@@ -324,9 +340,9 @@ int sm750_hw_imageblit(struct lynx_accel *accel,
*/
write_dpr(accel, DE_WINDOW_SOURCE_BASE, 0);
- /* 2D Destination Base.
- * It is an address offset (128 bit aligned)
- * from the beginning of frame buffer.
+ /*
+ * 2D Destination Base.
+ * 128 bit aligned offset from the beginning of frame buffer.
*/
write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dBase);
@@ -352,8 +368,7 @@ int sm750_hw_imageblit(struct lynx_accel *accel,
/*
* 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.
+ * and Y_K2 field is not used. For mono bitmap, use startBit for X_K1.
*/
write_dpr(accel, DE_SOURCE,
(startBit << DE_SOURCE_X_K1_SHIFT) &
@@ -380,10 +395,12 @@ int sm750_hw_imageblit(struct lynx_accel *accel,
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)));
+ write_dpPort(accel,
+ *(unsigned int *)(pSrcbuf + (j * 4)));
if (ulBytesRemain) {
- memcpy(ajRemain, pSrcbuf+ul4BytesPerScan, ulBytesRemain);
+ memcpy(ajRemain, pSrcbuf + ul4BytesPerScan,
+ ulBytesRemain);
write_dpPort(accel, *(unsigned int *)ajRemain);
}
--
2.11.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2] staging: sm750b: Fix coding style issues in sm750_accel.c
@ 2017-11-25 22:48 ` Jeremy Lacomis
0 siblings, 0 replies; 16+ messages in thread
From: Jeremy Lacomis @ 2017-11-25 22:48 UTC (permalink / raw)
Cc: Jeremy Lacomis, Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman,
linux-fbdev, devel, linux-kernel
This is a patch to sm750_accel.c that fixes 80-character line length
warnings found by checkpatch.pl. It also fixes some grammatical errors
in comments and moves parameter-specific comments from inline to before
the function.
Signed-off-by: Jeremy Lacomis <j.lacomis@gmail.com>
---
Changes in v2:
- Change function comments to the kernel-doc format
drivers/staging/sm750fb/sm750_accel.c | 189 ++++++++++++++++++----------------
1 file changed, 103 insertions(+), 86 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c
index 1035e91e7cd3..42cd920111bf 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
@@ -68,11 +68,10 @@ void sm750_hw_de_init(struct lynx_accel *accel)
}
/*
- * set2dformat only be called from setmode functions
- * but if you need dual framebuffer driver,need call set2dformat
- * every time you use 2d function
+ * set2dformat can only be called from setmode functions, but if you need a dual
+ * framebuffer driver, set2dformat must be called every time a 2D function is
+ * used
*/
-
void sm750_hw_set2dformat(struct lynx_accel *accel, int fmt)
{
u32 reg;
@@ -94,7 +93,7 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
if (accel->de_wait() != 0) {
/*
- * int time wait and always busy,seems hardware
+ * int time wait and always busy, seems hardware
* got something error
*/
pr_debug("De engine always busy\n");
@@ -130,80 +129,88 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
return 0;
}
-int sm750_hw_copyarea(
-struct lynx_accel *accel,
-unsigned int sBase, /* Address of source: offset in frame buffer */
-unsigned int sPitch, /* Pitch value of source surface in BYTE */
-unsigned int sx,
-unsigned int sy, /* Starting coordinate of source surface */
-unsigned int dBase, /* Address of destination: offset in frame buffer */
-unsigned int dPitch, /* Pitch value of destination surface in BYTE */
-unsigned int Bpp, /* Color depth of destination surface */
-unsigned int dx,
-unsigned int dy, /* Starting coordinate of destination surface */
-unsigned int width,
-unsigned int height, /* width and height of rectangle in pixel value */
-unsigned int rop2) /* ROP value */
+/**
+ * sm750_hw_copyarea()
+ * @sBase: Address of the source offset in the frame buffer
+ * @sPitch: Pitch value of the source surface in BYTE
+ * @sx: Starting x-coordinate of the source surface
+ * @sy: Starting y-coordinate of the source surface
+ * @dBase: Address of the destination offset in the frame buffer
+ * @dPitch: Pitch value of the destination surface in BYTE
+ * @Bpp: Color depth of the destination surface
+ * @dx: Starting x-coordinate of the destination surface
+ * @dy: Starting y-coordinate of the destination surface
+ * @width: Width of the rectangle in pixels
+ * @height: Height of the rectangle in pixels
+ * @rop2: ROP value
+ */
+int sm750_hw_copyarea(struct lynx_accel *accel, unsigned int sBase,
+ unsigned int sPitch, unsigned int sx, unsigned int sy,
+ unsigned int dBase, unsigned int dPitch, unsigned int Bpp,
+ unsigned int dx, unsigned int dy, unsigned int width,
+ unsigned int height, unsigned int rop2)
{
unsigned int nDirection, de_ctrl;
nDirection = LEFT_TO_RIGHT;
- /* Direction of ROP2 operation: 1 = Left to Right, (-1) = Right to Left */
+ /*
+ * 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 the source and destination are the same surface, need to check for
+ * overlay cases
+ */
if (sBase = dBase && sPitch = dPitch) {
/* Determine direction of operation */
- if (sy < dy) {
- /* +----------+
- * |S |
- * | +----------+
- * | | | |
- * | | | |
- * +---|------+ |
- * | D|
- * +----------+
- */
+ /* +----------+
+ * |S |
+ * | +----------+
+ * | | | |
+ * | | | |
+ * +---|------+ |
+ * | D|
+ * +----------+
+ */
+ if (sy < dy) {
nDirection = BOTTOM_TO_TOP;
- } else if (sy > dy) {
- /* +----------+
- * |D |
- * | +----------+
- * | | | |
- * | | | |
- * +---|------+ |
- * | S|
- * +----------+
- */
+ /* +----------+
+ * |D |
+ * | +----------+
+ * | | | |
+ * | | | |
+ * +---|------+ |
+ * | S|
+ * +----------+
+ */
+ } else if (sy > dy) {
nDirection = TOP_TO_BOTTOM;
- } else {
- /* sy = dy */
-
- if (sx <= dx) {
- /* +------+---+------+
- * |S | | D|
- * | | | |
- * | | | |
- * | | | |
- * +------+---+------+
- */
+ } else {
+ /* +------+---+------+
+ * |S | | D|
+ * | | | |
+ * | | | |
+ * | | | |
+ * +------+---+------+
+ */
+ if (sx <= dx)
nDirection = RIGHT_TO_LEFT;
- } else {
- /* sx > dx */
-
- /* +------+---+------+
- * |D | | S|
- * | | | |
- * | | | |
- * | | | |
- * +------+---+------+
- */
+ /* +------+---+------+
+ * |D | | S|
+ * | | | |
+ * | | | |
+ * | | | |
+ * +------+---+------+
+ */
+ else
nDirection = LEFT_TO_RIGHT;
- }
}
}
@@ -288,20 +295,28 @@ static unsigned int deGetTransparency(struct lynx_accel *accel)
return de_ctrl;
}
-int sm750_hw_imageblit(struct lynx_accel *accel,
- const char *pSrcbuf, /* pointer to start of source buffer in system memory */
- u32 srcDelta, /* Pitch value (in bytes) of the source buffer, +ive means top down and -ive mean button up */
- u32 startBit, /* Mono data can start at any bit in a byte, this value should be 0 to 7 */
- u32 dBase, /* Address of destination: offset in frame buffer */
- u32 dPitch, /* Pitch value of destination surface in BYTE */
- u32 bytePerPixel, /* Color depth of destination surface */
- u32 dx,
- u32 dy, /* Starting coordinate of destination surface */
- u32 width,
- u32 height, /* width and height of rectangle in pixel value */
- u32 fColor, /* Foreground color (corresponding to a 1 in the monochrome data */
- u32 bColor, /* Background color (corresponding to a 0 in the monochrome data */
- u32 rop2) /* ROP value */
+/**
+ * sm750_hw_imageblit()
+ * @pSrcbuf: Start of the source buffer in system memory
+ * @srcDelta: Pitch value of the source buffer in bytes. A positive value means
+ * top-down, while a negative value means bottom-up
+ * @startBit: Mono data can start at any bit in a byte, this value should be in
+ * the range 0-7
+ * @dBase: Address of the destination offset in the frame buffer
+ * @dPitch: Pitch value of the destination surface in BYTE
+ * @bytePerPixel: Color depth of the destination surface
+ * @dx: Starting x-coordinate of the destination surface
+ * @dy: Starting y-coordinate of the destination surface
+ * @width: Width of the rectangle in pixels
+ * @height: Height of the rectangle in pixels
+ * @fColor: Foreground color (cooresponding to a 1 in monochrome data)
+ * @bColor: Background color (corresponding to a 0 in 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)
{
unsigned int ulBytesPerScan;
unsigned int ul4BytesPerScan;
@@ -310,7 +325,8 @@ int sm750_hw_imageblit(struct lynx_accel *accel,
unsigned char ajRemain[4];
int i, j;
- startBit &= 7; /* Just make sure the start bit is within legal range */
+ /* Make sure that the start bit is within legal range */
+ startBit &= 7;
ulBytesPerScan = (width + startBit + 7) / 8;
ul4BytesPerScan = ulBytesPerScan & ~3;
ulBytesRemain = ulBytesPerScan & 3;
@@ -324,9 +340,9 @@ int sm750_hw_imageblit(struct lynx_accel *accel,
*/
write_dpr(accel, DE_WINDOW_SOURCE_BASE, 0);
- /* 2D Destination Base.
- * It is an address offset (128 bit aligned)
- * from the beginning of frame buffer.
+ /*
+ * 2D Destination Base.
+ * 128 bit aligned offset from the beginning of frame buffer.
*/
write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dBase);
@@ -352,8 +368,7 @@ int sm750_hw_imageblit(struct lynx_accel *accel,
/*
* 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.
+ * and Y_K2 field is not used. For mono bitmap, use startBit for X_K1.
*/
write_dpr(accel, DE_SOURCE,
(startBit << DE_SOURCE_X_K1_SHIFT) &
@@ -380,10 +395,12 @@ int sm750_hw_imageblit(struct lynx_accel *accel,
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)));
+ write_dpPort(accel,
+ *(unsigned int *)(pSrcbuf + (j * 4)));
if (ulBytesRemain) {
- memcpy(ajRemain, pSrcbuf+ul4BytesPerScan, ulBytesRemain);
+ memcpy(ajRemain, pSrcbuf + ul4BytesPerScan,
+ ulBytesRemain);
write_dpPort(accel, *(unsigned int *)ajRemain);
}
--
2.11.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2] Staging: sm750fb: Fix coding style issue in ddk750_sii164.c
2017-11-25 22:36 ` Joe Perches
@ 2017-11-26 1:04 ` Jeremy Lacomis
-1 siblings, 0 replies; 16+ messages in thread
From: Jeremy Lacomis @ 2017-11-26 1:04 UTC (permalink / raw)
Cc: Jeremy Lacomis, Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman,
linux-fbdev, devel, linux-kernel
This is a patch to the ddk750_sii164.c file that fixes line length warnings
found by the checkpatch.pl script
Signed-off-by: Jeremy Lacomis <j.lacomis@gmail.com>
---
Changes in v2:
- Change definition of i2cReadReg/i2cWriteReg
- Remove unnecessary casts
drivers/staging/sm750fb/ddk750_sii164.c | 87 ++++++++++++++++-----------------
1 file changed, 43 insertions(+), 44 deletions(-)
diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c
index c787a74c4f9c..66092c4645fc 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.c
+++ b/drivers/staging/sm750fb/ddk750_sii164.c
@@ -12,11 +12,13 @@
#define USE_HW_I2C
#ifdef USE_HW_I2C
- #define i2cWriteReg sm750_hw_i2c_write_reg
- #define i2cReadReg sm750_hw_i2c_read_reg
+#define i2c_write_reg(reg, config) sm750_hw_i2c_write_reg(SII164_I2C_ADDRESS, \
+ reg, config)
+#define i2c_read_reg(reg) sm750_hw_i2c_read_reg(SII164_I2C_ADDRESS, reg)
#else
- #define i2cWriteReg sm750_sw_i2c_write_reg
- #define i2cReadReg sm750_sw_i2c_read_reg
+#define i2c_write_reg(reg, config) sm750_sw_i2c_write_reg(SII164_I2C_ADDRESS, \
+ reg, config)
+#define i2c_read_reg(reg) sm750_sw_i2c_read_reg(SII164_I2C_ADDRESS, reg)
#endif
/* SII164 Vendor and Device ID */
@@ -39,8 +41,8 @@ unsigned short sii164GetVendorID(void)
{
unsigned short vendorID;
- vendorID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_HIGH) << 8) |
- (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_LOW);
+ vendorID = (i2c_read_reg(SII164_VENDOR_ID_HIGH) << 8) |
+ i2c_read_reg(SII164_VENDOR_ID_LOW);
return vendorID;
}
@@ -56,15 +58,16 @@ unsigned short sii164GetDeviceID(void)
{
unsigned short deviceID;
- deviceID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_HIGH) << 8) |
- (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_LOW);
+ deviceID = (i2c_read_reg(SII164_DEVICE_ID_HIGH) << 8) |
+ i2c_read_reg(SII164_DEVICE_ID_LOW);
return deviceID;
}
-
-
-/* DVI.C will handle all SiI164 chip stuffs and try it best to make code minimal and useful */
+/*
+ * DVI.C will handle all SiI164 chip stuffs and try it best to make code minimal
+ * and useful
+ */
/*
* sii164InitChip
@@ -72,10 +75,10 @@ unsigned short sii164GetDeviceID(void)
*
* Input:
* edgeSelect - Edge Select:
- * 0 = Input data is falling edge latched (falling edge
- * latched first in dual edge mode)
- * 1 = Input data is rising edge latched (rising edge
- * latched first in dual edge mode)
+ * 0 = Input data is falling edge latched (falling
+ * edge latched first in dual edge mode)
+ * 1 = Input data is rising edge latched (rising
+ * edge latched first in dual edge mode)
* busSelect - Input Bus Select:
* 0 = Input data bus is 12-bits wide
* 1 = Input data bus is 24-bits wide
@@ -135,7 +138,8 @@ long sii164InitChip(unsigned char edgeSelect,
#endif
/* Check if SII164 Chip exists */
- if ((sii164GetVendorID() == SII164_VENDOR_ID) && (sii164GetDeviceID() == SII164_DEVICE_ID)) {
+ if ((sii164GetVendorID() == SII164_VENDOR_ID) &&
+ (sii164GetDeviceID() == SII164_DEVICE_ID)) {
/*
* Initialize SII164 controller chip.
*/
@@ -170,7 +174,7 @@ long sii164InitChip(unsigned char edgeSelect,
else
config |= SII164_CONFIGURATION_VSYNC_AS_IS;
- i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config);
+ i2c_write_reg(SII164_CONFIGURATION, config);
/*
* De-skew enabled with default 111b value.
@@ -208,7 +212,7 @@ long sii164InitChip(unsigned char edgeSelect,
config |= SII164_DESKEW_8_STEP;
break;
}
- i2cWriteReg(SII164_I2C_ADDRESS, SII164_DESKEW, config);
+ i2c_write_reg(SII164_DESKEW, config);
/* Enable/Disable Continuous Sync. */
if (continuousSyncEnable == 0)
@@ -225,12 +229,12 @@ long sii164InitChip(unsigned char edgeSelect,
/* Set the PLL Filter value */
config |= ((pllFilterValue & 0x07) << 1);
- i2cWriteReg(SII164_I2C_ADDRESS, SII164_PLL, config);
+ i2c_write_reg(SII164_PLL, config);
/* Recover from Power Down and enable output. */
- config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION);
+ config = i2c_read_reg(SII164_CONFIGURATION);
config |= SII164_CONFIGURATION_POWER_NORMAL;
- i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config);
+ i2c_write_reg(SII164_CONFIGURATION, config);
return 0;
}
@@ -239,10 +243,6 @@ long sii164InitChip(unsigned char edgeSelect,
return -1;
}
-
-
-
-
/* below sii164 function is not necessary */
#ifdef SII164_FULL_FUNCTIONS
@@ -260,8 +260,8 @@ void sii164ResetChip(void)
/*
* sii164GetChipString
- * This function returns a char string name of the current DVI Controller chip.
- * It's convenient for application need to display the chip name.
+ * This function returns a char string name of the current DVI Controller
+ * chip. It's convenient for application need to display the chip name.
*/
char *sii164GetChipString(void)
{
@@ -279,17 +279,17 @@ void sii164SetPower(unsigned char powerUp)
{
unsigned char config;
- config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION);
+ config = i2c_read_reg(SII164_CONFIGURATION);
if (powerUp == 1) {
/* Power up the chip */
config &= ~SII164_CONFIGURATION_POWER_MASK;
config |= SII164_CONFIGURATION_POWER_NORMAL;
- i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config);
+ i2c_write_reg(SII164_CONFIGURATION, config);
} else {
/* Power down the chip */
config &= ~SII164_CONFIGURATION_POWER_MASK;
config |= SII164_CONFIGURATION_POWER_DOWN;
- i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config);
+ i2c_write_reg(SII164_CONFIGURATION, config);
}
}
@@ -302,7 +302,7 @@ void sii164SelectHotPlugDetectionMode(enum sii164_hot_plug_mode hotPlugMode)
{
unsigned char detectReg;
- detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) &
+ detectReg = i2c_read_reg(SII164_DETECT) &
~SII164_DETECT_MONITOR_SENSE_OUTPUT_FLAG;
switch (hotPlugMode) {
case SII164_HOTPLUG_DISABLE:
@@ -321,7 +321,7 @@ void sii164SelectHotPlugDetectionMode(enum sii164_hot_plug_mode hotPlugMode)
break;
}
- i2cWriteReg(SII164_I2C_ADDRESS, SII164_DETECT, detectReg);
+ i2c_write_reg(SII164_DETECT, detectReg);
}
/*
@@ -334,10 +334,11 @@ void sii164EnableHotPlugDetection(unsigned char enableHotPlug)
{
unsigned char detectReg;
- detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT);
+ detectReg = i2c_read_reg(SII164_DETECT);
- /* Depending on each DVI controller, need to enable the hot plug based on each
- * individual chip design.
+ /*
+ * Depending on each DVI controller, need to enable the hot plug based
+ * on each individual chip design.
*/
if (enableHotPlug != 0)
sii164SelectHotPlugDetectionMode(SII164_HOTPLUG_USE_MDI);
@@ -357,7 +358,7 @@ unsigned char sii164IsConnected(void)
{
unsigned char hotPlugValue;
- hotPlugValue = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) &
+ hotPlugValue = i2c_read_reg(SII164_DETECT) &
SII164_DETECT_HOT_PLUG_STATUS_MASK;
if (hotPlugValue == SII164_DETECT_HOT_PLUG_STATUS_ON)
return 1;
@@ -377,7 +378,7 @@ unsigned char sii164CheckInterrupt(void)
{
unsigned char detectReg;
- detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) &
+ detectReg = i2c_read_reg(SII164_DETECT) &
SII164_DETECT_MONITOR_STATE_MASK;
if (detectReg == SII164_DETECT_MONITOR_STATE_CHANGE)
return 1;
@@ -394,13 +395,11 @@ void sii164ClearInterrupt(void)
unsigned char detectReg;
/* Clear the MDI interrupt */
- detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT);
- i2cWriteReg(SII164_I2C_ADDRESS, SII164_DETECT,
- detectReg | SII164_DETECT_MONITOR_STATE_CLEAR);
+ detectReg = i2c_read_reg(SII164_DETECT);
+ i2c_write_reg(SII164_DETECT,
+ detectReg | SII164_DETECT_MONITOR_STATE_CLEAR);
}
-#endif
-
-#endif
-
+#endif /* SII164_FULL_FUNCTIONS */
+#endif /* USE_DVICHIP */
--
2.11.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2] Staging: sm750fb: Fix coding style issue in ddk750_sii164.c
@ 2017-11-26 1:04 ` Jeremy Lacomis
0 siblings, 0 replies; 16+ messages in thread
From: Jeremy Lacomis @ 2017-11-26 1:04 UTC (permalink / raw)
Cc: Jeremy Lacomis, Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman,
linux-fbdev, devel, linux-kernel
This is a patch to the ddk750_sii164.c file that fixes line length warnings
found by the checkpatch.pl script
Signed-off-by: Jeremy Lacomis <j.lacomis@gmail.com>
---
Changes in v2:
- Change definition of i2cReadReg/i2cWriteReg
- Remove unnecessary casts
drivers/staging/sm750fb/ddk750_sii164.c | 87 ++++++++++++++++-----------------
1 file changed, 43 insertions(+), 44 deletions(-)
diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c
index c787a74c4f9c..66092c4645fc 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.c
+++ b/drivers/staging/sm750fb/ddk750_sii164.c
@@ -12,11 +12,13 @@
#define USE_HW_I2C
#ifdef USE_HW_I2C
- #define i2cWriteReg sm750_hw_i2c_write_reg
- #define i2cReadReg sm750_hw_i2c_read_reg
+#define i2c_write_reg(reg, config) sm750_hw_i2c_write_reg(SII164_I2C_ADDRESS, \
+ reg, config)
+#define i2c_read_reg(reg) sm750_hw_i2c_read_reg(SII164_I2C_ADDRESS, reg)
#else
- #define i2cWriteReg sm750_sw_i2c_write_reg
- #define i2cReadReg sm750_sw_i2c_read_reg
+#define i2c_write_reg(reg, config) sm750_sw_i2c_write_reg(SII164_I2C_ADDRESS, \
+ reg, config)
+#define i2c_read_reg(reg) sm750_sw_i2c_read_reg(SII164_I2C_ADDRESS, reg)
#endif
/* SII164 Vendor and Device ID */
@@ -39,8 +41,8 @@ unsigned short sii164GetVendorID(void)
{
unsigned short vendorID;
- vendorID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_HIGH) << 8) |
- (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_LOW);
+ vendorID = (i2c_read_reg(SII164_VENDOR_ID_HIGH) << 8) |
+ i2c_read_reg(SII164_VENDOR_ID_LOW);
return vendorID;
}
@@ -56,15 +58,16 @@ unsigned short sii164GetDeviceID(void)
{
unsigned short deviceID;
- deviceID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_HIGH) << 8) |
- (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_LOW);
+ deviceID = (i2c_read_reg(SII164_DEVICE_ID_HIGH) << 8) |
+ i2c_read_reg(SII164_DEVICE_ID_LOW);
return deviceID;
}
-
-
-/* DVI.C will handle all SiI164 chip stuffs and try it best to make code minimal and useful */
+/*
+ * DVI.C will handle all SiI164 chip stuffs and try it best to make code minimal
+ * and useful
+ */
/*
* sii164InitChip
@@ -72,10 +75,10 @@ unsigned short sii164GetDeviceID(void)
*
* Input:
* edgeSelect - Edge Select:
- * 0 = Input data is falling edge latched (falling edge
- * latched first in dual edge mode)
- * 1 = Input data is rising edge latched (rising edge
- * latched first in dual edge mode)
+ * 0 = Input data is falling edge latched (falling
+ * edge latched first in dual edge mode)
+ * 1 = Input data is rising edge latched (rising
+ * edge latched first in dual edge mode)
* busSelect - Input Bus Select:
* 0 = Input data bus is 12-bits wide
* 1 = Input data bus is 24-bits wide
@@ -135,7 +138,8 @@ long sii164InitChip(unsigned char edgeSelect,
#endif
/* Check if SII164 Chip exists */
- if ((sii164GetVendorID() = SII164_VENDOR_ID) && (sii164GetDeviceID() = SII164_DEVICE_ID)) {
+ if ((sii164GetVendorID() = SII164_VENDOR_ID) &&
+ (sii164GetDeviceID() = SII164_DEVICE_ID)) {
/*
* Initialize SII164 controller chip.
*/
@@ -170,7 +174,7 @@ long sii164InitChip(unsigned char edgeSelect,
else
config |= SII164_CONFIGURATION_VSYNC_AS_IS;
- i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config);
+ i2c_write_reg(SII164_CONFIGURATION, config);
/*
* De-skew enabled with default 111b value.
@@ -208,7 +212,7 @@ long sii164InitChip(unsigned char edgeSelect,
config |= SII164_DESKEW_8_STEP;
break;
}
- i2cWriteReg(SII164_I2C_ADDRESS, SII164_DESKEW, config);
+ i2c_write_reg(SII164_DESKEW, config);
/* Enable/Disable Continuous Sync. */
if (continuousSyncEnable = 0)
@@ -225,12 +229,12 @@ long sii164InitChip(unsigned char edgeSelect,
/* Set the PLL Filter value */
config |= ((pllFilterValue & 0x07) << 1);
- i2cWriteReg(SII164_I2C_ADDRESS, SII164_PLL, config);
+ i2c_write_reg(SII164_PLL, config);
/* Recover from Power Down and enable output. */
- config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION);
+ config = i2c_read_reg(SII164_CONFIGURATION);
config |= SII164_CONFIGURATION_POWER_NORMAL;
- i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config);
+ i2c_write_reg(SII164_CONFIGURATION, config);
return 0;
}
@@ -239,10 +243,6 @@ long sii164InitChip(unsigned char edgeSelect,
return -1;
}
-
-
-
-
/* below sii164 function is not necessary */
#ifdef SII164_FULL_FUNCTIONS
@@ -260,8 +260,8 @@ void sii164ResetChip(void)
/*
* sii164GetChipString
- * This function returns a char string name of the current DVI Controller chip.
- * It's convenient for application need to display the chip name.
+ * This function returns a char string name of the current DVI Controller
+ * chip. It's convenient for application need to display the chip name.
*/
char *sii164GetChipString(void)
{
@@ -279,17 +279,17 @@ void sii164SetPower(unsigned char powerUp)
{
unsigned char config;
- config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION);
+ config = i2c_read_reg(SII164_CONFIGURATION);
if (powerUp = 1) {
/* Power up the chip */
config &= ~SII164_CONFIGURATION_POWER_MASK;
config |= SII164_CONFIGURATION_POWER_NORMAL;
- i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config);
+ i2c_write_reg(SII164_CONFIGURATION, config);
} else {
/* Power down the chip */
config &= ~SII164_CONFIGURATION_POWER_MASK;
config |= SII164_CONFIGURATION_POWER_DOWN;
- i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config);
+ i2c_write_reg(SII164_CONFIGURATION, config);
}
}
@@ -302,7 +302,7 @@ void sii164SelectHotPlugDetectionMode(enum sii164_hot_plug_mode hotPlugMode)
{
unsigned char detectReg;
- detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) &
+ detectReg = i2c_read_reg(SII164_DETECT) &
~SII164_DETECT_MONITOR_SENSE_OUTPUT_FLAG;
switch (hotPlugMode) {
case SII164_HOTPLUG_DISABLE:
@@ -321,7 +321,7 @@ void sii164SelectHotPlugDetectionMode(enum sii164_hot_plug_mode hotPlugMode)
break;
}
- i2cWriteReg(SII164_I2C_ADDRESS, SII164_DETECT, detectReg);
+ i2c_write_reg(SII164_DETECT, detectReg);
}
/*
@@ -334,10 +334,11 @@ void sii164EnableHotPlugDetection(unsigned char enableHotPlug)
{
unsigned char detectReg;
- detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT);
+ detectReg = i2c_read_reg(SII164_DETECT);
- /* Depending on each DVI controller, need to enable the hot plug based on each
- * individual chip design.
+ /*
+ * Depending on each DVI controller, need to enable the hot plug based
+ * on each individual chip design.
*/
if (enableHotPlug != 0)
sii164SelectHotPlugDetectionMode(SII164_HOTPLUG_USE_MDI);
@@ -357,7 +358,7 @@ unsigned char sii164IsConnected(void)
{
unsigned char hotPlugValue;
- hotPlugValue = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) &
+ hotPlugValue = i2c_read_reg(SII164_DETECT) &
SII164_DETECT_HOT_PLUG_STATUS_MASK;
if (hotPlugValue = SII164_DETECT_HOT_PLUG_STATUS_ON)
return 1;
@@ -377,7 +378,7 @@ unsigned char sii164CheckInterrupt(void)
{
unsigned char detectReg;
- detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) &
+ detectReg = i2c_read_reg(SII164_DETECT) &
SII164_DETECT_MONITOR_STATE_MASK;
if (detectReg = SII164_DETECT_MONITOR_STATE_CHANGE)
return 1;
@@ -394,13 +395,11 @@ void sii164ClearInterrupt(void)
unsigned char detectReg;
/* Clear the MDI interrupt */
- detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT);
- i2cWriteReg(SII164_I2C_ADDRESS, SII164_DETECT,
- detectReg | SII164_DETECT_MONITOR_STATE_CLEAR);
+ detectReg = i2c_read_reg(SII164_DETECT);
+ i2c_write_reg(SII164_DETECT,
+ detectReg | SII164_DETECT_MONITOR_STATE_CLEAR);
}
-#endif
-
-#endif
-
+#endif /* SII164_FULL_FUNCTIONS */
+#endif /* USE_DVICHIP */
--
2.11.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v2] staging: sm750b: Fix coding style issues in sm750_accel.c
2017-11-25 22:48 ` Jeremy Lacomis
@ 2017-11-28 13:13 ` Greg Kroah-Hartman
-1 siblings, 0 replies; 16+ messages in thread
From: Greg Kroah-Hartman @ 2017-11-28 13:13 UTC (permalink / raw)
To: Jeremy Lacomis
Cc: Sudip Mukherjee, Teddy Wang, linux-fbdev, devel, linux-kernel
On Sat, Nov 25, 2017 at 05:48:11PM -0500, Jeremy Lacomis wrote:
> This is a patch to sm750_accel.c that fixes 80-character line length
> warnings found by checkpatch.pl. It also fixes some grammatical errors
> in comments and moves parameter-specific comments from inline to before
> the function.
>
> Signed-off-by: Jeremy Lacomis <j.lacomis@gmail.com>
> ---
> Changes in v2:
> - Change function comments to the kernel-doc format
>
> drivers/staging/sm750fb/sm750_accel.c | 189 ++++++++++++++++++----------------
> 1 file changed, 103 insertions(+), 86 deletions(-)
>
> diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c
> index 1035e91e7cd3..42cd920111bf 100644
> --- a/drivers/staging/sm750fb/sm750_accel.c
> +++ b/drivers/staging/sm750fb/sm750_accel.c
> @@ -1,4 +1,4 @@
> -// SPDX-License-Identifier: GPL-2.0
> +/* SPDX-License-Identifier: GPL-2.0 */
Why did you change this line? That is not correct.
Only ever do one "logical" thing per patch. If you have to say "also"
in a changelog text, that's a huge hint you are doing something wrong.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2] staging: sm750b: Fix coding style issues in sm750_accel.c
@ 2017-11-28 13:13 ` Greg Kroah-Hartman
0 siblings, 0 replies; 16+ messages in thread
From: Greg Kroah-Hartman @ 2017-11-28 13:13 UTC (permalink / raw)
To: Jeremy Lacomis
Cc: Sudip Mukherjee, Teddy Wang, linux-fbdev, devel, linux-kernel
On Sat, Nov 25, 2017 at 05:48:11PM -0500, Jeremy Lacomis wrote:
> This is a patch to sm750_accel.c that fixes 80-character line length
> warnings found by checkpatch.pl. It also fixes some grammatical errors
> in comments and moves parameter-specific comments from inline to before
> the function.
>
> Signed-off-by: Jeremy Lacomis <j.lacomis@gmail.com>
> ---
> Changes in v2:
> - Change function comments to the kernel-doc format
>
> drivers/staging/sm750fb/sm750_accel.c | 189 ++++++++++++++++++----------------
> 1 file changed, 103 insertions(+), 86 deletions(-)
>
> diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c
> index 1035e91e7cd3..42cd920111bf 100644
> --- a/drivers/staging/sm750fb/sm750_accel.c
> +++ b/drivers/staging/sm750fb/sm750_accel.c
> @@ -1,4 +1,4 @@
> -// SPDX-License-Identifier: GPL-2.0
> +/* SPDX-License-Identifier: GPL-2.0 */
Why did you change this line? That is not correct.
Only ever do one "logical" thing per patch. If you have to say "also"
in a changelog text, that's a huge hint you are doing something wrong.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2] Staging: sm750fb: Fix coding style issue in ddk750_sii164.c
2017-11-26 1:04 ` Jeremy Lacomis
@ 2017-11-28 13:14 ` Greg Kroah-Hartman
-1 siblings, 0 replies; 16+ messages in thread
From: Greg Kroah-Hartman @ 2017-11-28 13:14 UTC (permalink / raw)
To: Jeremy Lacomis
Cc: Sudip Mukherjee, Teddy Wang, linux-fbdev, devel, linux-kernel
On Sat, Nov 25, 2017 at 08:04:52PM -0500, Jeremy Lacomis wrote:
> This is a patch to the ddk750_sii164.c file that fixes line length warnings
> found by the checkpatch.pl script
That's not all this patch did :(
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2] Staging: sm750fb: Fix coding style issue in ddk750_sii164.c
@ 2017-11-28 13:14 ` Greg Kroah-Hartman
0 siblings, 0 replies; 16+ messages in thread
From: Greg Kroah-Hartman @ 2017-11-28 13:14 UTC (permalink / raw)
To: Jeremy Lacomis
Cc: Sudip Mukherjee, Teddy Wang, linux-fbdev, devel, linux-kernel
On Sat, Nov 25, 2017 at 08:04:52PM -0500, Jeremy Lacomis wrote:
> This is a patch to the ddk750_sii164.c file that fixes line length warnings
> found by the checkpatch.pl script
That's not all this patch did :(
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2] staging: sm750b: Fix coding style issues in sm750_accel.c
2017-11-28 13:13 ` Greg Kroah-Hartman
@ 2017-11-28 13:58 ` Jeremy Lacomis
-1 siblings, 0 replies; 16+ messages in thread
From: Jeremy Lacomis @ 2017-11-28 13:58 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Sudip Mukherjee, Teddy Wang, linux-fbdev, devel, linux-kernel
On Tue, Nov 28, 2017 at 02:13:31PM +0100, Greg Kroah-Hartman wrote:
> On Sat, Nov 25, 2017 at 05:48:11PM -0500, Jeremy Lacomis wrote:
> > This is a patch to sm750_accel.c that fixes 80-character line length
> > warnings found by checkpatch.pl. It also fixes some grammatical errors
> > in comments and moves parameter-specific comments from inline to before
> > the function.
> >
> > Signed-off-by: Jeremy Lacomis <j.lacomis@gmail.com>
> > ---
> > Changes in v2:
> > - Change function comments to the kernel-doc format
> >
> > drivers/staging/sm750fb/sm750_accel.c | 189 ++++++++++++++++++----------------
> > 1 file changed, 103 insertions(+), 86 deletions(-)
> >
> > diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c
> > index 1035e91e7cd3..42cd920111bf 100644
> > --- a/drivers/staging/sm750fb/sm750_accel.c
> > +++ b/drivers/staging/sm750fb/sm750_accel.c
> > @@ -1,4 +1,4 @@
> > -// SPDX-License-Identifier: GPL-2.0
> > +/* SPDX-License-Identifier: GPL-2.0 */
>
> Why did you change this line? That is not correct.
Sorry about this Greg, I wasn't familiar with the format of the license
identifier line, and it seemed inconsistent with the rest of the comments at the
time.
> Only ever do one "logical" thing per patch. If you have to say "also"
> in a changelog text, that's a huge hint you are doing something wrong.
I'll keep this in mind. I think my natural inclination is to be afraid that the
patches I'm sending in are _too_ trivial and breaking up these things into
several different patches would create more work for the maintainers.
Thanks,
- Jeremy
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2] staging: sm750b: Fix coding style issues in sm750_accel.c
@ 2017-11-28 13:58 ` Jeremy Lacomis
0 siblings, 0 replies; 16+ messages in thread
From: Jeremy Lacomis @ 2017-11-28 13:58 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Sudip Mukherjee, Teddy Wang, linux-fbdev, devel, linux-kernel
On Tue, Nov 28, 2017 at 02:13:31PM +0100, Greg Kroah-Hartman wrote:
> On Sat, Nov 25, 2017 at 05:48:11PM -0500, Jeremy Lacomis wrote:
> > This is a patch to sm750_accel.c that fixes 80-character line length
> > warnings found by checkpatch.pl. It also fixes some grammatical errors
> > in comments and moves parameter-specific comments from inline to before
> > the function.
> >
> > Signed-off-by: Jeremy Lacomis <j.lacomis@gmail.com>
> > ---
> > Changes in v2:
> > - Change function comments to the kernel-doc format
> >
> > drivers/staging/sm750fb/sm750_accel.c | 189 ++++++++++++++++++----------------
> > 1 file changed, 103 insertions(+), 86 deletions(-)
> >
> > diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c
> > index 1035e91e7cd3..42cd920111bf 100644
> > --- a/drivers/staging/sm750fb/sm750_accel.c
> > +++ b/drivers/staging/sm750fb/sm750_accel.c
> > @@ -1,4 +1,4 @@
> > -// SPDX-License-Identifier: GPL-2.0
> > +/* SPDX-License-Identifier: GPL-2.0 */
>
> Why did you change this line? That is not correct.
Sorry about this Greg, I wasn't familiar with the format of the license
identifier line, and it seemed inconsistent with the rest of the comments at the
time.
> Only ever do one "logical" thing per patch. If you have to say "also"
> in a changelog text, that's a huge hint you are doing something wrong.
I'll keep this in mind. I think my natural inclination is to be afraid that the
patches I'm sending in are _too_ trivial and breaking up these things into
several different patches would create more work for the maintainers.
Thanks,
- Jeremy
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2] Staging: sm750fb: Fix coding style issue in ddk750_sii164.c
2017-11-28 13:14 ` Greg Kroah-Hartman
@ 2017-11-28 14:00 ` Jeremy Lacomis
-1 siblings, 0 replies; 16+ messages in thread
From: Jeremy Lacomis @ 2017-11-28 14:00 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Sudip Mukherjee, Teddy Wang, linux-fbdev, devel, linux-kernel
On Tue, Nov 28, 2017 at 02:14:11PM +0100, Greg Kroah-Hartman wrote:
> On Sat, Nov 25, 2017 at 08:04:52PM -0500, Jeremy Lacomis wrote:
> > This is a patch to the ddk750_sii164.c file that fixes line length warnings
> > found by the checkpatch.pl script
>
> That's not all this patch did :(
>
Sorry again, I'll be sure to be much more careful in the future.
Thanks,
- Jeremy
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2] Staging: sm750fb: Fix coding style issue in ddk750_sii164.c
@ 2017-11-28 14:00 ` Jeremy Lacomis
0 siblings, 0 replies; 16+ messages in thread
From: Jeremy Lacomis @ 2017-11-28 14:00 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Sudip Mukherjee, Teddy Wang, linux-fbdev, devel, linux-kernel
On Tue, Nov 28, 2017 at 02:14:11PM +0100, Greg Kroah-Hartman wrote:
> On Sat, Nov 25, 2017 at 08:04:52PM -0500, Jeremy Lacomis wrote:
> > This is a patch to the ddk750_sii164.c file that fixes line length warnings
> > found by the checkpatch.pl script
>
> That's not all this patch did :(
>
Sorry again, I'll be sure to be much more careful in the future.
Thanks,
- Jeremy
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2017-11-28 14:00 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-25 17:59 [PATCH] Staging: sm750fb: Fix coding style issue in ddk750_sii164.c Jeremy Lacomis
2017-11-25 17:59 ` Jeremy Lacomis
2017-11-25 22:36 ` Joe Perches
2017-11-25 22:36 ` Joe Perches
2017-11-25 22:48 ` [PATCH v2] staging: sm750b: Fix coding style issues in sm750_accel.c Jeremy Lacomis
2017-11-25 22:48 ` Jeremy Lacomis
2017-11-28 13:13 ` Greg Kroah-Hartman
2017-11-28 13:13 ` Greg Kroah-Hartman
2017-11-28 13:58 ` Jeremy Lacomis
2017-11-28 13:58 ` Jeremy Lacomis
2017-11-26 1:04 ` [PATCH v2] Staging: sm750fb: Fix coding style issue in ddk750_sii164.c Jeremy Lacomis
2017-11-26 1:04 ` Jeremy Lacomis
2017-11-28 13:14 ` Greg Kroah-Hartman
2017-11-28 13:14 ` Greg Kroah-Hartman
2017-11-28 14:00 ` Jeremy Lacomis
2017-11-28 14:00 ` Jeremy Lacomis
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.