Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp684190pxb; Tue, 19 Oct 2021 10:45:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxy0oWe1K4rStPFSx1IvzMRq/WzVs4gDJvMh58AYXNnhYBpeQ3urqGxYY7kgh7ZOYR2tWqZ X-Received: by 2002:a17:906:5a47:: with SMTP id my7mr38285751ejc.128.1634665555478; Tue, 19 Oct 2021 10:45:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634665555; cv=none; d=google.com; s=arc-20160816; b=sFi3WaKEu75RiXdhCKcwZl8MRkigXgtWeuwb8nUSvfh8jU5kqwbz2uGD1NX6XRMVfz yYvD6Krkm26TAakZmbCySVQMDW/OmCpuuwj4NPqFXXMuHjGkd+l7ZlO/O0lQXeNnxXin EqmKUDwPeru1MdbjjqHmTN4/jl2p8PiHEtYzhVIwdTP8ffBp3+bpMS0xaOVrUF8eWrfC hiJqPtP7rdT7MEWX3iiDwgQ3pk9UnbvztPw4SVYPSzlVsRvW2YrjAhRz1X8PXXLkBKwl 0Brf+Dm6k6Rw7cI351KlrVHcQyf+GsGd2YYVHeUMwxgI/h5FulDdiJphsN7jeTytw9i5 ghtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=u+Vx181FceNgYidmqppMkzdZTbJi3oOxFWt7O3PsYrY=; b=Ph8XCE6qhCvnoE/7EbcAjVHzh0yTa5OjnVij13SFDB5ULTDaHOqsRziQiU9CLUFOgR LH/KLfRby46YmUSOuc22Rl/cbhrDH4x4nxNlTuFRz1LrL4q1/KuuyIQKDh9zum5rWq0a A2E25ptwwkp6snHzIgwSIcpvkxtvZ37yVFJlHjNcJbO8zafFy4UQMxSfOairSqrwRRV7 H3nuwNpO+YOADV/sFrTKjPd3v2s24UIKtbRIieACjR/5OCf51qxaUhGyOeM9xGIfGRyR pZIeOI5Kpp9XS3nFnBT5ghjbgesEvek0GeiEyJLGoHSLDywFqYhi/NPbF6w5dMHKnjt6 65Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DBo0vktc; 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 gv8si24550337ejc.712.2021.10.19.10.45.30; Tue, 19 Oct 2021 10:45:55 -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=DBo0vktc; 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 S234682AbhJSRmx (ORCPT + 99 others); Tue, 19 Oct 2021 13:42:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:60968 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231586AbhJSRmv (ORCPT ); Tue, 19 Oct 2021 13:42:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C59E161355; Tue, 19 Oct 2021 17:40:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634665238; bh=CmkDVF4O9DMzn3vmYEeic/chg5gWAxEK0NpetX5xAgM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DBo0vktcw0U8GURxAuDOJliOjqa1JqTXkSp2AFYLzOzqq5aWyeBYAQWsXBUCMTTog Rjq9ISOlFMfpojsmXmhCr3eT0lfjvDRksstB2U5F1ypuvPbYsVoH1O/88CERD5JNel lw1VE0P+X1JgIBkXzp/4FhhUS/sOQ21mL5SpYP5HnSpLfjK6fswf6mpZ3mpFsBz08a CqgqQlY/RD687qQySBFS5NSlqQOArudqL3fqxP7v98TDorukMUGGD53u7lmrl14ZzM ifkbYKlmUKhAxJC0UTNlgVVVvtFNJ19Dm4qPqopFgGUOeo56Rt3HpnBlaHPOyZcdCj jis2eLJr7WQOA== Date: Tue, 19 Oct 2021 10:40:33 -0700 From: Nathan Chancellor To: Arnd Bergmann Cc: Liam Girdwood , Mark Brown , Nick Desaulniers , =?iso-8859-1?Q?Ma=EDra?= Canal , Arnd Bergmann , Colin Ian King , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] regulator: lp872x: fix enum conversion warning Message-ID: References: <20211019153851.509626-1-arnd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211019153851.509626-1-arnd@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 19, 2021 at 05:38:43PM +0200, Arnd Bergmann wrote: > 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 I sent basically the same patch but I also eliminated DSV_{LOW,HIGH} in favor of the GPIOD flags outright: https://lore.kernel.org/r/20211019004335.193492-1-nathan@kernel.org/ Either one works so I do not really care which one gets merged. Reviewed-by: Nathan Chancellor > --- > 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 >