From patchwork Mon Mar 20 14:06:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arushi X-Patchwork-Id: 9634261 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 883B1601E9 for ; Mon, 20 Mar 2017 14:15:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7DD5A27C0C for ; Mon, 20 Mar 2017 14:15:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7115427F80; Mon, 20 Mar 2017 14:15:27 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham 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 1A12427C0C for ; Mon, 20 Mar 2017 14:15:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754787AbdCTOP0 (ORCPT ); Mon, 20 Mar 2017 10:15:26 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:34418 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753631AbdCTOPY (ORCPT ); Mon, 20 Mar 2017 10:15:24 -0400 Received: by mail-pg0-f68.google.com with SMTP id b5so20302475pgg.1; Mon, 20 Mar 2017 07:15:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=z+RazEhRCR0BWIqAgYCkpPRiWp9ECryE9V5pHs1OfYE=; b=PXTFBXim+VipIkqiWNQDFPVEK1KigRSwDVkQTZajbbKcLlRDj46KTwDeOZjQBnN4Q0 u/jvR8k9jB4gILtgrRlqD36PV8CXgvqlmG0jgm8eWVMdrpjqVTIdj5QQNdkF8fbNth6+ uhB2SdpOmr5owOkS6QvKNS94iEh5AbestSOpM80s091LixxFqwz5P5uO2da3f1PLlR3K WmlqIDc/MG6QJYUbMXKVF/okYHDImrqvHQeuuNq5A638eQF+yvcWinllJGqJ0dlVC2em nVQtk8iQrs0WVqlmxkxzTkOUlqLMRVItpbYson6ilmnUWxQvUHQWSXdDea2tdoONmWUy zlLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=z+RazEhRCR0BWIqAgYCkpPRiWp9ECryE9V5pHs1OfYE=; b=sqNoMeiZizj536d/HtebA8ReIongiex92gSD0H4L1Ufzud6WmZ365q4bTkSrJWucon B0obwr9NfViajT3ITobv85fB3pCQ7jrRvaX/vW3RCeER4tUzMfsVLfWwKTpFOywQizVy W5681D2C3AmE8sp3iPjyjw5mCu5x8HQ2bo9lBV1EeatWgHnH1g7ZrAkntKQ1ERiOeOGO 80Z4lcqjrRFr5HikyFnD7gqPeKH7ywF09KjRLZJejh4h/6Mt6Z2Jek1skqz5j8M3OqvA lZ8k4Oiz+LlVeXX4Xb/y3QA8gGIXwuaSdzF6ylLl1/eNY45uglCLbFYzOOv52GCY64xE DSYg== X-Gm-Message-State: AFeK/H2hTjv5ilGyuDnFkjgN9lMWntrW5ohN7FgqS0e/3y+44naE05Lh66BjnKFQG2HRuQ== X-Received: by 10.84.198.164 with SMTP id p33mr40836477pld.127.1490018821125; Mon, 20 Mar 2017 07:07:01 -0700 (PDT) Received: from arushi-HP-Pavilion-Notebook ([14.139.82.6]) by smtp.gmail.com with ESMTPSA id d68sm33670588pfj.92.2017.03.20.07.06.58 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Mar 2017 07:06:59 -0700 (PDT) Date: Mon, 20 Mar 2017 19:36:56 +0530 From: Arushi Singhal To: sudipm.mukherjee@gmail.com Cc: Teddy Wang , Greg Kroah-Hartman , linux-fbdev@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, outreachy-kernel@googlegroups.com Subject: [PATCH v5] staging:sm750fb: Code readability is improved. Message-ID: <20170320140656.GA5137@arushi-HP-Pavilion-Notebook> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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 New variables are added to make the code more readable. Signed-off-by: Arushi Singhal --- changes in v5 -try to make the code much more readable. - defined the variable at the top of a block. - change the variable from temp to tmp. drivers/staging/sm750fb/ddk750_mode.c | 55 +++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_mode.c b/drivers/staging/sm750fb/ddk750_mode.c index eea5aef2956f..37b5d4850fb9 100644 --- a/drivers/staging/sm750fb/ddk750_mode.c +++ b/drivers/staging/sm750fb/ddk750_mode.c @@ -81,33 +81,38 @@ static int programModeRegisters(mode_parameter_t *pModeParam, struct pll_value * if (pll->clockType == SECONDARY_PLL) { /* programe secondary pixel clock */ poke32(CRT_PLL_CTRL, sm750_format_pll_reg(pll)); - poke32(CRT_HORIZONTAL_TOTAL, - (((pModeParam->horizontal_total - 1) << - CRT_HORIZONTAL_TOTAL_TOTAL_SHIFT) & - CRT_HORIZONTAL_TOTAL_TOTAL_MASK) | - ((pModeParam->horizontal_display_end - 1) & - CRT_HORIZONTAL_TOTAL_DISPLAY_END_MASK)); - - poke32(CRT_HORIZONTAL_SYNC, - ((pModeParam->horizontal_sync_width << - CRT_HORIZONTAL_SYNC_WIDTH_SHIFT) & - CRT_HORIZONTAL_SYNC_WIDTH_MASK) | - ((pModeParam->horizontal_sync_start - 1) & - CRT_HORIZONTAL_SYNC_START_MASK)); - poke32(CRT_VERTICAL_TOTAL, - (((pModeParam->vertical_total - 1) << - CRT_VERTICAL_TOTAL_TOTAL_SHIFT) & - CRT_VERTICAL_TOTAL_TOTAL_MASK) | - ((pModeParam->vertical_display_end - 1) & - CRT_VERTICAL_TOTAL_DISPLAY_END_MASK)); + tmp = ((pModeParam->horizontal_total - 1) << + CRT_HORIZONTAL_TOTAL_TOTAL_SHIFT) & + CRT_HORIZONTAL_TOTAL_TOTAL_MASK; + tmp |= (pModeParam->horizontal_display_end - 1) & + CRT_HORIZONTAL_TOTAL_DISPLAY_END_MASK; - poke32(CRT_VERTICAL_SYNC, - ((pModeParam->vertical_sync_height << - CRT_VERTICAL_SYNC_HEIGHT_SHIFT) & - CRT_VERTICAL_SYNC_HEIGHT_MASK) | - ((pModeParam->vertical_sync_start - 1) & - CRT_VERTICAL_SYNC_START_MASK)); + poke32(CRT_HORIZONTAL_TOTAL, tmp); + + tmp = (pModeParam->horizontal_sync_width << + CRT_HORIZONTAL_SYNC_WIDTH_SHIFT) & + CRT_HORIZONTAL_SYNC_WIDTH_MASK; + tmp |= (pModeParam->horizontal_sync_start - 1) & + CRT_HORIZONTAL_SYNC_START_MASK; + + poke32(CRT_HORIZONTAL_SYNC, tmp); + + tmp = ((pModeParam->vertical_total - 1) << + CRT_VERTICAL_TOTAL_TOTAL_SHIFT) & + CRT_VERTICAL_TOTAL_TOTAL_MASK; + tmp |= (pModeParam->vertical_display_end - 1) & + CRT_VERTICAL_TOTAL_DISPLAY_END_MASK; + + poke32(CRT_VERTICAL_TOTAL, tmp); + + tmp = ((pModeParam->vertical_sync_height << + CRT_VERTICAL_SYNC_HEIGHT_SHIFT)) & + CRT_VERTICAL_SYNC_HEIGHT_MASK; + tmp |= (pModeParam->vertical_sync_start - 1) & + CRT_VERTICAL_SYNC_START_MASK; + + poke32(CRT_VERTICAL_SYNC, tmp); tmp = DISPLAY_CTRL_TIMING | DISPLAY_CTRL_PLANE; if (pModeParam->vertical_sync_polarity)