From patchwork Wed Mar 5 16:12:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Mack X-Patchwork-Id: 3777281 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E141DBF549 for ; Wed, 5 Mar 2014 16:13:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA04420220 for ; Wed, 5 Mar 2014 16:13:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E860020222 for ; Wed, 5 Mar 2014 16:13:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754872AbaCEQNE (ORCPT ); Wed, 5 Mar 2014 11:13:04 -0500 Received: from mail-bk0-f49.google.com ([209.85.214.49]:47214 "EHLO mail-bk0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754508AbaCEQNA (ORCPT ); Wed, 5 Mar 2014 11:13:00 -0500 Received: by mail-bk0-f49.google.com with SMTP id my13so482972bkb.36 for ; Wed, 05 Mar 2014 08:12:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=U6zMczN01uKH7hl90zTxRdEJ9ShxvPSv10Ij6juBB54=; b=ltsCcyvcq9ajYlM7zkgtQeUfTbN4wUkRpJuljOqoEtxv/fHNanlGjmtAIA9ADGvTqt Ec8ZWACi2x/vS2Ueg7fGOkgZlZLrNJNTc9qcPPMdE6g3fyJa1VZmrPli58GshxBtgl82 srz7OA3jWgfNpalUCQbVcfmlUd44mQ2qxIiqBbHeU7B8w9qMDgFvEFY22cb5VBYELA0S IpLQLqcGoTJAETjZNeJrt1iYP2fLgUsEHdsPlkHEUE8V4lcbknWED3vQvuEcvirQw1g7 pU+9iOLlh8cwyOk3asSPHkNXX8GpevAFmlKZaF4ir5OQIWNeWrycu4QW1tFYC7vd0wWh w/DQ== X-Received: by 10.204.242.200 with SMTP id lj8mr713406bkb.97.1394035978977; Wed, 05 Mar 2014 08:12:58 -0800 (PST) Received: from tamtam.fritz.box (p5099deeb.dip0.t-ipconnect.de. [80.153.222.235]) by mx.google.com with ESMTPSA id r1sm5501787bkk.2.2014.03.05.08.12.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Mar 2014 08:12:58 -0800 (PST) From: Daniel Mack To: plagnioj@jcrosoft.com, tomi.valkeinen@ti.com Cc: linux-fbdev@vger.kernel.org, haojian.zhuang@gmail.com, eric.y.miao@gmail.com, Daniel Mack Subject: [PATCH 1/4] video: pxa3xx-gcu: rename some symbols Date: Wed, 5 Mar 2014 17:12:46 +0100 Message-Id: <1394035969-32420-2-git-send-email-zonque@gmail.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1394035969-32420-1-git-send-email-zonque@gmail.com> References: <1394035969-32420-1-git-send-email-zonque@gmail.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Prefix some functions with more specific names. While at it, kill some stray newlines and other coding style related minor things. Signed-off-by: Daniel Mack --- drivers/video/pxa3xx-gcu.c | 48 ++++++++++++++++++++-------------------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/drivers/video/pxa3xx-gcu.c b/drivers/video/pxa3xx-gcu.c index ad382b3..9cd48ab 100644 --- a/drivers/video/pxa3xx-gcu.c +++ b/drivers/video/pxa3xx-gcu.c @@ -107,7 +107,6 @@ struct pxa3xx_gcu_priv { struct timeval base_time; struct pxa3xx_gcu_batch *free; - struct pxa3xx_gcu_batch *ready; struct pxa3xx_gcu_batch *ready_last; struct pxa3xx_gcu_batch *running; @@ -368,27 +367,26 @@ pxa3xx_gcu_wait_free(struct pxa3xx_gcu_priv *priv) /* Misc device layer */ -static inline struct pxa3xx_gcu_priv *file_dev(struct file *file) +static inline struct pxa3xx_gcu_priv *to_pxa3xx_gcu_priv(struct file *file) { struct miscdevice *dev = file->private_data; return container_of(dev, struct pxa3xx_gcu_priv, misc_dev); } static ssize_t -pxa3xx_gcu_misc_write(struct file *file, const char *buff, - size_t count, loff_t *offp) +pxa3xx_gcu_write(struct file *file, const char *buff, + size_t count, loff_t *offp) { int ret; unsigned long flags; struct pxa3xx_gcu_batch *buffer; - struct pxa3xx_gcu_priv *priv = file_dev(file); + struct pxa3xx_gcu_priv *priv = to_pxa3xx_gcu_priv(file); int words = count / 4; /* Does not need to be atomic. There's a lock in user space, * but anyhow, this is just for statistics. */ priv->shared->num_writes++; - priv->shared->num_words += words; /* Last word reserved for batch buffer end command */ @@ -406,10 +404,8 @@ pxa3xx_gcu_misc_write(struct file *file, const char *buff, * Get buffer from free list */ spin_lock_irqsave(&priv->spinlock, flags); - buffer = priv->free; priv->free = buffer->next; - spin_unlock_irqrestore(&priv->spinlock, flags); @@ -454,10 +450,10 @@ pxa3xx_gcu_misc_write(struct file *file, const char *buff, static long -pxa3xx_gcu_misc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +pxa3xx_gcu_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { unsigned long flags; - struct pxa3xx_gcu_priv *priv = file_dev(file); + struct pxa3xx_gcu_priv *priv = to_pxa3xx_gcu_priv(file); switch (cmd) { case PXA3XX_GCU_IOCTL_RESET: @@ -474,10 +470,10 @@ pxa3xx_gcu_misc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) } static int -pxa3xx_gcu_misc_mmap(struct file *file, struct vm_area_struct *vma) +pxa3xx_gcu_mmap(struct file *file, struct vm_area_struct *vma) { unsigned int size = vma->vm_end - vma->vm_start; - struct pxa3xx_gcu_priv *priv = file_dev(file); + struct pxa3xx_gcu_priv *priv = to_pxa3xx_gcu_priv(file); switch (vma->vm_pgoff) { case 0: @@ -532,8 +528,8 @@ static inline void pxa3xx_gcu_init_debug_timer(void) {} #endif static int -add_buffer(struct platform_device *dev, - struct pxa3xx_gcu_priv *priv) +pxa3xx_gcu_add_buffer(struct platform_device *dev, + struct pxa3xx_gcu_priv *priv) { struct pxa3xx_gcu_batch *buffer; @@ -549,15 +545,14 @@ add_buffer(struct platform_device *dev, } buffer->next = priv->free; - priv->free = buffer; return 0; } static void -free_buffers(struct platform_device *dev, - struct pxa3xx_gcu_priv *priv) +pxa3xx_gcu_free_buffers(struct platform_device *dev, + struct pxa3xx_gcu_priv *priv) { struct pxa3xx_gcu_batch *next, *buffer = priv->free; @@ -568,18 +563,17 @@ free_buffers(struct platform_device *dev, buffer->ptr, buffer->phys); kfree(buffer); - buffer = next; } priv->free = NULL; } -static const struct file_operations misc_fops = { - .owner = THIS_MODULE, - .write = pxa3xx_gcu_misc_write, - .unlocked_ioctl = pxa3xx_gcu_misc_ioctl, - .mmap = pxa3xx_gcu_misc_mmap +static const struct file_operations pxa3xx_gcu_miscdev_fops = { + .owner = THIS_MODULE, + .write = pxa3xx_gcu_write, + .unlocked_ioctl = pxa3xx_gcu_ioctl, + .mmap = pxa3xx_gcu_mmap, }; static int pxa3xx_gcu_probe(struct platform_device *dev) @@ -593,7 +587,7 @@ static int pxa3xx_gcu_probe(struct platform_device *dev) return -ENOMEM; for (i = 0; i < 8; i++) { - ret = add_buffer(dev, priv); + ret = pxa3xx_gcu_add_buffer(dev, priv); if (ret) { dev_err(&dev->dev, "failed to allocate DMA memory\n"); goto err_free_priv; @@ -611,7 +605,7 @@ static int pxa3xx_gcu_probe(struct platform_device *dev) priv->misc_dev.minor = MISCDEV_MINOR, priv->misc_dev.name = DRV_NAME, - priv->misc_dev.fops = &misc_fops, + priv->misc_dev.fops = &pxa3xx_gcu_miscdev_fops; /* register misc device */ ret = misc_register(&priv->misc_dev); @@ -710,7 +704,7 @@ err_misc_deregister: misc_deregister(&priv->misc_dev); err_free_priv: - free_buffers(dev, priv); + pxa3xx_gcu_free_buffers(dev, priv); kfree(priv); return ret; } @@ -728,7 +722,7 @@ static int pxa3xx_gcu_remove(struct platform_device *dev) iounmap(priv->mmio_base); release_mem_region(r->start, resource_size(r)); clk_disable(priv->clk); - free_buffers(dev, priv); + pxa3xx_gcu_free_buffers(dev, priv); kfree(priv); return 0;