From patchwork Wed Apr 12 19:32:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9678289 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 284FC601C3 for ; Wed, 12 Apr 2017 19:35:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1724528615 for ; Wed, 12 Apr 2017 19:35:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C36028641; Wed, 12 Apr 2017 19:35:18 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 A281828615 for ; Wed, 12 Apr 2017 19:35:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755071AbdDLTfQ (ORCPT ); Wed, 12 Apr 2017 15:35:16 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:35204 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753771AbdDLTfO (ORCPT ); Wed, 12 Apr 2017 15:35:14 -0400 Received: by mail-wm0-f66.google.com with SMTP id d79so8569544wmi.2 for ; Wed, 12 Apr 2017 12:35:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=SdFoem1NcUlJ229joPLXI8xANdrxaiKBEbpRw6hLmb0=; b=ldViLvCXEvVDY7C0Hal5vzHOC1hlALXuABrftQ2ttRwtBGYPNqCrfLTM72TFamAMxz cOFmNEUTHHWPn0XIIqbj6U2JkVxq1t6iTeLFcRaeuPFft+piNCAwyLGZhfEOW2H7cglp +CXdOjnea9dBQN3NJ6MCibXPPBi5MODuf/lD0pA8ItBGiw5Y0QLPleDWDVSal65TWnBt xkTH9eSMmmhJnwHhoLMycpWm5cOtvsO9+rqpffw70lamjFlu5FUU/OL9FnnOxF2RR430 C057Yz1VqEUjIYV6clP3+AL9wUtUD7/8fJtnVeoBnBGzLvFhpCf/EjSPZ+Feilot4uDB HzFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=SdFoem1NcUlJ229joPLXI8xANdrxaiKBEbpRw6hLmb0=; b=J/2ZyuEMKLvixsMywzwpGKaCBOuZSRtDfLDRTUsJbcCNQcS8Zz3jEoXShxWra85uFd T8uB/QX3ZctNMEUQg0+vVtCiUU+xlbFM8Uk6mZIBEjjDW0X323ImpkyeYEVfyMho2PU/ jsf4zNqqIJ8tH3lLY70VSi+MrHrhzMTp8wbbWUXuWVExSAm8ytLBlX+qolgDYaA+v0Yj 4UgKZVzx8V1KvK2j5QNDgVcmq5oPPmcdpuxuoiTe2A4+1dpUaN44lWan8HiAs2S6v+9+ 6NjTfyAleNvOOye8MJKXpdJjf+YqttXKj0snocEyNp6Brvsg7FbO5Ud5IV3rONsyUq8V Zf8w== X-Gm-Message-State: AN3rC/49j0xU7wc8E5vC9pnyQu87SGhQQKloGawOjqjqv17fpFZnIqsj 2xlKDAWYKcYT+eyg X-Received: by 10.28.73.9 with SMTP id w9mr850277wma.69.1492025713155; Wed, 12 Apr 2017 12:35:13 -0700 (PDT) Received: from ?IPv6:2003:c6:ebdc:4000:f514:8038:dab0:5880? (p200300C6EBDC4000F5148038DAB05880.dip0.t-ipconnect.de. [2003:c6:ebdc:4000:f514:8038:dab0:5880]) by smtp.googlemail.com with ESMTPSA id t6sm7669725wrb.31.2017.04.12.12.35.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Apr 2017 12:35:12 -0700 (PDT) Subject: [PATCH v2 3/5] media: rc: meson-ir: switch to managed rc device allocation / registration From: Heiner Kallweit To: Mauro Carvalho Chehab , Sean Young , Kevin Hilman , Neil Armstrong Cc: linux-media@vger.kernel.org, linux-amlogic@lists.infradead.org References: Message-ID: <6e38bc01-e865-0a26-649e-950021e0eef7@gmail.com> Date: Wed, 12 Apr 2017 21:32:35 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: 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 Switch to the managed versions of rc_allocate_device/rc_register_device, thus simplifying the code. Signed-off-by: Heiner Kallweit Reviewed-by: Neil Armstrong --- v2: - added R-b --- drivers/media/rc/meson-ir.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/media/rc/meson-ir.c b/drivers/media/rc/meson-ir.c index 3864ebe3..cf8943d2 100644 --- a/drivers/media/rc/meson-ir.c +++ b/drivers/media/rc/meson-ir.c @@ -128,7 +128,7 @@ static int meson_ir_probe(struct platform_device *pdev) return irq; } - ir->rc = rc_allocate_device(RC_DRIVER_IR_RAW); + ir->rc = devm_rc_allocate_device(dev, RC_DRIVER_IR_RAW); if (!ir->rc) { dev_err(dev, "failed to allocate rc device\n"); return -ENOMEM; @@ -140,7 +140,6 @@ static int meson_ir_probe(struct platform_device *pdev) ir->rc->input_id.bustype = BUS_HOST; map_name = of_get_property(node, "linux,rc-map-name", NULL); ir->rc->map_name = map_name ? map_name : RC_MAP_EMPTY; - ir->rc->dev.parent = dev; ir->rc->allowed_protocols = RC_BIT_ALL_IR_DECODER; ir->rc->rx_resolution = US_TO_NS(MESON_TRATE); ir->rc->timeout = MS_TO_NS(200); @@ -149,16 +148,16 @@ static int meson_ir_probe(struct platform_device *pdev) spin_lock_init(&ir->lock); platform_set_drvdata(pdev, ir); - ret = rc_register_device(ir->rc); + ret = devm_rc_register_device(dev, ir->rc); if (ret) { dev_err(dev, "failed to register rc device\n"); - goto out_free; + return ret; } ret = devm_request_irq(dev, irq, meson_ir_irq, 0, "ir-meson", ir); if (ret) { dev_err(dev, "failed to request irq\n"); - goto out_unreg; + return ret; } /* Reset the decoder */ @@ -184,13 +183,6 @@ static int meson_ir_probe(struct platform_device *pdev) dev_info(dev, "receiver initialized\n"); return 0; -out_unreg: - rc_unregister_device(ir->rc); - ir->rc = NULL; -out_free: - rc_free_device(ir->rc); - - return ret; } static int meson_ir_remove(struct platform_device *pdev) @@ -203,8 +195,6 @@ static int meson_ir_remove(struct platform_device *pdev) meson_ir_set_mask(ir, IR_DEC_REG1, REG1_ENABLE, 0); spin_unlock_irqrestore(&ir->lock, flags); - rc_unregister_device(ir->rc); - return 0; }