From patchwork Tue Apr 11 06:02:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9674599 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 ED14E60382 for ; Tue, 11 Apr 2017 06:07:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D785A2849A for ; Tue, 11 Apr 2017 06:07:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC76B284F4; Tue, 11 Apr 2017 06:07:39 +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 7EB3B2849A for ; Tue, 11 Apr 2017 06:07:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753267AbdDKGHi (ORCPT ); Tue, 11 Apr 2017 02:07:38 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35877 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752291AbdDKGHg (ORCPT ); Tue, 11 Apr 2017 02:07:36 -0400 Received: by mail-wm0-f65.google.com with SMTP id q125so12993470wmd.3 for ; Mon, 10 Apr 2017 23:07:35 -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=e8fcZ83q0KjP2Tzs7kvsAwze5XLys8yr+sC9Td44zKM=; b=OEdPcl+x2ydM1QOQZay0b65ng7043G/R0CwA2ZgqyMYIfoBDbSFskAJdhRknLRyJDb tI7F4+Jpv0iFmgoxxVhV8LU13Rz3ueMmCDFt/ukJLeHckOkWEHqyLvHijYB2LhXvx+2C kWEPQOTWEwegsNZkRWoOYweZ1u3/mYO52VRa7Fcs9Z6f558LHuNP9hT0CoBt4+rVnQmT YbHKc4vNSl+XxsJSVp/b3gdKrXr2ft3OUOeTjDSeWm1apvFwAjZeM3blskzINOis7o1e pHKjfLNDKVXnqpxIE8U7C6zk2MOsidIP7+ACfFYM7zuzXMAjbKt4a7Xgmp4/zYGAZYY9 xSTg== 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=e8fcZ83q0KjP2Tzs7kvsAwze5XLys8yr+sC9Td44zKM=; b=BYECLREyuwubHVUvgfJmjhQRc8/zFF6LufHGZISqXvJChqR29tOgNcGL2kqbd2gmQ9 VfoV+wfrIA33S/qWuyMFZ2W4iMQcDd7J22ozQPkFbh1E3vwlDfr4ii//HVdhdg0V+7xN uIyrlaNCCS5McrWYOsmVNZ+332A/Yed2bTSJL20B5dzd56pEctOYs55LtiH0P5bX0pL8 llgpWSJP4RSDObVM+In6a1cN9XOfbl9Hc400LoOqhngNPjoFRrwRyn+HgywfCvIW70mG PiKKWbvWllX8sMsKncWk0CUHmSX6mAZz/5dIbm6MfL7/6w3UAGLzKk+mVeU7if/WNL1x I6gg== X-Gm-Message-State: AN3rC/5Wol82ixeLfvY5CJdBe5ZX2c4YFqFhSst5qdDrccceYZpM81wp VVegNRQscrMb+Q== X-Received: by 10.28.37.135 with SMTP id l129mr12202782wml.49.1491890855051; Mon, 10 Apr 2017 23:07:35 -0700 (PDT) Received: from ?IPv6:2003:c6:ebdc:4000:4d95:3656:1b99:b390? (p200300C6EBDC40004D9536561B99B390.dip0.t-ipconnect.de. [2003:c6:ebdc:4000:4d95:3656:1b99:b390]) by smtp.googlemail.com with ESMTPSA id o71sm4723805wrb.47.2017.04.10.23.07.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Apr 2017 23:07:34 -0700 (PDT) Subject: [PATCH 3/5] media: rc: meson-ir: switch to managed rc device allocation / registration From: Heiner Kallweit To: Mauro Carvalho Chehab , Sean Young , Kevin Hilman Cc: linux-media@vger.kernel.org, linux-amlogic@lists.infradead.org References: Message-ID: Date: Tue, 11 Apr 2017 08:02:33 +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 --- 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 a52036c5..d56ef27e 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; }