From patchwork Mon Apr 16 17:36:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 10343601 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 E6E556039A for ; Mon, 16 Apr 2018 17:36:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D728428737 for ; Mon, 16 Apr 2018 17:36:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CAAF92884E; Mon, 16 Apr 2018 17:36:07 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 2092A28737 for ; Mon, 16 Apr 2018 17:36:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752376AbeDPRgF (ORCPT ); Mon, 16 Apr 2018 13:36:05 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:44515 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751398AbeDPRgF (ORCPT ); Mon, 16 Apr 2018 13:36:05 -0400 Received: by mail-wr0-f193.google.com with SMTP id u46so28291453wrc.11 for ; Mon, 16 Apr 2018 10:36:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=nqoTwuRBXNSjES/1ttg3TvHDF2dbXSdLlMTVKW1Ah3Y=; b=e4vsII0GPgdmRLwORZeruwJctf3iHwkU7R5bEpNTSsu1N/mFKvEM9D44fDfctkx1tZ NnNrLl9cGlt0fTQvztXlKfBIUne/57k8eR94QgUW+XqnfEFZW2ozKR//5ZlIdMJb72z4 h6mqjA+5qYVghy5S4O2ct38dnfJTF0BzhBYO4DIxB/oIYMquiOthbS3i7bhDGLagmZ4K Dnjwgr8w19lrPtGFf8nrAm0+E7OgG2vElcOuBuypL+UJJtrYur2GwpjXugUEgRMeTCF3 Jzds28nylRB05YMq+nJZ6mtmql54fJXRgN6zzyACJ3GWVmLEpq2Y6HZk5IuNY1Rkka5L jVAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=nqoTwuRBXNSjES/1ttg3TvHDF2dbXSdLlMTVKW1Ah3Y=; b=A0VW6QSsGdlgGdYGVk0+IZlfXeab1+Q8wm6q7gKA81schew2ns0GUldYM7QOkbqybI DMO44z2b/4bXJzbYOYH+qIYvRBKW6w2aSvqxktZZtEW0UPbvmaArya2CgkjVLaiZbt/w naAsPDqgN+wyCtQeEq7lLbz/VKkmbDFQFcyTZDnVXYUjFVuK/cc+rF3bhACT2ddOZ84l 9yiMEfax1z4oro+6/46TFRVZa3JL/3p5qjjjQc1+u0kUeCvGNB882NfEu7hz1GJSW7EW 3IbBkPc0Fwdw1JoN/YcNrtfe2YUGhDbeLXRrN/FegFOuKfCAgCrXAYMJbMNHsqX96x/D pY7g== X-Gm-Message-State: ALQs6tCcc2GnXW1mvHO26dd5fy47kZ9UtuM9AouBqQkdRzKrtz+E/BP3 EXM0dF5Mzezc5cDSIMEpubkxeA== X-Google-Smtp-Source: AIpwx48reKJnVjmiOX2aO/53dhJK0/A6juy5xdzOsmp45VNsb4cl13JlvIAqxl22P8JngykZlkp1vA== X-Received: by 10.223.172.79 with SMTP id v73mr6434089wrc.5.1523900163475; Mon, 16 Apr 2018 10:36:03 -0700 (PDT) Received: from dvbdev.wuest.de (ip-84-118-193-200.unity-media.net. [84.118.193.200]) by smtp.gmail.com with ESMTPSA id 109sm424025wra.18.2018.04.16.10.36.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Apr 2018 10:36:02 -0700 (PDT) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Subject: [PATCH] [media] ddbridge: don't uselessly check for dma in start/stop functions Date: Mon, 16 Apr 2018 19:36:00 +0200 Message-Id: <20180416173600.23158-1-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.16.1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Daniel Scheller The check for a valid ptr in ddb_io->dma isn't really necessary since only devices that do data transport using DMA are supported by the driver, and all previous initialisation code (through input_init(), output_init() and dma_init(), has_dma is always true as it's set in ddb_probe() during driver load) guarantees the ptr is set. As a side effect, this silences these sparse warnings (albeit them being false positives as ddb_io->dma won't change in these functions so the condition always equals to the same result): drivers/media/pci/ddbridge/ddbridge-core.c:495:9: warning: context imbalance in 'ddb_output_start' - different lock contexts for basic block drivers/media/pci/ddbridge/ddbridge-core.c:510:9: warning: context imbalance in 'ddb_output_stop' - different lock contexts for basic block drivers/media/pci/ddbridge/ddbridge-core.c:525:9: warning: context imbalance in 'ddb_input_stop' - different lock contexts for basic block drivers/media/pci/ddbridge/ddbridge-core.c:560:9: warning: context imbalance in 'ddb_input_start' - different lock contexts for basic block Signed-off-by: Daniel Scheller --- Superseds https://patchwork.linuxtv.org/patch/48593/ drivers/media/pci/ddbridge/ddbridge-core.c | 85 ++++++++++++------------------ 1 file changed, 35 insertions(+), 50 deletions(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index 90687eff5909..c90f2933df8d 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -410,13 +410,11 @@ static void ddb_output_start(struct ddb_output *output) struct ddb *dev = output->port->dev; u32 con = 0x11c, con2 = 0; - if (output->dma) { - spin_lock_irq(&output->dma->lock); - output->dma->cbuf = 0; - output->dma->coff = 0; - output->dma->stat = 0; - ddbwritel(dev, 0, DMA_BUFFER_CONTROL(output->dma)); - } + spin_lock_irq(&output->dma->lock); + output->dma->cbuf = 0; + output->dma->coff = 0; + output->dma->stat = 0; + ddbwritel(dev, 0, DMA_BUFFER_CONTROL(output->dma)); if (output->port->input[0]->port->class == DDB_PORT_LOOP) con = (1UL << 13) | 0x14; @@ -429,36 +427,29 @@ static void ddb_output_start(struct ddb_output *output) ddbwritel(dev, con, TS_CONTROL(output)); ddbwritel(dev, con2, TS_CONTROL2(output)); - if (output->dma) { - ddbwritel(dev, output->dma->bufval, - DMA_BUFFER_SIZE(output->dma)); - ddbwritel(dev, 0, DMA_BUFFER_ACK(output->dma)); - ddbwritel(dev, 1, DMA_BASE_READ); - ddbwritel(dev, 7, DMA_BUFFER_CONTROL(output->dma)); - } + ddbwritel(dev, output->dma->bufval, + DMA_BUFFER_SIZE(output->dma)); + ddbwritel(dev, 0, DMA_BUFFER_ACK(output->dma)); + ddbwritel(dev, 1, DMA_BASE_READ); + ddbwritel(dev, 7, DMA_BUFFER_CONTROL(output->dma)); ddbwritel(dev, con | 1, TS_CONTROL(output)); - if (output->dma) { - output->dma->running = 1; - spin_unlock_irq(&output->dma->lock); - } + output->dma->running = 1; + spin_unlock_irq(&output->dma->lock); } static void ddb_output_stop(struct ddb_output *output) { struct ddb *dev = output->port->dev; - if (output->dma) - spin_lock_irq(&output->dma->lock); + spin_lock_irq(&output->dma->lock); ddbwritel(dev, 0, TS_CONTROL(output)); - if (output->dma) { - ddbwritel(dev, 0, DMA_BUFFER_CONTROL(output->dma)); - output->dma->running = 0; - spin_unlock_irq(&output->dma->lock); - } + ddbwritel(dev, 0, DMA_BUFFER_CONTROL(output->dma)); + output->dma->running = 0; + spin_unlock_irq(&output->dma->lock); } static void ddb_input_stop(struct ddb_input *input) @@ -466,45 +457,39 @@ static void ddb_input_stop(struct ddb_input *input) struct ddb *dev = input->port->dev; u32 tag = DDB_LINK_TAG(input->port->lnr); - if (input->dma) - spin_lock_irq(&input->dma->lock); + spin_lock_irq(&input->dma->lock); + ddbwritel(dev, 0, tag | TS_CONTROL(input)); - if (input->dma) { - ddbwritel(dev, 0, DMA_BUFFER_CONTROL(input->dma)); - input->dma->running = 0; - spin_unlock_irq(&input->dma->lock); - } + + ddbwritel(dev, 0, DMA_BUFFER_CONTROL(input->dma)); + input->dma->running = 0; + spin_unlock_irq(&input->dma->lock); } static void ddb_input_start(struct ddb_input *input) { struct ddb *dev = input->port->dev; - if (input->dma) { - spin_lock_irq(&input->dma->lock); - input->dma->cbuf = 0; - input->dma->coff = 0; - input->dma->stat = 0; - ddbwritel(dev, 0, DMA_BUFFER_CONTROL(input->dma)); - } + spin_lock_irq(&input->dma->lock); + input->dma->cbuf = 0; + input->dma->coff = 0; + input->dma->stat = 0; + ddbwritel(dev, 0, DMA_BUFFER_CONTROL(input->dma)); + ddbwritel(dev, 0, TS_CONTROL(input)); ddbwritel(dev, 2, TS_CONTROL(input)); ddbwritel(dev, 0, TS_CONTROL(input)); - if (input->dma) { - ddbwritel(dev, input->dma->bufval, - DMA_BUFFER_SIZE(input->dma)); - ddbwritel(dev, 0, DMA_BUFFER_ACK(input->dma)); - ddbwritel(dev, 1, DMA_BASE_WRITE); - ddbwritel(dev, 3, DMA_BUFFER_CONTROL(input->dma)); - } + ddbwritel(dev, input->dma->bufval, + DMA_BUFFER_SIZE(input->dma)); + ddbwritel(dev, 0, DMA_BUFFER_ACK(input->dma)); + ddbwritel(dev, 1, DMA_BASE_WRITE); + ddbwritel(dev, 3, DMA_BUFFER_CONTROL(input->dma)); ddbwritel(dev, 0x09, TS_CONTROL(input)); - if (input->dma) { - input->dma->running = 1; - spin_unlock_irq(&input->dma->lock); - } + input->dma->running = 1; + spin_unlock_irq(&input->dma->lock); } static void ddb_input_start_all(struct ddb_input *input)