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: 9678299 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 E72E9601C3 for ; Wed, 12 Apr 2017 19:35:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D610728615 for ; Wed, 12 Apr 2017 19:35:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB37628641; Wed, 12 Apr 2017 19:35:44 +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=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8F85328615 for ; Wed, 12 Apr 2017 19:35:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:References:To:From:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BidKuSRr3ZFBLUpUTwtgVi7sGVFa7OivRFFNpHOxQXs=; b=aCL48LmmJyqhe3 jv6I8SbJ8cNHmbQoXHpv6jYJUt2M/+Qj351VATDDT8faYx9b+/ngIpNjg1mm2SabeIq8KJKUJoNUW qy09IyDMjKbo/df6jesAi+jI8B57gCIz4DfJsC+PeJlmtefX3t4Qpr/wQoDcdoGf7EuzbSNhtOaVn ysxkmjdB5l9PakT+Zgxa7RHyANGfq/Tu1w6VBJXJIG7N6/QuQPCJCTCbtaw8qCoMbUvLf4oBWy8zT YGPUFJXI94HOt49tCKdCcoVN6u5JcvWHcptpz8b60dANS5kuq+RBM59vPqCeu/N6V6eRN0eQcbuT6 nHCAyVjN7nFv++FX+Low==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cyO3H-0001FY-0X; Wed, 12 Apr 2017 19:35:39 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cyO3C-0001AB-UE for linux-amlogic@lists.infradead.org; Wed, 12 Apr 2017 19:35:36 +0000 Received: by mail-wm0-x242.google.com with SMTP id q125so8538152wmd.3 for ; Wed, 12 Apr 2017 12:35:14 -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=VVuwy27njYIUiRRsIvmhlaeByIA9/U2s+YgZTtNLPY9+q57jMuFrEJK569T8SwkA8F 59QlUNdxMp83Eq46Baqrb21HSpX+MjDwi3SehV4GssEPNOkKT+vxEaCHhvoWu3n5A014 p0WlsCnATKSW+rCFtSl8EU8Enh6xPf9EFz/EOIuW8l+EP9wYKVLm3lHWO8V6iL9bl9MC Tlvkx/OMa+ySwqr4Pz6g/8auEwwoVqw5Bi0RMfAsG3n3gD6YteAPf8T4/4OmyABbBHC7 deRyzHLKaWMDaf3nCa0WWT+Ia38YN80XxPgqY5a9mpPEC+B+C9inNew4QOJnyCHX8mdn 5a0g== X-Gm-Message-State: AN3rC/54nnwqdy9Foy0PBGjbRpVo7YC5FBmSl/N0tMRkQH4UBimOqD/C HN0iTszFFIr8lg== 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 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: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170412_123535_127899_309A1D9E X-CRM114-Status: UNSURE ( 9.65 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, linux-media@vger.kernel.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.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; }