Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1307273pxb; Sat, 30 Oct 2021 10:23:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyR+AvnTqdo2tHBQSuJ9dLLjUDpsh5WLFd003ywg+V0kys4DELdbSD6G/2bwQ2oPBNcjfY X-Received: by 2002:a05:6402:274c:: with SMTP id z12mr26485622edd.57.1635614594323; Sat, 30 Oct 2021 10:23:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635614594; cv=none; d=google.com; s=arc-20160816; b=pKbGsC0SDsHFvnG62KazyE/8GOL1s8OIHH1S/AV8q5PhRknlz3jFHx3ukxs7hQWKce lZt36J19tikfrQ0oEGJN001JZMyZD21RPBFLfy+ksAOHxpPtHALUFscEjhe4LeVWlrkY seXop5968nX3ngho3qv9tLe7VVQQGJ9gnEQjXJ7Fw+AU1Ydj5Q7kAYQpOlytVEB4f2pu lpqy9WRyp6TgT5sZBAhuhxm/5ABY52iDGF17ZDTdFcC3k675XO9F/ge5g8Mi4fYtOi0l 2SMS6/mY7rGRrM36S4Zmlm15fHIta+aXQuRr/P8OErXREOGHAEt2/ZBdP9Bh1FWHyDO1 M7ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:jabber-id:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from :dkim-signature:date; bh=Cew+vu0zze3BA5gWY6SEWbFbRZe7whWN/plb5GPTIAQ=; b=dUxYcczv1ktZt8d/dujTXirsLH7ECGJ9imKIh841acIYuisQRUdog2qK/ijHpogCYK dKfmQtmRfTElLdUZpkZIl277u54mql2Z2yX4Jxu5kcCsZrHtslGRQHh+EBZTGozu4v8D mIoC5dQDeUBPkthUSYjAgbfnLEkIAZDXAeCxt7hNLlxrbMaLPv8Ao9cdrkivab4PEaj/ whkmlbi7OS/0K54MB9TGjMQEtt16z9H2j0FDxWg7yQ/2/yb0MICdLBuuyk4WWg9HQy8S tsw0ygjRjqyu++XMBBprUe/WvOvT3ItdLfHggptf8rAYEo1TbpApJnjXmqGlpi2g1Kzt V91g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@t-8ch.de header.s=mail header.b=kv3LatTu; 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 z2si18114902edc.544.2021.10.30.10.22.50; Sat, 30 Oct 2021 10:23:14 -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=fail header.i=@t-8ch.de header.s=mail header.b=kv3LatTu; 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 S231136AbhJ3RWw (ORCPT + 99 others); Sat, 30 Oct 2021 13:22:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229474AbhJ3RWu (ORCPT ); Sat, 30 Oct 2021 13:22:50 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 097F6C061570 for ; Sat, 30 Oct 2021 10:20:18 -0700 (PDT) Date: Sat, 30 Oct 2021 19:20:16 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=t-8ch.de; s=mail; t=1635614417; bh=ifToxbXFvrqpVsPBgtjtkXpdeT5nleHplDjWdA/8Trw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kv3LatTuIWb3lGlRIL4OEPc9BDzBj2rxOx/WctWrxA91izJJfZRl+cX+aNm434Hv/ 9mxl68QL+CYVsD3AMy5Tt6zWLO3rtBHw9D0cn2Baghc9ecCFi8KBt2ULhzwKpXc3KO MGeheVaJ/8fwPDKHnLZ2GRtXlr2rQQst+fneUa/U= From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Charles Mirabile Cc: linux-kernel@vger.kernel.org, Lee Jones , Serge Schneider , Stefan Wahren , Nicolas Saenz Julienne , linux-rpi-kernel@lists.infradead.org, fedora-rpi@googlegroups.com, Mwesigwa Guma , Joel Savitz Subject: Re: [PATCH 1/5] drivers/mfd: sensehat: Raspberry Pi Sense HAT core driver Message-ID: <12caa13c-7399-49c9-9a2d-689a646891d0@t-8ch.de> References: <20211029215516.801593-1-cmirabil@redhat.com> <20211029215516.801593-2-cmirabil@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20211029215516.801593-2-cmirabil@redhat.com> Jabber-ID: thomas@t-8ch.de X-Accept: text/plain, text/html;q=0.2, text/*;q=0.1 X-Accept-Language: en-us, en;q=0.8, de-de;q=0.7, de;q=0.6 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-10-29 17:55-0400, Charles Mirabile wrote: > +static int sensehat_probe(struct i2c_client *i2c, > + const struct i2c_device_id *id) > +{ > ... > + > + sensehat->joystick.pdev = sensehat_client_dev_register(sensehat, > + "sensehat-joystick"); Will this not fail the complete driver load if the driver for this single subdevice is not available? For example if the Kconfig option has not been selected, the patch for the driver is not applied or the user has blacklisted the respective module in their system. > + if (IS_ERR(sensehat->joystick.pdev)) { > + dev_err(sensehat->dev, "failed to register sensehat-joystick"); > + return PTR_ERR(sensehat->joystick.pdev); > + } > + > + sensehat->display.pdev = sensehat_client_dev_register(sensehat, > + "sensehat-display"); Same as above. > + > + if (IS_ERR(sensehat->display.pdev)) { > + dev_err(sensehat->dev, "failed to register sensehat-display"); > + return PTR_ERR(sensehat->display.pdev); > + } > + > + return 0; > +} > + > +static struct platform_device * > +sensehat_client_dev_register(struct sensehat *sensehat, const char *name) > +{ > + long ret = -ENOMEM; > + struct platform_device *pdev = platform_device_alloc(name, -1); > + > + if (!pdev) > + goto alloc_fail; > + > + pdev->dev.parent = sensehat->dev; > + platform_set_drvdata(pdev, sensehat); > + > + ret = platform_device_add(pdev); > + if (ret) > + goto add_fail; > + > + ret = devm_add_action_or_reset(sensehat->dev, > + (void *)platform_device_unregister, pdev); > + if (ret) > + goto alloc_fail; > + > + return pdev; > + > +add_fail: > + platform_device_put(pdev); > +alloc_fail: > + return ERR_PTR(ret); > +} Thomas