From patchwork Thu Nov 29 22:29:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Malcolm Priestley X-Patchwork-Id: 10705455 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F8D014BD for ; Thu, 29 Nov 2018 22:29:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C1A22FA63 for ; Thu, 29 Nov 2018 22:29:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7DAEB2FAE7; Thu, 29 Nov 2018 22:29:56 +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 262322FA63 for ; Thu, 29 Nov 2018 22:29:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726652AbeK3Jg5 (ORCPT ); Fri, 30 Nov 2018 04:36:57 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:41655 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726385AbeK3Jg4 (ORCPT ); Fri, 30 Nov 2018 04:36:56 -0500 Received: by mail-wr1-f68.google.com with SMTP id x10so3450416wrs.8 for ; Thu, 29 Nov 2018 14:29:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=XNUfp54daPTl8yJwzS5s9jDSS8tzLboUCMKg0fwbiKQ=; b=jpXlDfdfkn6XQcY8doHOQEFs9KkJnUp8HHqOXpF2Vl7OlbiUCY/z7ErkFLj+5FdS6E uaumUJvXuv+lyQz7dU6EH0bBNuO7l9QfdtBBqWBk1SF3paapfGiGveAxiYH+g43D/zcJ gkQDherHNdvXxd/yYb1gq4lSXPFaAxJvLhXjJln6cYfWoCiSHLLbykh0gKAxqq0GFv6p 54bwOZRzbF+RsT2ouUNl8WoQI6Mu5MBlPuTd8QRh1dsRsyC6aMbyPmGU2ebRl4IH25FB xujhAK1Tn3/+LcZTXmlr4lYy+btccHM2VwA9hdhEjYl9MfL99cAyBd5I1VL2VH1OgaP8 TTXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=XNUfp54daPTl8yJwzS5s9jDSS8tzLboUCMKg0fwbiKQ=; b=sQ+hRLM98uvcDzpe9VgrWYwxzNJcanoHJoxG+nxSUZaJsZuiksx+7yfV5n4EaNpLK3 FJS0LdZ4Rt1Lqg6speL3Y5I47SuDIzf2D4o/0wv18jSrZlUwnFGkODskjg6rLjysAvlD sz1cEeZRnfcJqYHqd2QwLF83P1pgvYQmY+UMD+Xec/NCZw3PHCbpwKQxyc9rumTmVD/x J2uYETnt0a5QwBo9sDW9CQUT4bZ12L/EVolEcvgaxq8zXU4XdERW6v4MtOZJXhxaJeAP SsHmABXFMp/hQad/ySZqW4tyEz9VKLqzq4waan3g+9ntMWo+C3HC8gjY6o3WKnFqKCDR ViBQ== X-Gm-Message-State: AA+aEWYpBTcEP6FdVl5SKkBDQKsiXILdTsDP0vPFJBiEHDLvDrP52AS4 U1ouzKbA4oNK7+limV1BRgr741WA X-Google-Smtp-Source: AFSGD/Xfwg26zHCd0mUn3rJri5tU8lOvzaCdPwM0WgMxHDkzbzAnULfQxS24kVEEW4/QJwODJgYFgg== X-Received: by 2002:adf:f101:: with SMTP id r1mr2949226wro.32.1543530593074; Thu, 29 Nov 2018 14:29:53 -0800 (PST) Received: from [192.168.43.227] (92.40.249.58.threembb.co.uk. [92.40.249.58]) by smtp.gmail.com with ESMTPSA id s202sm4277694wme.40.2018.11.29.14.29.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Nov 2018 14:29:52 -0800 (PST) From: Malcolm Priestley Subject: [PATCH 2/4] media: lmedm04: Move usb buffer to lme2510_state. To: Linux Media Mailing List Message-ID: <1f6430e7-4b41-1516-a3f7-01be30fdcd3f@gmail.com> Date: Thu, 29 Nov 2018 22:29:51 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 Content-Language: en-US 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 lme2510_state exists for the entire duration of driver. Move usb_buffer to lme2510_state removing the need for lme2510_exit_int for removing the buffer. Signed-off-by: Malcolm Priestley --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 35 +++----------------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index 8b405e131439..8fb53b83c914 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -136,7 +136,7 @@ struct lme2510_state { u8 pid_off; void *buffer; struct urb *lme_urb; - void *usb_buffer; + u8 usb_buffer[64]; /* Frontend original calls */ int (*fe_read_status)(struct dvb_frontend *, enum fe_status *); int (*fe_read_signal_strength)(struct dvb_frontend *, u16 *); @@ -169,18 +169,9 @@ static int lme2510_usb_talk(struct dvb_usb_device *d, u8 *wbuf, int wlen, u8 *rbuf, int rlen) { struct lme2510_state *st = d->priv; - u8 *buff; + u8 *buff = st->usb_buffer; int ret = 0; - if (st->usb_buffer == NULL) { - st->usb_buffer = kmalloc(64, GFP_KERNEL); - if (st->usb_buffer == NULL) { - info("MEM Error no memory"); - return -ENOMEM; - } - } - buff = st->usb_buffer; - ret = mutex_lock_interruptible(&d->usb_mutex); if (ret < 0) @@ -1245,23 +1236,15 @@ static int lme2510_get_rc_config(struct dvb_usb_device *d, return 0; } -static void *lme2510_exit_int(struct dvb_usb_device *d) +static void lme2510_exit(struct dvb_usb_device *d) { struct lme2510_state *st = d->priv; struct dvb_usb_adapter *adap = &d->adapter[0]; - void *buffer = NULL; if (adap != NULL) { lme2510_kill_urb(&adap->stream); } - if (st->usb_buffer != NULL) { - st->i2c_talk_onoff = 1; - st->signal_level = 0; - st->signal_sn = 0; - buffer = st->usb_buffer; - } - if (st->lme_urb != NULL) { usb_kill_urb(st->lme_urb); usb_free_urb(st->lme_urb); @@ -1269,18 +1252,6 @@ static void *lme2510_exit_int(struct dvb_usb_device *d) st->lme_urb->transfer_dma); info("Interrupt Service Stopped"); } - - return buffer; -} - -static void lme2510_exit(struct dvb_usb_device *d) -{ - void *usb_buffer; - - if (d != NULL) { - usb_buffer = lme2510_exit_int(d); - kfree(usb_buffer); - } } static struct dvb_usb_device_properties lme2510_props = {