Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp3109520ybd; Fri, 28 Jun 2019 03:03:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqx+AhWQv25OBriSGNCr38tFdUaIqf0nUbmqv7BwpFAxvu/2FliF7kmJ29WXwNIFTvZ7o0VU X-Received: by 2002:a17:902:9a82:: with SMTP id w2mr10387122plp.291.1561716228343; Fri, 28 Jun 2019 03:03:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561716228; cv=none; d=google.com; s=arc-20160816; b=iqGv8wn5dAU9I2rG5f7XynyVu3lYZc3h/i/S+D80dGs9d1r83m+sO4pTuKjYKL/4Kr OBTz6SSTkiwys5uVPmJUiPs7MAoovVZcrTMMfjMt2jVbCMh3t2yvJPjCuSsqmPsZaVgk CJQKndnZVyPXAYzdyWH0tDV2oKheA7o1j9KYCwldcZWbdbqZ1ARwG9LRkrngblJBRcfg VBc24VD0TvDPsldrZ1KReBTGmBR1G9HkyodhikaZYVmXPylhQzn064gpmNzoy+9sSckd yo2uYkqbhNw5UWjTwWRG1k5a+ERBhjz1tzupJRn0ByKABC/O2bSZ+nxlYIwxCtqUn+r7 tKpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/MIsV0iC74yf/kLB48zP5Mu3PghPcknjMYE++qerELQ=; b=xNN6DBEo4J8E5AN2MNuEFZUjn6RkpdID2EAhkDtHcnFCi3zjmH8UHC3fdQ6S7VL5mS 9eY2FCg7IvhUXQG4cBUdVg0gLGeqQCiBLMb8u+xshT+om0HJC60j9SCiSuqIhjkyqdtz hUj9oQiPnMF9Kkw5Uhl8WZ2LwWiwsX3dAIXB9s533ZfJgJEcq61PLvSQq9YUUIsXMVJu GX6qpshUrXgblR9I+lcuPy3Kao579r5Wd5Y14CTJvFro5vbrkKWmLKTUqsCo/mcoEmCi LBq1LIecwVkHOTbJqeg/nWGvdTE4RbpNm33nqJl+63Gs1xIGCJJ9W0Hd2zkbCddKfOQN TCow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=RKbWobwq; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w4si1674448plz.323.2019.06.28.03.03.31; Fri, 28 Jun 2019 03:03:48 -0700 (PDT) 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=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=RKbWobwq; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726725AbfF1KDS (ORCPT + 99 others); Fri, 28 Jun 2019 06:03:18 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:33013 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726583AbfF1KDH (ORCPT ); Fri, 28 Jun 2019 06:03:07 -0400 Received: by mail-wm1-f66.google.com with SMTP id h19so8997190wme.0 for ; Fri, 28 Jun 2019 03:03:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/MIsV0iC74yf/kLB48zP5Mu3PghPcknjMYE++qerELQ=; b=RKbWobwqHCIrkwBTlOa2hdgmXhCQq1JvHVtNEOm0X33A/V3lRp6rBHwJTZOS2ZlrsC D/JTSQ4w5KTYhNV7l4mm1L9tL+8Zv5GX6ZX01CI+2pG2sbWZU2YGEk/dBx9zz50MHA5t fGLjObyRZ8ialJJ9Ujpck3pa0VCU+xs/7VClJN4UFUf2LPq4xfUkko0QaDjNN5EJwXDp 8koiUs4eI/hXyoZIHCY3WcCI5QQOhM2wYhdYEmHzm0aWdgYpa0xpfF3eVQ9lrv708D5D PCpptKKMn0a/FEuX2WMu3OkGWWHI69qpmuwM5vMFKoPbKnuxudAFGMZQcI/SHE5jz99U 5Ztg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/MIsV0iC74yf/kLB48zP5Mu3PghPcknjMYE++qerELQ=; b=ZEpGR09g5ryrP7nqO89nrbsgFyBt/5B6v2GXUnNPCqqFjUFxq5hK4i6Pdx4MF5W/zL HKP9R9lWSCuux7lkcLaFn/e6JisIoIZM9rjJqn6i5gpaK65pVA1/79qC0duu8LPr9uUq KNcx7kTBfIloBCR/FLBSeNRI3mEJHvtGn+CAKUNlWmIxzD3efwS9CZm/4+ovirPZNJ2W KzxsiwpgiBEMAqRzZvLaFZGi2eBF/34DC4wnLT/piNWHQz14q2qcCRz2zMvIupymCkxm VeW2lS3XZEE7GErFFVkrZx0TUjB7FM9rpodl6xTjXHAyOuq8agC6NN+XkJJvqFEfXDi3 ei7w== X-Gm-Message-State: APjAAAU4eN4zRBd2PX8yLXY3TspkLHHUhmo57aTjpunyFKeXiK61x3Jc dNiq2N1Z1TNcfiNG/Cvh/7ny0Q== X-Received: by 2002:a1c:f102:: with SMTP id p2mr6197653wmh.60.1561716185658; Fri, 28 Jun 2019 03:03:05 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id l124sm1628874wmf.36.2019.06.28.03.03.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Jun 2019 03:03:05 -0700 (PDT) From: Bartosz Golaszewski To: Yoshinori Sato , Rich Felker , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , Linus Walleij Cc: linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH RFT 2/4] backlight: gpio: simplify the platform data handling Date: Fri, 28 Jun 2019 12:02:51 +0200 Message-Id: <20190628100253.8385-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190628100253.8385-1-brgl@bgdev.pl> References: <20190628100253.8385-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bartosz Golaszewski Now that the last user of platform data (sh ecovec24) defines a proper GPIO lookup and sets the 'default-on' device property, we can drop the platform_data-specific GPIO handling and unify a big chunk of code. The only field used from the platform data is now the fbdev pointer. Signed-off-by: Bartosz Golaszewski --- drivers/video/backlight/gpio_backlight.c | 46 +++++++----------------- 1 file changed, 13 insertions(+), 33 deletions(-) diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 89e10bccfd3c..b20d2d5d5190 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -71,41 +71,21 @@ static int gpio_backlight_probe(struct platform_device *pdev) gbl->dev = dev; - if (pdata) { - /* - * Legacy platform data GPIO retrieveal. Do not expand - * the use of this code path, currently only used by one - * SH board. - */ - unsigned long flags = GPIOF_DIR_OUT; - + if (pdata) gbl->fbdev = pdata->fbdev; - gbl->def_value = pdata->def_value; - flags |= gbl->def_value ? GPIOF_INIT_HIGH : GPIOF_INIT_LOW; - - ret = devm_gpio_request_one(gbl->dev, pdata->gpio, flags, - pdata ? pdata->name : "backlight"); - if (ret < 0) { - dev_err(dev, "unable to request GPIO\n"); - return ret; - } - gbl->gpiod = gpio_to_desc(pdata->gpio); - if (!gbl->gpiod) - return -EINVAL; - } else { - gbl->def_value = device_property_read_bool(dev, "default-on"); - flags = gbl->def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW; - - gbl->gpiod = devm_gpiod_get(dev, NULL, flags); - if (IS_ERR(gbl->gpiod)) { - ret = PTR_ERR(gbl->gpiod); - - if (ret != -EPROBE_DEFER) { - dev_err(dev, - "Error: The gpios parameter is missing or invalid.\n"); - } - return ret; + + gbl->def_value = device_property_read_bool(dev, "default-on"); + flags = gbl->def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW; + + gbl->gpiod = devm_gpiod_get(dev, NULL, flags); + if (IS_ERR(gbl->gpiod)) { + ret = PTR_ERR(gbl->gpiod); + + if (ret != -EPROBE_DEFER) { + dev_err(dev, + "Error: The gpios parameter is missing or invalid.\n"); } + return ret; } memset(&props, 0, sizeof(props)); -- 2.21.0