From patchwork Sat Nov 25 18:26:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Lacomis X-Patchwork-Id: 10074931 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DC006602BC for ; Sat, 25 Nov 2017 18:27:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D0CFD208C2 for ; Sat, 25 Nov 2017 18:27:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C358828EDA; Sat, 25 Nov 2017 18:27:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25027208C2 for ; Sat, 25 Nov 2017 18:27:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751277AbdKYS1H (ORCPT ); Sat, 25 Nov 2017 13:27:07 -0500 Received: from mail-qt0-f196.google.com ([209.85.216.196]:33729 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751231AbdKYS1D (ORCPT ); Sat, 25 Nov 2017 13:27:03 -0500 Received: by mail-qt0-f196.google.com with SMTP id r58so34770953qtc.0; Sat, 25 Nov 2017 10:27:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7JyYoYNWmINdWI/VAIi1FsLvlT8I0CdfgzkV9OS2dOE=; b=NPpBAzIzf0jqRTZrOYhxuNqsEyiOi/cif1k9Cl4zjhBCQ8o8qsmddmQ6vEmOFj+0/y VkBrgmc+LN+iuStU7ofPYRL8pU6WR31ZcUoPoxyctF+6wYc9HYiO0zQUheU262ZFPwKg t38UVF0hccSAq+gfmap+Hc41RNzovFB2lBpyQk5La0/p32uqN3TwkOii2qQSXOaMRjj7 sM1ojY6T5UACtGA0uUoLoJjCXdowPn9OAWH3ofQ6e4WUdfJdLAL+8OBu8SrYQ5UcBpNj J+yTdN6KTuyyJLBmNqnXJcWpwTRqVD5GRd1fYpwvzh2DFs0nMs3MUn+xB9C7fQFRO01Q 6xIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7JyYoYNWmINdWI/VAIi1FsLvlT8I0CdfgzkV9OS2dOE=; b=Hu+x11ayi1i484NIEhOnswBZ5/v/mTbrvJDknBfqp+jK1YpWf7nsbxLrrIRvSE7YbI OKsWHYSYz9bOFushucVrGIrsFxfs4g0kvRq3XiXN/6IircWYI3o4xBu/yL5TZyit1vch aQFiMzotC5EQL4gNYWNFevdCOC5zRxRn1OFLr8OeVl9eMLTSF0KfXJ6CiMv+pVCq4YYX L5HM5A51us4WgeV31gBMmzMe/IoErg1eUGHPhYT9H9nic07l5fLYTTqcaqJxV646dW1f +8gdOGsOKXhB9lKzIZ1qJtM1ijB4HHuzE+XYzKFtxFYdO2BQGIWpzl9lA7+2YiN0WlDB eX4g== X-Gm-Message-State: AJaThX4gA62IvfSX/KecjsPmS+aPNo7UdQ7E5C3CfqhZqC+84QvWLJvK 42mf1S372D7kV0Vs641Rl1g= X-Google-Smtp-Source: AGs4zMbMszFf4olXSfpVPWc1q+8Uvb8Nup3K4z613ATkk75G9Nmmbk4QcJdpmbUh7ouHeRXcgdIHFQ== X-Received: by 10.237.34.51 with SMTP id n48mr47524163qtc.300.1511634422790; Sat, 25 Nov 2017 10:27:02 -0800 (PST) Received: from linux-dev (pool-74-109-216-254.pitbpa.fios.verizon.net. [74.109.216.254]) by smtp.gmail.com with ESMTPSA id u36sm11734992qtc.58.2017.11.25.10.27.02 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 25 Nov 2017 10:27:02 -0800 (PST) From: Jeremy Lacomis To: sudipm.mukherjee@gmail.com, teddy.wang@siliconmotion.com, gregkh@linuxfoundation.org Cc: linux-fbdev@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Jeremy Lacomis Subject: [PATCH 2/2] staging: sm750b: Fix coding style issues in sm750_accel.c Date: Sat, 25 Nov 2017 13:26:36 -0500 Message-Id: <20171125182636.15245-2-j.lacomis@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171125182636.15245-1-j.lacomis@gmail.com> References: <20171125182636.15245-1-j.lacomis@gmail.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/staging/sm750fb/sm750_accel.c | 184 ++++++++++++++++++---------------- 1 file changed, 98 insertions(+), 86 deletions(-) diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c index 1035e91e7cd3..085e5064188f 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 #include #include @@ -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,85 @@ 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 */ +/* + * Notes on these parameters: + * sBase: Address of the source offset in the frame buffer + * sPitch: Pitch value of the source surface in BYTE + * sx, sy: Starting 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, dy: Starting coordinate of the destination surface + * width, height: Dimensions 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 +292,26 @@ 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 */ +/* + * Notes on these parameters: + * 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, dy: Starting coordinates of the destination surface + * width, height: Dimensions 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 +320,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 +335,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 +363,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 +390,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); }