Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp6180531rwb; Wed, 18 Jan 2023 02:06:48 -0800 (PST) X-Google-Smtp-Source: AMrXdXvRQyoDRYKrc1yHn6ExZ1heVmQ0pqSfU8LE/qVIXh13eu6qPT6710eORI/I39DOEsSV0n0P X-Received: by 2002:a17:902:ccc1:b0:189:81dd:6b8b with SMTP id z1-20020a170902ccc100b0018981dd6b8bmr7584835ple.63.1674036408301; Wed, 18 Jan 2023 02:06:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674036408; cv=none; d=google.com; s=arc-20160816; b=wQwn11EdUPBw8SHmYHNQUtI8qwn5POIypXRkPx/9EkCpdY1zysosOgUGmhA59E6PD7 jj9ObROhFxfdoXAL6NKOj6/Q9x/2owL39CTrQJlNL5IOMt9idjOrz9tG4zXMl7HtXnAe hL2YIuH+7e7BI6kBK8VQ1rpwuq8Ce01pXwWHhUFd4VLJQMCvYdIUQUL7hDmOlEU5EQL1 dbgv4JaBhcLpbJo4Zj8so79soNNB8U4hsnNmIhmP49lQj4YfUFGMyJ8PVa3oh/sspiMZ VEkS5Mxv1zZxqTUaYXeGmvG3awE0qLLNQAlVCnWULk6/CwoeeBKMWvJX0wQzVruWxOso Q0xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=oLMzrErMTy6/hG7WMoEgtOt740aLULxefuZgTT64iC4=; b=lljfy32BbXaWZot6StpIGxcbI8ohm5a/nWAp/F2vV1fdohTOXVKeyDSENoogjlLn6K xWWTjMjLqGZYsswhMhGRr2iCXkV9rG4fhUdHLVLsOUMrFjoYQcMbiQpoCTpT1sReyBKr vJu4CFgGc6FlaLNbzwIsTGy1nqiyn1GhyFFq9IjF0tqdy4hKOpve6fRGalQHBfp7IPSK 6UrX8jAvrOzrqTXf7xnaR7PSNJijP7uUTyRkEo39eMkKbeE63AxCUd8xkTNZRhHfpjFu rR/uI85hU+rhon5xCY2IRNjtiQwQu4g60/IApTB6WOPvcw3gNHEzsQDQVa1yKp+LUyAh eaNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=geVaqhbD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f12-20020a170902f38c00b001947d6d10besi655899ple.402.2023.01.18.02.06.42; Wed, 18 Jan 2023 02:06:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=geVaqhbD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229749AbjARJDa (ORCPT + 48 others); Wed, 18 Jan 2023 04:03:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229989AbjARI7v (ORCPT ); Wed, 18 Jan 2023 03:59:51 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1A78611DE; Wed, 18 Jan 2023 00:19:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1674029980; x=1705565980; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=RNq2iIuPm+2/Woqz849r4QT1JASJeQWrk6QFhE+mRIE=; b=geVaqhbDk2ty72s6HG0Uj7+DydHpNdZa4Q+FwhGuoYFt71IE5TFvHpPG wzJtswMCCkLB4P2tzb3mKbFhvGgjKf0EBz4Fq2YzB5C1UxnlQvstZtZMI 7TSYzvwL8rshKAX1IXinbYldLwTClmXi8VXyo8Hh5rXaQH0rbe/0fJtMH ZMe+q73HGGfYApNab72jLwZP8ZnPDgzoLTVOR/iukaBOn8gjMHetADynR ORK30GtPQx65CAIPSFDN1yiE0InYR3g4Vog6kuiZMvMfpt/t7qYitDvHq zI7Q8uOtQ6mSxvaDYLkyWbDQrFrkKrfMsKq29InmUCH015GazUAVUU44z A==; X-IronPort-AV: E=McAfee;i="6500,9779,10593"; a="411168569" X-IronPort-AV: E=Sophos;i="5.97,224,1669104000"; d="scan'208";a="411168569" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2023 00:19:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10593"; a="690091014" X-IronPort-AV: E=Sophos;i="5.97,224,1669104000"; d="scan'208";a="690091014" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga008.jf.intel.com with ESMTP; 18 Jan 2023 00:19:36 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1pI3fS-00B0f0-12; Wed, 18 Jan 2023 10:19:34 +0200 Date: Wed, 18 Jan 2023 10:19:34 +0200 From: Andy Shevchenko To: Okan Sahin Cc: Lee Jones , Rob Herring , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Jonathan Cameron , Lars-Peter Clausen , ChiYuan Huang , Ramona Bolboaca , Caleb Connolly , William Breathitt Gray , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-iio@vger.kernel.org Subject: Re: [PATCH v3 3/5] drivers: regulator: Add ADI MAX77541/MAX77540 Regulator Support Message-ID: References: <20230118063822.14521-1-okan.sahin@analog.com> <20230118063822.14521-4-okan.sahin@analog.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230118063822.14521-4-okan.sahin@analog.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 18, 2023 at 09:38:10AM +0300, Okan Sahin wrote: > Regulator driver for both MAX77541 and MAX77540. > The MAX77541 is a high-efficiency step-down converter > with two 3A switching phases for single-cell Li+ battery > and 5VDC systems. > > The MAX77540 is a high-efficiency step-down converter > with two 3A switching phases. ... > + * Copyright (c) 2022 Analog Devices, Inc. Happy New Year! ... > +static int max77541_regulator_probe(struct platform_device *pdev) > +{ > + struct max77541 *max77541 = dev_get_drvdata(pdev->dev.parent); > + struct regulator_config config = {}; > + const struct regulator_desc *desc; > + struct device *dev = &pdev->dev; You may rearrange this a bit struct max77541 *max77541 = dev_get_drvdata(dev->parent); > + struct regulator_dev *rdev; > + int i; > + config.dev = pdev->dev.parent; dev->parent > + > + if (max77541->id == MAX77540) > + desc = max77540_regulators_desc; > + else if (max77541->id == MAX77541) > + desc = max77541_regulators_desc; > + else > + return -EINVAL; > + > + for (i = 0; i < MAX77541_MAX_REGULATORS; i++) { > + rdev = devm_regulator_register(dev, > + &desc[i], &config); This is perfectly one line. > + if (IS_ERR(rdev)) > + return dev_err_probe(dev, PTR_ERR(rdev), > + "Failed to register regulator\n"); > + } > + > + return 0; > +} ... > +static const struct of_device_id max77541_regulator_of_id[] = { > + { > + .compatible = "adi,max77540-regulator", > + .data = (void *)MAX77540, > + }, > + { > + .compatible = "adi,max77541-regulator", > + .data = (void *)MAX77541, > + }, > + { /* sentinel */ } As pointed out, better to use pointers directly. > +}; -- With Best Regards, Andy Shevchenko