Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp6131092rwb; Wed, 18 Jan 2023 01:18:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXvJJJy1MIsXkFJs3r3r0S5Bmrjvs7Q/Q6bT8hfQx5pliUMq0b/6x/XcEZ7/EhFy4ohkCFdM X-Received: by 2002:a17:902:f78e:b0:194:85db:e20c with SMTP id q14-20020a170902f78e00b0019485dbe20cmr6363171pln.8.1674033519849; Wed, 18 Jan 2023 01:18:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674033519; cv=none; d=google.com; s=arc-20160816; b=r+L8rXmf7uSqESmz7ffEqRH4hCV3t42KfvPjGi/bxj2lPBHM5yTBtbOnq5yaLruqTA 5r+IfyD3k8rghRLpIMRsWDA7szhxrPW5pJoRY6PNul4PkZGsOSKi6h8M+jvLgqk+E6AH bk7bwEUFcx23itZ55mSTX5X7kS4pkJxPkYQBkJWoxwb54uhlOiz8wG+1suYfadAqaPnw zC85rTY0x7fXlwG7UaFrYBlLZNMWUMXTv8TTjKUSf1vZeRIh0I6O7mjTgyGjz5ahRxno YRmmeiVQhgv1zbsX7VCOViVW3mYf6Tc0Qt0c0cVs5C92gQ3A0Zg9wHdbKT+2eUdNEd0Z /Btg== 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=KhX8Lm4S/1Fvqm3V6Dd/hdgcXQhjXvvdbyoiRV4kUxA=; b=siyqTW/t6WWsFFMhfQHo3apiI7Oh623shjXarKGUqv115d861hKrnZj9hRc6SZlHij 7+TTriwbC/JQngC0IpYQjbG/YwIrZFhV2B4p6HLZQgmUe+72hdZfcm7EDBAa0i1TXr1o tUZ9h17F5Ezje4vP3kPtsM9uBvlM/cFl2x1m158nTipCQ4kOXUBFjfIuytVgn71VXD9P qSqBK+0Jhv59OtqL2kjyHKIUVo/pDz4LbFZpWNX/kLo55ILXr30zoBfC+ukI0sJaftmx aatGiuqYWAi6Iz/BUr0F/mxMdbsw8U4ELFzfomopE9JFwtAGKj7BjHDrt6euVZuVC1hX Cmew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OcCUN875; 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 c13-20020a170902d48d00b001929a1613f1si39405135plg.470.2023.01.18.01.18.34; Wed, 18 Jan 2023 01:18:39 -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=OcCUN875; 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 S229970AbjARI7u (ORCPT + 46 others); Wed, 18 Jan 2023 03:59:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229960AbjARI6j (ORCPT ); Wed, 18 Jan 2023 03:58:39 -0500 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2174830FE; Wed, 18 Jan 2023 00:16:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1674029785; x=1705565785; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=CKWlSVG3dqnPnAUFE6fQ5nT8l9dHU1tiOB4s5k2oa6k=; b=OcCUN875IwHcZYuXlAr5iAsmbEaXzuBtevZaRRZQAVWFluVXJxxWPZmi 5sYyrkwPB8lp4S91zYxEeXKgpsVeo6WdbrsPyeHsEF49caLHjPEcHRWC7 QRYulXclQ1R0F3AG1TolWFGMoVLUH/dqFDTVZ5qdc1eRv6t+U3PywRPXe TsidG8wBDyKM6EdOfatTfWSNf3ptePpTgslW3MEPkd/46rHnRV8xc+2mM 2KI4Mn+B0Spfvbv4yR/VUYYEWKTkuRGASpVQm81vjUJAH8khbA+vHMY2t DKnl39zutuF+Mo53MJkmipLn24qDC+xeDYzgY8VbY9l9Wceo+WlRUMsya w==; X-IronPort-AV: E=McAfee;i="6500,9779,10593"; a="304609429" X-IronPort-AV: E=Sophos;i="5.97,224,1669104000"; d="scan'208";a="304609429" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2023 00:16:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10593"; a="661623777" X-IronPort-AV: E=Sophos;i="5.97,224,1669104000"; d="scan'208";a="661623777" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga007.fm.intel.com with ESMTP; 18 Jan 2023 00:16:19 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1pI3cH-00B0bA-17; Wed, 18 Jan 2023 10:16:17 +0200 Date: Wed, 18 Jan 2023 10:16:17 +0200 From: Andy Shevchenko To: Okan Sahin Cc: Lee Jones , Rob Herring , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Jonathan Cameron , Lars-Peter Clausen , Caleb Connolly , Lad Prabhakar , William Breathitt Gray , Ramona Bolboaca , ChiYuan Huang , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-iio@vger.kernel.org Subject: Re: [PATCH v3 1/5] drivers: mfd: Add ADI MAX77541/MAX77540 PMIC Support Message-ID: References: <20230118063822.14521-1-okan.sahin@analog.com> <20230118063822.14521-2-okan.sahin@analog.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230118063822.14521-2-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_PASS, 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:08AM +0300, Okan Sahin wrote: > MFD driver for MAX77541/MAX77540 to enable its sub > devices. > > The MAX77541 is a multi-function devices. It includes > buck converter and ADC. > > The MAX77540 is a high-efficiency buck converter > with two 3A switching phases. > > They have same regmap except for ADC part of MAX77541. ... > +/* > + * Copyright (c) 2022 Analog Devices, Inc. Happy New Year! > + * Mfd core driver for the MAX77540 and MAX77541 MFD > + */ ... > + ret = devm_regmap_add_irq_chip(dev, max77541->regmap, irq, > + IRQF_ONESHOT | IRQF_SHARED, 0, > + &max77541_buck_irq_chip, > + &max77541->irq_buck); > + if (ret) > + return ret; > + > + if (max77541->id == MAX77541) { > + ret = devm_regmap_add_irq_chip(dev, max77541->regmap, irq, > + IRQF_ONESHOT | IRQF_SHARED, 0, > + &max77541_adc_irq_chip, > + &max77541->irq_adc); > + if (ret) > + return ret; > + } > + return ret; return 0; ... > + return devm_mfd_add_devices(dev, -1, max77540_devs, PLATFORM_DEVID_NONE ? > + ARRAY_SIZE(max77540_devs), > + NULL, 0, NULL); ... > + return devm_mfd_add_devices(dev, -1, max77541_devs, Ditto. > + ARRAY_SIZE(max77541_devs), > + NULL, 0, NULL); ... > +static int max77541_i2c_probe(struct i2c_client *client, > + const struct i2c_device_id *id) No id, please. I.o.w. you should use ->probe_new(). > +{ > + struct device *dev = &client->dev; > + struct max77541 *max77541; > + const void *match; > + > + max77541 = devm_kzalloc(&client->dev, sizeof(*max77541), GFP_KERNEL); > + if (!max77541) > + return -ENOMEM; > + > + i2c_set_clientdata(client, max77541); > + max77541->i2c = client; > + > + match = device_get_match_data(dev); > + if (match) > + max77541->id = (enum max7754x_ids)match; This is dangerous if your enum has 0 as a valid value. Instead, use pointers in the driver_data, like &chip_info chip[MAX77540] > + else if (id) > + max77541->id = id->driver_data; > + else It's better to check the ID range here. Or since the change recommended above, check for NULL. > + return -ENODEV; > + > + max77541->chip = &chip[max77541->id]; > + > + max77541->regmap = devm_regmap_init_i2c(client, > + &max77541_regmap_config); > + if (IS_ERR(max77541->regmap)) > + return dev_err_probe(dev, PTR_ERR(max77541->regmap), > + "Failed to allocate register map\n"); > + > + return max77541_pmic_setup(dev); > +} ... > +/*BITS OF REGISTERS*/ Missing spaces. -- With Best Regards, Andy Shevchenko