Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp409317pxj; Thu, 27 May 2021 03:11:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYkDU3WkgDdlzzo4U6l6SOYSa84fGUguVG8/Z7SeB9/mtPqAFhi5NkYq/HWoTbJUr01C8B X-Received: by 2002:a02:5142:: with SMTP id s63mr2697524jaa.82.1622110315245; Thu, 27 May 2021 03:11:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622110315; cv=none; d=google.com; s=arc-20160816; b=CxqsPEDbwhYXlYW7PGhWfNGIMjzEztzlSPyNqQG1QxG/DRe2ZP+N4ylSXO8qvmF6Vh Yk92XcYAQkP/NuO3ooJm8A/DlpEKO9cFPeN8+vN71zhwMnBF12T+XT+Ia/NgIh04YOEq Oz799Imbc7PTGvv/ihsk8ObWsbu6l6Sg7nD1J1ARMGagAPwANeCnNuUr3UlMx3K5TSoR LRZzjtljs5sS/pe/kFR1aqfN31ER38IYMrkUBY/QZBUp11tc4pGS5qmgijci4xDrxxQz S4eENSf718rQm1rfic7Tq63+7UcK/HN8IiO6G9v0tJcdmyCqcSQ8aTSUiqgoyUjGj1Dk T5lQ== 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:from:date:dkim-signature; bh=bNKkv9yJxBEyyDXHTUI6SZKiK1yjUg98KtcVpsPAERU=; b=dG/p22mhvs9So/SUWjkf/PUqilFkz13WFUX6USCJrPYUmVUFeKEGJir9l1FT/DbLrV vWVGBH3/EgvhqlgzaOsYPnZoNfDc85bFmpz6AHlYjzR0LRgIF+l6IfOnOd1Uui0cvggm bGNmbDc65lxEWFLBVBsnsgIhe7EiRhFfal0v4HDWUJ6uJQihOxcIGkssTUHRg4AL6Jf1 Xn60IHZGTGzjZT9nz9XleGjoNokjlfeLZ9/QYyRFaDIkviWJgYZOaNRvh7qBEJxPX6WJ B4H2m0V7GfM1D0E9+XJ3igeFJexcMXCdzi/m47RzFcWLT9byi7FIpDz5CASysuFMcf4l zErg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=Ad4mx7H7; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 4si1864182iln.143.2021.05.27.03.11.19; Thu, 27 May 2021 03:11:55 -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=@sirena.org.uk header.s=20170815-heliosphere header.b=Ad4mx7H7; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236008AbhE0KL6 (ORCPT + 99 others); Thu, 27 May 2021 06:11:58 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:33406 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236083AbhE0KL6 (ORCPT ); Thu, 27 May 2021 06:11:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=bNKkv9yJxBEyyDXHTUI6SZKiK1yjUg98KtcVpsPAERU=; b=Ad4mx7H7JX+wqD1k7MIb21sNfA B346yA3Yw8MFkddKzY6LWlqbCZhUMzWbR/iezUataMYFiyL/ZNPjv7PBOLxhQuQDYmEEOhRGplLWZ vbkn+rXHT4rom83k8KsYdSVirrzXy9WoKv0/LXhF0lIFROTosso3MrWBLdoEOcSpyqEE=; Received: from 94.196.90.140.threembb.co.uk ([94.196.90.140] helo=fitzroy.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1lmCy7-006Lnc-Ts; Thu, 27 May 2021 10:10:24 +0000 Received: by fitzroy.sirena.org.uk (Postfix, from userid 1000) id 8CF61D0DEC8; Thu, 27 May 2021 11:10:21 +0100 (BST) Date: Thu, 27 May 2021 11:10:21 +0100 From: Mark Brown To: Christian Gmeiner Cc: linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org Subject: Re: [PATCH] spidev: add platform driver support Message-ID: References: <20210527084531.18989-1-christian.gmeiner@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="r3c1S3HTTKrvMj23" Content-Disposition: inline In-Reply-To: <20210527084531.18989-1-christian.gmeiner@gmail.com> X-Cookie: A penny saved has not been spent. Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --r3c1S3HTTKrvMj23 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, May 27, 2021 at 10:45:15AM +0200, Christian Gmeiner wrote: > This makes it possible to use spidev in combination with the > MFD subsystem. The MFD subsystem add platform_driver devices. This is a really strange thing to want to do so it needs a changelog which explains what the goal is and why this is a good way of accomplishing that goal. > +static int spidev_platform_probe(struct platform_device *pdev) > +{ > + struct device *parent = pdev->dev.parent; > + struct spi_device *spi; > + > + if (strcmp(parent->bus->name, "spi")) > + return -ENODEV; > + > + spi = to_spi_device(parent); > + > + /* This only works if no drvdata is stored */ > + if (spi_get_drvdata(spi)) { > + dev_err(&pdev->dev, "drvdata is not NULL\n"); Why? > + return -EOPNOTSUPP; > + } > + > + return spidev_probe(spi); This really does not seem like a good idea, this is exposing the entire device to userspace in a completely unstructured fashion while there will be other drivers controlling the same hardware. That seems like it's asking for trouble, there's absolutely nothing ensuring that userspace doesn't break things the drivers are doing. I really don't think it makes sense to mix kernel drivers with unmoderated userspace access to the hardware in a single driver. > +static struct platform_driver spidev_platfoem_driver = { platfoem? --r3c1S3HTTKrvMj23 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmCvcAwACgkQJNaLcl1U h9CA1gf+LtoavMTh0+w1zEhGPCH+/YYD6y9bOFbrKoh5teYYrLwMur2ogt9d50Jw qlyqeieFrDY9hWjQcDBUnT/Lt6Z2FEZTWpp4fmvhQwLQodHHkkDbpUaTDbgHBX7E cP4jxSHa3TaecEMV+405QQmKCX6g7EQXVQygipgAcYU2bxnt89GGWxNSuSdU+0SS aWNNj/Mx21sgUzIJQ0fJ4CL8I8duBXGoj3eNj3V2WVui7dTShyZUUYYrVZ/3nQ1l UnZZX2G0YC/IARmpCPuNWtkG+S9WFgvkQ1aeC22cBkNK9d8oqFG1oonPusv0aJcc vVJcrTDQNbbLxo5iChzksEZENG0exw== =vDdo -----END PGP SIGNATURE----- --r3c1S3HTTKrvMj23--