Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7054917rwr; Tue, 2 May 2023 08:55:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ68PIxFn+VO2NDb5CwCaNStrjXXvWRKOXiN1ytrAQHYwBWfv7iWAD70G2pyumme8N9S0i7d X-Received: by 2002:a17:90a:f496:b0:248:8399:1f7c with SMTP id bx22-20020a17090af49600b0024883991f7cmr17834754pjb.38.1683042943936; Tue, 02 May 2023 08:55:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683042943; cv=none; d=google.com; s=arc-20160816; b=ZtaHW/EasXzXNLbAA/vGBIx/ijG9fxI9bm1Sjn3XUGTacG5rlg88wgYxSn/bM0Eblo 22MUngpDtLfXoFPHDEbzSC6dK6IcON9V5zem5+6wZwQiz3g95sxD6DC7Rl7TOosNS3Xr PgkQfALREJ3LwTEqrVq3mqHsVgaZRd6fuCMpttDgVEFmPkL6bXoCOdxRxFVFbPvV86lx e7djo64TSavZNWAOXXFtBdpxgOLgv8pTNWK1uD5S5kQznkgxWGOk4VWXzawDlJ9jD18i nBwlyTKnl6MMurrz00oFvdz0B2hPcPHn7MotG6ycFinvJ1ZbsvrPM0Tjaab0wn+B0DcF F4yg== 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:date:from; bh=Cap0ZrzTiH8TJvKmgROkoh3ojLl5lhkaBVw/7rqjz3U=; b=lOv66KKpPxzUu97C+uMUzN08+AfQIQ1da9Hog80g5c8cB/y9lYFTV1YCzVTL+b6n3+ oqVce13tVLHwilp0HSVL9xhAq0biNZyIAbIP+Y+rkl2gkC3MI8+Qrf/Atml5k8OoL8AS G9ZfUZgm3kmEBJOR/HnzeIkZQf4cjl9g/0vO2duO1iM7mxSZeqTVh0sbW/NLNto5gwRl sdhCVdFyPUkDKL2bS3D9eKWM4t+y9UviT1V7trvBX0W5NWfDYcAndmPCCp7LtacGDNvH HCaDCsQP8lrXZBZ6pA+RncME9tby/XlYxaxQDvsUNapS65VGmP654VRwXFn9znS6toIo CR0Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w14-20020a1709029a8e00b001a6bb7b7a44si28970003plp.307.2023.05.02.08.55.29; Tue, 02 May 2023 08:55:43 -0700 (PDT) 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; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233724AbjEBPzK (ORCPT + 99 others); Tue, 2 May 2023 11:55:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234389AbjEBPzI (ORCPT ); Tue, 2 May 2023 11:55:08 -0400 Received: from fgw23-7.mail.saunalahti.fi (fgw23-7.mail.saunalahti.fi [62.142.5.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9333F1BF for ; Tue, 2 May 2023 08:55:07 -0700 (PDT) Received: from localhost (88-113-26-95.elisa-laajakaista.fi [88.113.26.95]) by fgw23.mail.saunalahti.fi (Halon) with ESMTP id b418ae39-e901-11ed-b972-005056bdfda7; Tue, 02 May 2023 18:55:04 +0300 (EEST) From: andy.shevchenko@gmail.com Date: Tue, 2 May 2023 18:55:04 +0300 To: Okan Sahin Cc: Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] gpio: ds4520: Add ADI DS4520 GPIO Expander Support Message-ID: References: <20230501230517.4491-1-okan.sahin@analog.com> <20230501230517.4491-3-okan.sahin@analog.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230501230517.4491-3-okan.sahin@analog.com> X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no 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 Tue, May 02, 2023 at 02:05:16AM +0300, Okan Sahin kirjoitti: > The DS4520 is a 9-bit nonvolatile (NV) I/O expander. > It offers users a digitally programmable alternative > to hardware jumpers and mechanical switches that are > being used to control digital logic node. ... > +#include > +#include > +#include > +#include Missing property.h. > +#include ... > +#define NUMBER_OF_GPIO 9 > + > +#define PULLUP0 0xF0 > +#define IO_CONTROL0 0xF2 > +#define IO_STATUS0 0xF8 No namespace for the above? ... > + struct gpio_regmap_config config = {0}; 0 is not needed. > + ngpio = NUMBER_OF_GPIO; Do you really need this? Can Device Tree be sufficient here? (We have a GPIO-wide property for that). ... > + ret = device_property_read_u32(dev, "reg", &base); > + if (ret) > + return -EINVAL; Why shadowing error? ... > + regmap = devm_regmap_init_i2c(client, &ds4520_regmap_config); > + if (IS_ERR(regmap)) { > + ret = PTR_ERR(regmap); > + dev_err_probe(dev, ret, > + "Failed to allocate register map\n"); > + return ret; return dev_err_probe(); > + } ... > + config.ngpio = ngpio; Why do you use temporary variable ngpio and not assign directly here? -- With Best Regards, Andy Shevchenko