Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1159429ybk; Sat, 16 May 2020 02:55:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynQ5bwb+dwJfIc4ywanMRiQrM+MNEZSAX/5jURfmnmaaKuePQ5NLursF7tSIFSycydR7xD X-Received: by 2002:a50:e696:: with SMTP id z22mr2527448edm.231.1589622931315; Sat, 16 May 2020 02:55:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589622931; cv=none; d=google.com; s=arc-20160816; b=Z9gU6UdtYp3bDLsE58n8eUJ3lNyAFTupkcI0sFLyYDUhESh6vMaTDYLK0octaBzSSe XwlRC9T+aBMzLk8xpTyCMKDCth4E/Pcm7DdmZ81PU/x3OYaWBm0+9GiwtU7O0bKBzUaL yKKmlvT8xafNWkFWRYbp9WXt6y8C3aX8aR//Ec+5UL9TNHUkA++D7n+MZoNCfhRf9tk8 PNor8i2WM6H0TrrHEVXKp/6cteqBYu1dxvJwv6/gEwBIV7CWygWlS6SZAZKngbdk/od1 LAWlHlRhLczyF0mFjoo/p9M+PBfjA2VsZni0DQnBQZ4OZosid2FOOTh6P/iVvafNzusc NETg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=1GD9cgKsC79o9xJsFY0Rns6nb+f4FHwgFZwwSnHIkTc=; b=oHRqWMto45e51A1vH20iRZEzuIKju9rrznKOGTt3o5RYeK5l/Ee8DF7Z/j/tl2JxaC LEnlYt/CJS+oQbw4AQH1vftT0nt+cD0Qe/lLnJEcUJ3YNr82tl9i4bPb5tI0c+X+4TAz XcnEJRijN/r++icmggb4zQeDE76zjQnbK3tV+JSFq/O5xwcWAwLtWMuWIdNUY89Nh/Rq e845UMWs/CZorAphe5cAWHbBbAq/WuljE/9KIzRYKIPnbgAFT3TMGn2Dz93aPcP0TWK3 uAiC+xrJIxSJnc0iv8HhFen4r8lKXP/pZ1opKAMzhB7jVDmEWH2vcDCnU17soCtIVayK VCeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sb2u9Onl; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dk26si1772941edb.179.2020.05.16.02.55.05; Sat, 16 May 2020 02:55:31 -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=@linaro.org header.s=google header.b=sb2u9Onl; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727006AbgEPJu6 (ORCPT + 99 others); Sat, 16 May 2020 05:50:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726188AbgEPJu5 (ORCPT ); Sat, 16 May 2020 05:50:57 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7162FC061A0C for ; Sat, 16 May 2020 02:50:57 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id o14so4799935ljp.4 for ; Sat, 16 May 2020 02:50:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1GD9cgKsC79o9xJsFY0Rns6nb+f4FHwgFZwwSnHIkTc=; b=sb2u9OnlDoL8lkNLTwelDEfXi/WEWCJjI3l+P0QcJOHgy9wSzCLwwc1VkUZa/OoGnA DUue2YQa+84RNibQpALhfGWyLO8ISaZJBZ1i14d3Bhsg3yV4Xc+OFzhPNdhl4rYe2Djb fBewE/WyObg4MkP3XmpHGrl8BoGlq6sLUMPkJciEZ+nkRZgpOy1xSOpdFjmRzqhveq9O FHDUEd1RqoBo7lNAbzOR4vGEWR2FTJXpv70HrrPfekZeZEE6PLmHRR7P76kOM+FaQcMK 2FUlRXgnq+TCik3LC9RMsq2UCen8+25JIeP8m2wepXbgzJzUM6wk076iGwXin06dzd39 UVSw== 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; bh=1GD9cgKsC79o9xJsFY0Rns6nb+f4FHwgFZwwSnHIkTc=; b=FTtrkkN7I2kmJn062dJ/Cn2LR1VgGFgU8kASuvgWD58gAUlOE0HG6MudfiAlmVZwzg wcfoANhtgGSOK+MNWl+TLJYVj0qldVQVrkem7LmJAzDZBHMPsCR/mJizEdkNWi/Ge2ra PlzEk5V5A9f55pWU7u/0gAvLL6Shpir5z+hbImvXMDcgDK/7llqZ1Qf32+mJGRvlTv8Z 8WptQX4mULlBQ96HANsJ2fQQdvAjegvw1TWO+pzT6lCQPaXByUPPa+v+yJ1BEDSdzvJ8 lzqKz2PbSFTvTRIBPHepoze9fcQGVaq8MLwVznc3cRqoPZZZC6Ga99b6SuY2s6irD/0i Lg7A== X-Gm-Message-State: AOAM532Eh0G7zV/JRrVorK1g5TdpfWPH9+a665oIyDAxfnZHDAkphGVA iFJxLRgnprQqVjljzMC6ybE8HZxf+Rx7tTgl5ofnM5xFlOk= X-Received: by 2002:a05:651c:154:: with SMTP id c20mr4472762ljd.99.1589622655910; Sat, 16 May 2020 02:50:55 -0700 (PDT) MIME-Version: 1.0 References: <20200224094158.28761-1-brgl@bgdev.pl> <20200224094158.28761-3-brgl@bgdev.pl> In-Reply-To: From: Linus Walleij Date: Sat, 16 May 2020 11:50:45 +0200 Message-ID: Subject: Re: [PATCH 2/3] gpiolib: use kref in gpio_desc To: Bartosz Golaszewski Cc: Srinivas Kandagatla , Khouloud Touil , Geert Uytterhoeven , "open list:GPIO SUBSYSTEM" , "linux-kernel@vger.kernel.org" , Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 14, 2020 at 3:42 PM Bartosz Golaszewski wrote: > So this "numbing down" of the chip works - in that I don't see any > splat in the above use-case but right now if nvmem takes an existing > GPIO descriptor over nvmem_config, then it will call gpiod_put() on it > and we'll do the same in the provider driver leading to the following > warning: Isn't that the WARN_ON(extra_checks) in gpiod_free()? What part of the if() clause is causing this? I.e.: if (desc && desc->gdev && gpiod_free_commit(desc)) ... I suspect gpiod_free_commit() is causing it by returning nonzero. We could essentially ignore that if and only if the gpio_chip has been detached from the gpio_device. This should fix the problem if I'm right. Yours, Linus Walleij