Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp576146pxb; Tue, 19 Oct 2021 08:42:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcWjCFKx835F6KvJgO56//5PJ3xkWum+tcd7zac7VPu4F9jVsnEn5Kk6EgLOIW3+gFKWf3 X-Received: by 2002:a17:906:6809:: with SMTP id k9mr39274714ejr.424.1634658133673; Tue, 19 Oct 2021 08:42:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634658133; cv=none; d=google.com; s=arc-20160816; b=SbrvgCJHQh0nDwg4eYd/ZfbzVcWNvii9psVmdUc1LETAFsVgBGWH/twuYmiu3bBnhn cNrUARIETLOlZEy3G+36gBf5ypEJjGk+LjMKffFViiG88qYJbaC/01lHJoFblWeJyrbU roIk1wEALugHu2vv+dbenV8WlN5+eJOs2m0g2spEWDrJz0GLij2rAvsmYL+9zIF2PKTM pewUs7x3XTcK0IPlyVENJ7OatMbaqbnGA78nK8Ce2TcMOdQfGFkLKPrIHXhsT+NJVV5g y7Qgo/XG3jUZa5drC5RLnjnL4PV9nZyoKoAt2oMHQxnm7KslaQAqqabQAyScedDJ2nEO efLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=+rHSHL9rl4K+m9QqzhrvP/90k0DfoHhFbjFr+tBci0A=; b=tet8mBV8PStPieIaP0zNeIRF1bo9s3nsO4FkyyOIDQNj+3hF+kvUvgPE3c8SFMwFRv KruFZsb64ke402DQ1oZLdM3rMHZfa/OXDf+3fBjEVgkm5smTbcEF6M0Cfi9UyqqvsCsI 3pjSc6kCNhY0CLMo6vzWj30PiQsLWF5fNOFbvS5nLNj6Jv1ucXy4RcMyIiHyMzYvwgMq /oDW6EOa/+kBxeqcEUTQgEZfNs593Fthl4AYtmuNs6YVM1fi57NuVaiXYGRLGTO18zIx nyAtsNyNg8CVFF7OnHcWNHDY6/jbl6C+H5z1NqlMz3UeerUdModdNHPDH9wwxUT3+aMQ Sy2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VZKQHSgj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y17si22983202eds.293.2021.10.19.08.41.49; Tue, 19 Oct 2021 08:42:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VZKQHSgj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232316AbhJSPlI (ORCPT + 99 others); Tue, 19 Oct 2021 11:41:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:54766 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229789AbhJSPlH (ORCPT ); Tue, 19 Oct 2021 11:41:07 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 68CF1610A1; Tue, 19 Oct 2021 15:38:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634657935; bh=o5ezVg7Hp4npuopz5xMP0kwyU75vnc6iAMnB1+AOcx8=; h=From:To:Cc:Subject:Date:From; b=VZKQHSgjp5ceouIKTCzmunpW9pLq0U3OssQa6PEEVopkEQHUN9RewTEiDMK9dGYYw wWaKOgypCV9ndYGEFrSLqiHV2YDAiYFIcDBDLgLwaMhNYK2l4oL8zoa9YHIzNOetBz QBdWOFMW5tJaPHXcN7Lj8ES9mLGRIcFAWu+H7qKd9ksERXZRbBe1SpRdWFai4ylgH5 LHrY+Fw3UYyrqPj2YUjTxF4m5tXlWRqKeNXaNsvVbiDmV2Z+dc3Cu/7DbJiypMVVZa K4Ttv/2ObuURdsu1DseF9ZfOxg1uVK8ZL30pO3Dx+Jai56pe3UJc5uGe548jaiufuW sbB2K3uFI8EKA== From: Arnd Bergmann To: Liam Girdwood , Mark Brown , Nathan Chancellor , Nick Desaulniers , =?UTF-8?q?Ma=C3=ADra=20Canal?= Cc: Arnd Bergmann , Colin Ian King , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH] regulator: lp872x: fix enum conversion warning Date: Tue, 19 Oct 2021 17:38:43 +0200 Message-Id: <20211019153851.509626-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann clang warns that the argument to devm_gpiod_get_optional() is the wrong type: drivers/regulator/lp872x.c:689:57: error: implicit conversion from enumeration type 'enum lp872x_dvs_state' to different enumeration type 'enum gpiod_flags' [-Werror,-Wenum-conversion] dvs->gpio = devm_gpiod_get_optional(lp->dev, "ti,dvs", pinstate); ~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~ The enum value is specifcally chosen to be the same here, but the compiler only sees the mismatched types. This could be worked around using another ?: expression, but it seems easiest to replace the assignment with a macro. Fixes: 72bf80cf09c4 ("regulator: lp872x: replacing legacy gpio interface for gpiod") Signed-off-by: Arnd Bergmann --- drivers/regulator/lp872x.c | 6 +++--- include/linux/regulator/lp872x.h | 8 +++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/regulator/lp872x.c b/drivers/regulator/lp872x.c index 1dba5dbcd461..61412ebc8d8d 100644 --- a/drivers/regulator/lp872x.c +++ b/drivers/regulator/lp872x.c @@ -103,7 +103,7 @@ struct lp872x { enum lp872x_id chipid; struct lp872x_platform_data *pdata; int num_regulators; - enum lp872x_dvs_state dvs_pin; + enum gpiod_flags dvs_pin; }; /* LP8720/LP8725 shared voltage table for LDOs */ @@ -251,7 +251,7 @@ static int lp872x_regulator_enable_time(struct regulator_dev *rdev) static void lp872x_set_dvs(struct lp872x *lp, enum lp872x_dvs_sel dvs_sel, struct gpio_desc *gpio) { - enum lp872x_dvs_state state; + enum gpiod_flags state; state = dvs_sel == SEL_V1 ? DVS_HIGH : DVS_LOW; gpiod_set_value(gpio, state); @@ -675,7 +675,7 @@ static const struct regulator_desc lp8725_regulator_desc[] = { static int lp872x_init_dvs(struct lp872x *lp) { struct lp872x_dvs *dvs = lp->pdata ? lp->pdata->dvs : NULL; - enum lp872x_dvs_state pinstate; + enum gpiod_flags pinstate; u8 mask[] = { LP8720_EXT_DVS_M, LP8725_DVS1_M | LP8725_DVS2_M }; u8 default_dvs_mode[] = { LP8720_DEFAULT_DVS, LP8725_DEFAULT_DVS }; diff --git a/include/linux/regulator/lp872x.h b/include/linux/regulator/lp872x.h index 8e7e0343c6e1..5b94fe38fc78 100644 --- a/include/linux/regulator/lp872x.h +++ b/include/linux/regulator/lp872x.h @@ -40,10 +40,8 @@ enum lp872x_regulator_id { LP872X_ID_MAX, }; -enum lp872x_dvs_state { - DVS_LOW = GPIOD_OUT_LOW, - DVS_HIGH = GPIOD_OUT_HIGH, -}; +#define DVS_LOW GPIOD_OUT_LOW +#define DVS_HIGH GPIOD_OUT_HIGH enum lp872x_dvs_sel { SEL_V1, @@ -59,7 +57,7 @@ enum lp872x_dvs_sel { struct lp872x_dvs { struct gpio_desc *gpio; enum lp872x_dvs_sel vsel; - enum lp872x_dvs_state init_state; + enum gpiod_flags init_state; }; /** -- 2.29.2