From patchwork Thu Feb 1 15:14:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 195411 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2719:b0:106:209c:c626 with SMTP id hl25csp334527dyb; Thu, 1 Feb 2024 09:58:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IEMJL6Cn+xp+Y3LYRmq7mcDCNQEQSErDgRCJyN59YdLIjoB1WdgA2obLhDxOZsH8lPTK6t1 X-Received: by 2002:a05:6e02:12ec:b0:363:9a9a:fca7 with SMTP id l12-20020a056e0212ec00b003639a9afca7mr6669186iln.12.1706810287751; Thu, 01 Feb 2024 09:58:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706810287; cv=pass; d=google.com; s=arc-20160816; b=edDuyqUDeXNWurWfPtyzWlbhkLJY9m7gGS1EGJz1In8fZCcnYg5VnNtic4oEOSGVqu +dhfghPD7odqM5oKxujFfXht4BHx9N225zp0KVPNSv3ReP5e0OB39lqJ7fhVonwj4Pq9 +QydQjzoVPlRhTflakPToP1TPplFd0Q+4OKCwbmwowTuwPYCtT2HTujcwVGBWkKPPTks ECQ1n5HISIVOZiS8dFkdaBfln2SvrNJuY58CvlvOOLUi7MRu/YE5EP4/m9QLhIZF7YjC uHYIOoqztf6bNeiSf8AO3RSjQNae5pVF3Lobzg8bTbOD+gleWRmvlwS/ZcU8tn9mZ0Xi 8sdA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=q5zkk7m03T3OqASXKnwCbMzJ606esU8twxN/PykdNU8=; fh=c23t4uvwB6cgY6Rx17Q1WLdg81/TdqXhVLXaVaqmlW4=; b=qvpSg2ZDeSbmihxa5UNLc33zcXy9WozV5jMMQy771er67+dJ6rqS3NB+FI5K1NkK5h Y3ABaBwKwSkhSLwZNrZHsJSAGmCdSr3ZEhNu8QZpmH7tDNOrkns0sveKjzD10g4zgpXp X7cDoqS7Z8Ss9vUgVbDediKBU2wyC/WhIfdatMWhfJQrDmEsNJqGtkWuAx8gkMCQY3v0 RoMhELjoyzdy/5M/Uu20csLQRFNusNPaCr8z8RY9xKFs0DliHV46fnwG8T41WN8mjUtJ dV8YKHIjS9TAJZCCEy8BdgeAAQJlJON9xyvX49NXvkVlVaDsP2OqbJnsGa48M58vezEs YSrQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nvwjmWx9; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-48390-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48390-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCXj4TJTiU0pE+vaHP1+pq+sY1v2PVqj/JcKrV9+2es7SrzAjYDXtfiS6c8WUsz6Jtf5/Z2tWRGtnIH3ajQGX1kxMs1BkQ== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id k31-20020a63561f000000b005dbd83521fasi75540pgb.883.2024.02.01.09.58.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 09:58:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48390-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nvwjmWx9; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-48390-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48390-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2B26D294F82 for ; Thu, 1 Feb 2024 15:24:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1160E15B994; Thu, 1 Feb 2024 15:21:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="nvwjmWx9" Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B174A62160; Thu, 1 Feb 2024 15:21:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.55.52.120 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706800911; cv=none; b=RlZEckPWSxwVfxpyE6fcj5LKYZ4DPjwZetbAmoyffp6oCJXuH18hG/JUzV+iO2ZGjbh4n2S6TBE50CObxhYvS7YwUWjustKB8XT5f6fzvsBDwjboQUS7LjYx7N2B/OhyKx+yYcns8U7ow0chH8MUl7tyG8KgFGfZ1SihBSUvbjM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706800911; c=relaxed/simple; bh=WQWD/KmFc0zx5MOPqiRy9ksCicyxu+6xfyIr/wR/bkY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KSI00uikfDdZI8FFIzw/5mlCz9o5SJcIUlkafSocmpkq9utaBAqwopsW32C3Ookf3rLDcs2SpslcopcQ1X3fXaLDtDtBN/Mojxho2nGeN146TGUT8lFwtXW9Xnjm/FjQkB08dDApdstUkIVFxfUgak9PY+33K7yS0NV472rW6GY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=nvwjmWx9; arc=none smtp.client-ip=192.55.52.120 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706800909; x=1738336909; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WQWD/KmFc0zx5MOPqiRy9ksCicyxu+6xfyIr/wR/bkY=; b=nvwjmWx9PGRKI1zvShK8l1eXlj5P0OPZmO4PZWQRcR2iGOK9yX2W6m8d w0ReZGcaulfKfcDKLcusKfhZ9I1bvme3TZRsYYZJXziOABb/xh0lUC3e+ hR/2rX5GQfoFwn5PxmS019XtEjRe/s+zBNGN2UEbuKYNwtBwDzS5IR807 yrJffSEn36JaI8YiWy4kfZcPvKDNIjBlbPfh4I6Zx4sm54fq8Nm+9gJR8 8A9VhLsd4HqTq07kB63JJj039aAvz9/S1KlRaKuJWXxbdfTlZogr+X96O KRHUgtgG3+0q0MBK+qektJl/3ErF6ZiZDFyJdj0SJtyriez2iH93NG9J8 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="402762439" X-IronPort-AV: E=Sophos;i="6.05,234,1701158400"; d="scan'208";a="402762439" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Feb 2024 07:21:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="788953700" X-IronPort-AV: E=Sophos;i="6.05,234,1701158400"; d="scan'208";a="788953700" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 01 Feb 2024 07:21:41 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id D646EC07; Thu, 1 Feb 2024 17:15:42 +0200 (EET) From: Andy Shevchenko To: Flavio Suligoi , Andy Shevchenko , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Lee Jones , Daniel Thompson , Jingoo Han , Helge Deller Subject: [PATCH v2 2/3] backlight: mp3309c: use dev_err_probe() instead of dev_err() Date: Thu, 1 Feb 2024 17:14:14 +0200 Message-ID: <20240201151537.367218-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240201151537.367218-1-andriy.shevchenko@linux.intel.com> References: <20240201151537.367218-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789720304227361991 X-GMAIL-MSGID: 1789720304227361991 Replace dev_err() with dev_err_probe(). This helps in simplifing code and standardizing the error output. Signed-off-by: Andy Shevchenko Reviewed-by: Daniel Thompson Tested-by: Flavio Suligoi --- drivers/video/backlight/mp3309c.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/video/backlight/mp3309c.c b/drivers/video/backlight/mp3309c.c index 762bd738c903..2d6bd1a180b3 100644 --- a/drivers/video/backlight/mp3309c.c +++ b/drivers/video/backlight/mp3309c.c @@ -208,10 +208,8 @@ static int mp3309c_parse_fwnode(struct mp3309c_chip *chip, unsigned int num_levels, tmp_value; struct device *dev = chip->dev; - if (!dev_fwnode(dev)) { - dev_err(dev, "failed to get firmware node\n"); - return -ENODEV; - } + if (!dev_fwnode(dev)) + return dev_err_probe(dev, -ENODEV, "failed to get firmware node\n"); /* * Dimming mode: the MP3309C provides two dimming control mode: @@ -287,8 +285,7 @@ static int mp3309c_parse_fwnode(struct mp3309c_chip *chip, if (ret) pdata->default_brightness = pdata->max_brightness; if (pdata->default_brightness > pdata->max_brightness) { - dev_err(chip->dev, - "default brightness exceeds max brightness\n"); + dev_err_probe(dev, -ERANGE, "default brightness exceeds max brightness\n"); pdata->default_brightness = pdata->max_brightness; } @@ -329,16 +326,15 @@ static int mp3309c_parse_fwnode(struct mp3309c_chip *chip, static int mp3309c_probe(struct i2c_client *client) { - struct mp3309c_platform_data *pdata = dev_get_platdata(&client->dev); + struct device *dev = &client->dev; + struct mp3309c_platform_data *pdata = dev_get_platdata(dev); struct mp3309c_chip *chip; struct backlight_properties props; struct pwm_state pwmstate; int ret; - if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { - dev_err(&client->dev, "failed to check i2c functionality\n"); - return -EOPNOTSUPP; - } + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) + return dev_err_probe(dev, -EOPNOTSUPP, "failed to check i2c functionality\n"); chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); if (!chip)