From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED, USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8A8EC43381 for ; Thu, 14 Mar 2019 14:58:42 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5E00A20811 for ; Thu, 14 Mar 2019 14:58:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kroah.com header.i=@kroah.com header.b="CbKiq4+4"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="I9Fp26CE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E00A20811 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kroah.com Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=kernelnewbies-bounces@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.91) (envelope-from ) id 1h4Ro2-0000EO-8Y; Thu, 14 Mar 2019 10:58:02 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by shelob.surriel.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1h4Rnz-0000EI-OJ for kernelnewbies@kernelnewbies.org; Thu, 14 Mar 2019 10:58:00 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id EB28A21C08; Thu, 14 Mar 2019 10:57:50 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 14 Mar 2019 10:57:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=jN0QQ8rUqaSAWufkLU4t7RBKdYL Q2pkHcnP9c9FHc2o=; b=CbKiq4+4rDpjfwxArXiXyI9Ah6ftxo3ue6GorEs1Pvq T8EGAOa8TiedgixFT0AYBzMgRsOTzDSB1Vn4S9LAsA+6cMhhYoJpgcUyfwnxqd2G t5/quOYc4+oSaOIl4cWhXzeM+/Du2DFLZx1gB0qV9m7hPt0KI76g4Z6s8uQtq4JX zPgEUBCWOjRa8/U1p7EmXhUctKsRmhgfOKV9rp9OJCJ1u+5p23OsdywQAfHddW+K JOH2AWcluvE2gxTn7t74tvxns2RgAL0HzahXRHaGUJo1D1dG0YaliaJpXGMAD3uT V0pXHPoXWuMBlUO9/RSoV9urRykU+qpnTDpLuJGoCCg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=jN0QQ8 rUqaSAWufkLU4t7RBKdYLQ2pkHcnP9c9FHc2o=; b=I9Fp26CEtavFlFwQv17/Wq OTvLI/6Gaf+CEp6cvVoHmQChmUdyM/yX9RoIsmiFIlyo6zRyunz/RHTr0NGZDWqL SM71ZyRXUTbw0AhOP7Flbi+UW8tyqNyjB93/Xz7zDm6a3+kviR1xRL5FxTE/Kk7H yuZkAyecYjDEgy5waoqlckhIX0Dp146da6HGL/DBEnB7O/eKXu0AktJXkaHwF1bN BmG0jtaJJyYSvdQMansXqGUhRJo0OfG1HVAldAou2gZBPI25W5orM8pRUJGBcslU fNhNNVs9uEcRZObbL0lkUSbiOlmxPc0DgSTfmHQDHznfZDqha9UedUDihZn2Dg0w == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrhedvgdejudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujggfsehttdertddtredvnecuhfhrohhmpefirhgvghcu mffjuceoghhrvghgsehkrhhorghhrdgtohhmqeenucfkphepuddvrddvjedrieehrddvvd dunecurfgrrhgrmhepmhgrihhlfhhrohhmpehgrhgvgheskhhrohgrhhdrtghomhenucev lhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from localhost (unknown [12.27.65.221]) by mail.messagingengine.com (Postfix) with ESMTPA id 32B98E4580; Thu, 14 Mar 2019 10:57:50 -0400 (EDT) Date: Thu, 14 Mar 2019 07:57:49 -0700 From: Greg KH To: Jay Aurabind Subject: Re: Using binary attributes for configuration sysfs entries Message-ID: <20190314145749.GB12576@kroah.com> References: <20190313142529.GA5715@kroah.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) Cc: kernelnewbies X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org On Thu, Mar 14, 2019 at 04:17:13PM +0530, Jay Aurabind wrote: > On Wed, 13 Mar 2019 at 19:55, Greg KH wrote: > > > > On Wed, Mar 13, 2019 at 12:02:02PM +0530, Jay Aurabind wrote: > > > Hi, > > > > > > Before I send this patch to actual mailing list, I'd appreciate if > > > someone could tell me if this is a bad idea! > > > > > > The driver in staging for pi433 (a wireless transceiver) uses IOCTLs > > > at the moment. I wish to add a sysfs interface to it that control the > > > various transmission and reception parameters. In the ioctl interface, > > > it uses two structs that have about 40 parameters in total. > > > > > > For the corresponding sysfs interface, since there are a lot of > > > parameters, would it be justified to use the same binary format though > > > sysfs_create_binary_file() ? The rationale is that it would be easier > > > to simply pack all the config options in the struct and send it in > > > once rather than individually write 40 files. This is what the > > > attached patch follows. Interface is added only for reception > > > parameters as of now. > > > > binary sysfs files are only allowed for "pass through" data, where the > > kernel does not touch the information at all and only passes it from the > > hardware, to userspace directly (or the other way around). It can not > > be used for data that the kernel actually knows about and modifies / > > acts on. > > > > An example of valid binary sysfs files are USB and PCI device > > configuration information (read directly from the hardware), or firmware > > files that are send from userspace directly to the hardware without the > > kernel knowing what the data is. > > > > You can't use a binary sysfs file for ioctl-like data, that's not > > allowed, just use an ioctl for that. Or better yet, use a common api > > interface for it, to match the other types of devices. > > Thank you for the explanation. What API would the most appropriate for > such a wireless transceiver ? If I could make it as a networking > driver, I could probably use setsockopt to pass in these > configuration. Is this recommended ? No, try looking at how v4l2 works, odds are they already have the correct api for this type of device there for you to use. thanks, greg k-h _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies