Received: by 10.223.176.46 with SMTP id f43csp974922wra; Wed, 24 Jan 2018 08:41:37 -0800 (PST) X-Google-Smtp-Source: AH8x2262tqQ61vJ7bovyCQxpvnyrJwLnCWFVUBnwmBYKYeZLIuiFcOCzYIf60AyEu96/ll+dR74A X-Received: by 2002:a17:902:b414:: with SMTP id x20-v6mr6933952plr.87.1516812097260; Wed, 24 Jan 2018 08:41:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516812097; cv=none; d=google.com; s=arc-20160816; b=fmxZtCVxmssXmCBxFtETlsJykeJXOuEAJK5TfeVOlfUGviI8o9d/ccCe3tsZgySIWw MN3ZiGYXawJga89Ky+9FjBT1BomFHHQuyHpsTUuvuF99crDQ2j/8YuMxjWY5AqaAoN40 YO/eIKDMOL3mflVP6d3v9lvoRo+O5zcoGSXLt7uwpaVcNOp8+rS+1VqqH4sag1kpHqEI 4eQPQrOmtpUthx/d90ZkFYiOuqi8raDg1wzElRR1ckiaxic+A+Onrv0MEpPDMi5uWNtT p4C7+c76ngojC8oG+btYZkg/ZYLY2nDn4LsKmD7eQoktuqbwWN3KYtB8G60ax7xO+OY3 A+Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:dkim-signature :arc-authentication-results; bh=OH2HgWfnb9b0NNPPHGGJq7EyNii4Z/oYhFqcCRuPnfI=; b=U0JynB0sThkfimRtRJmHMHT8+uNVeOSi07XjmE/wElqdzE+T7lgmB+COLcROff5Xn9 tnFEke7F1MRKQ3DuXBTKUPXr3FKk9J7jBLCRcTDijTGSIF88xdfKWH1nNZHGqeXmzaOf TmaEmjhW8iCj/TB/SGrpuCASxSEnWRNmA00gvDaUNjM4EiGBXnzl9wnd3eOWuf8MsbB7 yczsnOM5C1gaQf5T2+lhwB/+WkxtJBPtRExfGmDpArSjQpa67MBMNziZGBrBVQv2OrYl b3uo5pWMQ8YWaySVqMQ6SppEjO8+PFme0Jp9vI0bIn4wlMjRggkMaLY/ekMJnnr8Gq9g 5b7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=N8Lof8nv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x189si339296pgd.187.2018.01.24.08.41.23; Wed, 24 Jan 2018 08:41:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=N8Lof8nv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964957AbeAXQlC (ORCPT + 99 others); Wed, 24 Jan 2018 11:41:02 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:32848 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964813AbeAXQk6 (ORCPT ); Wed, 24 Jan 2018 11:40:58 -0500 Received: by mail-pg0-f65.google.com with SMTP id u1so3082134pgr.0 for ; Wed, 24 Jan 2018 08:40:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=OH2HgWfnb9b0NNPPHGGJq7EyNii4Z/oYhFqcCRuPnfI=; b=N8Lof8nvpqtIfkBZziuMyL8kJkOdKacNYqvNaXpkDjkRATOLSGahydDq4uQT5H79XT 6ZO3C4qvvxZQu3stFukUM5NU/UJN+P06g1i7jK6k+bhaT9OjyiZoLxYuuTJIWridp7cz 3qS5hl4p0PeXgI+XorjYSLUrpJAYJ73gvGvtVJNMKcE6kg5E8rln2qG6LrfcN4iRWqzV tEl5J4xmJny5CGygfOuU3mT/mG02MpPcZIwPIGC5AUVSJ4BwlvYcmjuVAB+7fGY0DmU3 dBy31qll0GXpRcuRBGJoQPWoH+F0g9j6nu74yKLsWIuJeyVg6RXAGwhbX3qRw+a6R3kZ gjiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=OH2HgWfnb9b0NNPPHGGJq7EyNii4Z/oYhFqcCRuPnfI=; b=MRnhtj3XNaPn7OkkLXvpi5beUdY1eiJD9suR2DbKdHBa8O5ZRMBaMtQZtgnG9pOeL0 XmDn1Vp7nQS1tqN7A/6u3gpM8gtdMWNn322yDa9qu5zITQk9G5mEUzvN+nNUMknr074K 39JwpRQUrpBqgx21gVHaPNqseuZaeALCKnGlR5TkziBDa+dIVVwnfz7qcZSQbUp6O2r9 24It9ZqKJPg1k/bdmGIN6xAiCPUERkaRGvsmAYQoqzSdC1CwW07xRWzSGR1NE6iQJImS CF/5uwpDHAtm+V4hbNYUZ17+axe8tT0AFOauGPMtMWkX1hm/PCfziL6Xei3+z+NZ91yy KhNw== X-Gm-Message-State: AKwxyte49LYKi+Y1ObmjofqerMMlL5KcWuVtgvAmO7PcSjCNxNNhr4bu deo/bfKDjUxtvILka5DlTjA= X-Received: by 10.101.74.71 with SMTP id a7mr11382621pgu.32.1516812057747; Wed, 24 Jan 2018 08:40:57 -0800 (PST) Received: from raspberrypi ([122.172.61.122]) by smtp.gmail.com with ESMTPSA id e67sm11622512pfd.23.2018.01.24.08.40.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Jan 2018 08:40:56 -0800 (PST) Date: Wed, 24 Jan 2018 16:40:51 +0000 From: Meghana Madhyastha To: Lee Jones , Daniel Thompson , Jingoo Han , Thierry Reding , Noralf =?iso-8859-1?Q?Tr=F8nnes?= , Tomi Valkeinen , Daniel Vetter , Sean Paul , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v19 09/10] drm/panel: Use of_find_backlight helper Message-ID: <140d01afb138d687680b2d1776a4c101c9fa9a0a.1516810725.git.meghana.madhyastha@gmail.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace of_find_backlight_by_node and of the code around it with of_find_backlight helper to avoid repetition of code. Reviewed-by: Noralf Tr?nnes Reviewed-by: Sean Paul Signed-off-by: Meghana Madhyastha --- drivers/gpu/drm/panel/panel-innolux-p079zca.c | 24 ++++----------------- drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c | 28 +++++-------------------- drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c | 27 ++++-------------------- 3 files changed, 13 insertions(+), 66 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/drm/panel/panel-innolux-p079zca.c index 4c1b29eec..57df39b5c 100644 --- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c +++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c @@ -215,7 +215,6 @@ MODULE_DEVICE_TABLE(of, innolux_of_match); static int innolux_panel_add(struct innolux_panel *innolux) { struct device *dev = &innolux->link->dev; - struct device_node *np; int err; innolux->supply = devm_regulator_get(dev, "power"); @@ -230,37 +229,22 @@ static int innolux_panel_add(struct innolux_panel *innolux) innolux->enable_gpio = NULL; } - np = of_parse_phandle(dev->of_node, "backlight", 0); - if (np) { - innolux->backlight = of_find_backlight_by_node(np); - of_node_put(np); + innolux->backlight = devm_of_find_backlight(dev); - if (!innolux->backlight) - return -EPROBE_DEFER; - } + if (IS_ERR(innolux->backlight)) + return PTR_ERR(innolux->backlight); drm_panel_init(&innolux->base); innolux->base.funcs = &innolux_panel_funcs; innolux->base.dev = &innolux->link->dev; - err = drm_panel_add(&innolux->base); - if (err < 0) - goto put_backlight; - - return 0; - -put_backlight: - put_device(&innolux->backlight->dev); - - return err; + return drm_panel_add(&innolux->base); } static void innolux_panel_del(struct innolux_panel *innolux) { if (innolux->base.dev) drm_panel_remove(&innolux->base); - - put_device(&innolux->backlight->dev); } static int innolux_panel_probe(struct mipi_dsi_device *dsi) diff --git a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c index 072c0fc79..6bf8730f1 100644 --- a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c +++ b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c @@ -318,8 +318,7 @@ MODULE_DEVICE_TABLE(of, sharp_of_match); static int sharp_panel_add(struct sharp_panel *sharp) { - struct device_node *np; - int err; + struct device *dev = &sharp->link1->dev; sharp->mode = &default_mode; @@ -327,30 +326,16 @@ static int sharp_panel_add(struct sharp_panel *sharp) if (IS_ERR(sharp->supply)) return PTR_ERR(sharp->supply); - np = of_parse_phandle(sharp->link1->dev.of_node, "backlight", 0); - if (np) { - sharp->backlight = of_find_backlight_by_node(np); - of_node_put(np); + sharp->backlight = devm_of_find_backlight(dev); - if (!sharp->backlight) - return -EPROBE_DEFER; - } + if (IS_ERR(sharp->backlight)) + return PTR_ERR(sharp->backlight); drm_panel_init(&sharp->base); sharp->base.funcs = &sharp_panel_funcs; sharp->base.dev = &sharp->link1->dev; - err = drm_panel_add(&sharp->base); - if (err < 0) - goto put_backlight; - - return 0; - -put_backlight: - if (sharp->backlight) - put_device(&sharp->backlight->dev); - - return err; + return drm_panel_add(&sharp->base); } static void sharp_panel_del(struct sharp_panel *sharp) @@ -358,9 +343,6 @@ static void sharp_panel_del(struct sharp_panel *sharp) if (sharp->base.dev) drm_panel_remove(&sharp->base); - if (sharp->backlight) - put_device(&sharp->backlight->dev); - if (sharp->link2) put_device(&sharp->link2->dev); } diff --git a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c index 8a5137963..494aa9b16 100644 --- a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c +++ b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c @@ -253,8 +253,6 @@ static const struct drm_panel_funcs sharp_nt_panel_funcs = { static int sharp_nt_panel_add(struct sharp_nt_panel *sharp_nt) { struct device *dev = &sharp_nt->dsi->dev; - struct device_node *np; - int ret; sharp_nt->mode = &default_mode; @@ -271,39 +269,22 @@ static int sharp_nt_panel_add(struct sharp_nt_panel *sharp_nt) gpiod_set_value(sharp_nt->reset_gpio, 0); } - np = of_parse_phandle(dev->of_node, "backlight", 0); - if (np) { - sharp_nt->backlight = of_find_backlight_by_node(np); - of_node_put(np); + sharp_nt->backlight = devm_of_find_backlight(dev); - if (!sharp_nt->backlight) - return -EPROBE_DEFER; - } + if (IS_ERR(sharp_nt->backlight)) + return PTR_ERR(sharp_nt->backlight); drm_panel_init(&sharp_nt->base); sharp_nt->base.funcs = &sharp_nt_panel_funcs; sharp_nt->base.dev = &sharp_nt->dsi->dev; - ret = drm_panel_add(&sharp_nt->base); - if (ret < 0) - goto put_backlight; - - return 0; - -put_backlight: - if (sharp_nt->backlight) - put_device(&sharp_nt->backlight->dev); - - return ret; + return drm_panel_add(&sharp_nt->base); } static void sharp_nt_panel_del(struct sharp_nt_panel *sharp_nt) { if (sharp_nt->base.dev) drm_panel_remove(&sharp_nt->base); - - if (sharp_nt->backlight) - put_device(&sharp_nt->backlight->dev); } static int sharp_nt_panel_probe(struct mipi_dsi_device *dsi) -- 2.11.0