Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp348385ybr; Fri, 22 May 2020 08:04:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbJLlasIQNgJhFoLYa2UENjI4xFVSVuxF7WAmIWWSa61aNsaOnkBnfuE4Yfslfme1kAaeE X-Received: by 2002:a17:906:2c03:: with SMTP id e3mr8376242ejh.206.1590159879404; Fri, 22 May 2020 08:04:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590159879; cv=none; d=google.com; s=arc-20160816; b=VNiuCRLDsv/Uior1icByCGnUXUJ5/dMNIcLxbIIRaj3+d0d2oYDvdYtxKApIFBzkrY GWPWGjejZ7w7bY4vGJgaxhndOYaHzNrMhKf3P2HY4DPmy1yo6h0VUOfoHtZuHuz8e4nG lOhWb/oKnh/4G2Z8VYuUZwbGS8+iETIvbPYGgCV/KgD+s3Sdg1vM01H20TWm7pZggCYC I0fgxzOy7aHcrGYtWjPlQySCloW3JOlMEz5OEw/RHQJA7z9YWs12PE1dJX7JS1dL8Itx WWaTIn2Pfi6iqiZQ4t2V7frHlD5nNE1VVBiONwk+gWnSuY+iS4QsLbWFSQRCK5rGIpKR gwAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=dkxEj1coOfFtDRdGk3SHlsiZ4KhnaU7casF53YxwhU0=; b=IxVv9EJoVcaVIv8I3r/JbISknRX0nthgbOa3bG3Qm7Ph5stjIxbV3tqpvQCeir8bCG YbAognzMj2xwFvSR7gObARamENVbnfh3vNLICFlfMakAR3nqvHZHe7vHggx6u61sUOAL Zg/BfShR+zP+4NiWaCimk546fijrL9Fx3a+vwK9iFabwTfFW3qhO0roB6FNhZwv5KbbT to/XAoE3xh0xci6Xzi9X+yr0RClLQyD16aG9SrF8zYiYj8ruZ+ZyBJRY+jeLltyqwtL9 3ou6i71JnDpREcYkPUfOdITGmlu+roBqeAWgVLobNI01WWSG/ohPiVtB2raJDzEdJ+Rn 7/1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=Q68AtwCb; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z13si5475015ejl.473.2020.05.22.08.04.14; Fri, 22 May 2020 08:04:39 -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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=Q68AtwCb; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730307AbgEVPCf (ORCPT + 99 others); Fri, 22 May 2020 11:02:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730050AbgEVPCc (ORCPT ); Fri, 22 May 2020 11:02:32 -0400 Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12288C061A0E for ; Fri, 22 May 2020 08:02:32 -0700 (PDT) Received: by mail-qk1-x744.google.com with SMTP id i5so10906666qkl.12 for ; Fri, 22 May 2020 08:02:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=dkxEj1coOfFtDRdGk3SHlsiZ4KhnaU7casF53YxwhU0=; b=Q68AtwCbz8IXixg1Uv4JuWkQ/dS2CfBaNQlV3gMnByIVeI6j/GvmAfME+iKXxJ0KDB nnwMs2C8RhJ/lGobWxPffVUcGTzVwRhI7bmIinrBQIVwE9PD+hwyBH1MQ1mIlG1o0Lrg k3yKlXRa7zUNA0osoCCV4GAbD6XdNd/IkBBOM/gWIhTs7azCEzkx0yi6NwlLwffLOoyW twVYFHZ46gAUn6FmFpdhPIMPjv4OzLlyHosrBX+kmE3Gj4sNZO2VCnjV+CL2ad69b4Z4 9VxRkUDHFjzarPLdcJ8I7fWevXAwuekDxAXylXfy2NuO4ZpDcWL4KKk5l7VuwWNI8tl6 fCYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=dkxEj1coOfFtDRdGk3SHlsiZ4KhnaU7casF53YxwhU0=; b=DPPeTO4VmBAMJjb//M3ttMHzfJYHllB0qZgHqRsxs0nTRGNxums4T1IXpMB5k32tAe HRfkOluXG0K4DBQPQ/tqzqiYevdqHM/Ob6XFsJe6frip15FM9jbMLKoMCluKDNtey/3I OnuHkvrXheLpoVSJLcjZV3/r4X7MvmFKwSL29kqs623dVPIT6Q5PuHRb7PhjmIOXDDpf LQ4FFN/PcvrkrLDfib+lfTWUWgN9IoIZR7eXlKUPeRO+0rbaathwTIgRRUXQ/ycotguf o9Tpwg/Tepwblkyw/ptHU8WK0p2C9NhC1V1GJ3UrxwM7+NMmJj0A2M8IfwTA97hsFayp 6u5g== X-Gm-Message-State: AOAM532Byo+vmzcpv2V5mCfr0kw0lKglOcA1eilhQGXhxcWr9tAGit1H 6s/iLaUY85zgbNDtFbJiiDc2TVd3XzqPZtM3DbKJwQ== X-Received: by 2002:a05:620a:6bc:: with SMTP id i28mr15831334qkh.330.1590159751249; Fri, 22 May 2020 08:02:31 -0700 (PDT) MIME-Version: 1.0 References: <1589461212-27357-1-git-send-email-alencar.fmce@imbel.gov.br> In-Reply-To: <1589461212-27357-1-git-send-email-alencar.fmce@imbel.gov.br> From: Bartosz Golaszewski Date: Fri, 22 May 2020 17:02:19 +0200 Message-ID: Subject: Re: [PATCH] gpio: gpio-max730x: bring gpiochip_add_data after port config To: Rodrigo Alencar <455.rodrigo.alencar@gmail.com> Cc: linux-gpio , LKML , Linus Walleij , Rodrigo Alencar Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org czw., 14 maj 2020 o 15:00 Rodrigo Alencar <455.rodrigo.alencar@gmail.com> napisa=C5=82(a): > > gpiochip_add_data being called before might cause premature calls of > the gpiochip operations before the port_config values are initialized, > which would possibily write zeros to port gonfiguration registers, > an operation not allowed. For example, if there are gpio-hog nodes > in a device-tree, the sequence of function calls are performed > > gpiochip_add_data > of_gpiochip_add > of_gpiochip_scan_gpios > of_gpiochip_add_hog > gpiod_hog > gpiochip_request_own_desc > gpiod_configure_flags > gpiod_direction_output/gpiod_direction_input > > which would call later the gpiochip operation direction_output or > direction_input prior the port_config[] initialization. > > Moreover, gpiochip_get_data is replaced by the container_of macro > inside the gpiochip operations, which would allow the calling of > max7301_direction_input prior to gpiochip_add_data > > Signed-off-by: Rodrigo Alencar <455.rodrigo.alencar@gmail.com> Applied with some tweaks to the commit message. Bartosz