From owner-freebsd-hackers@freebsd.org Wed Jun 5 15:18:26 2019 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31A4915B0FBB for ; Wed, 5 Jun 2019 15:18:26 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1a.eu.mailhop.org (outbound1a.eu.mailhop.org [52.58.109.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D52887381 for ; Wed, 5 Jun 2019 15:18:25 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1559747896; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=u3XH8EsPeXQZskbsgMyNo8eImlwdRJcqaw/Heb+aeqG90M0d4gf+M8hi22feNfx02xutuSghrEPOc zkynGOaxzr7qrjAWPWok87TIxo7VHx4upQwvvME23U89FmxCGfVJ15Uz9Yn/PN1AE5kuEgT+bKI5Ve GBjadjOrUGCxyuY/DXHYHPIWrSXxI24jrI9YSKHVt7DUcrYdLRVjmd7GUJdfblWSd6kfokSJz6/McN NAi9ErsB2RBwJHWu3Vb1oEMMJsirvjvwtpCeFGnMksTg7ctUF5PwTCA9WDoQSurkFEMtRjwyF+y+zU GIBhKhErwuUFMtYr9Q3s69TpqLJlsgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=A955583kopOD5rC6xvaqKBxUet+XAlusa9lNvsrGaYU=; b=wO4ufBSSBXD0bMCa6pgSz6hmeDsENJ7pg0DemdqW8cMnw7Bid1GB9S2hdhGPiN5HmpJ2R0zvEnPYA tIek2Qn/wtZyM8NOt2MvXG5qTMR6OVWz5aACreYIZKeKDpXUph1cJJjj/pFSVIPPhw9oeAlWHAvDDW sK81hlGx0HXGFC06qmy2ZluhYVdiZFp9HnfgDWlcmVoMJogeJgX3SxS4pqKVZUt1RLGyeOx7Rzb+9Z IvS6vARYk5xXoQ6hc2AEAaJaArn1w0iUpFvK6OwTAKhSn1AMr1sCCeaQ656/WARHeJvQwKmm5Ubwuw VptxYOMz9CtVtnMf0SDHWaVWpqTKhVw== ARC-Authentication-Results: i=1; outbound2.eu.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=A955583kopOD5rC6xvaqKBxUet+XAlusa9lNvsrGaYU=; b=VYyUICLz40+k/nRjW8fkdJkdve46aRV7o+w2W4h8//aq1etK0F/rX9hqSOCf0RSrcrk2602eihPgt eFGVpDaLvKsqahRRYCthmS9pR7IubyF6tI8ySNu5x+XF8XjuAgeCMHdRLXYj0RTx9qnRtPCZm7091v uPsXSAO2YiakJ8A4yYHucCpe3k16QDEmGs7hLgLQKR8jlnla4D3V3urCoXJBg5wdCZuM48/ohVb0sx 88taHn3k99EWHMaD1Y8tO84M8vlxh9CejgvhhwXzqbqdnPoi7lLwjSTKTUQunKJEWxhPlFqvAtPE3J eRN9UKEwbQJqX+jWBRet7BkyOuTRd+A== X-MHO-RoutePath: aGlwcGll X-MHO-User: 22431261-87a5-11e9-85c6-c97e5c048ed3 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound2.eu.mailhop.org (Halon) with ESMTPSA id 22431261-87a5-11e9-85c6-c97e5c048ed3; Wed, 05 Jun 2019 15:18:14 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x55FICKf064579; Wed, 5 Jun 2019 09:18:12 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <9b8fd356d0002e60a1beda621730f1d8861d5d91.camel@freebsd.org> Subject: Re: setting driver properties for a particular device From: Ian Lepore To: Andriy Gapon , Michael Zhilin Cc: FreeBSD Hackers Date: Wed, 05 Jun 2019 09:18:12 -0600 In-Reply-To: <5ac39749-3aca-c4c9-56d2-b17d77ca318b@FreeBSD.org> References: <201905231115.x4NBFMSu037564@repo.freebsd.org> <523f92fe-c106-db6b-00d9-356913fdca5d@FreeBSD.org> <1a8fe3f8-a4d7-44f9-2b90-8b70e158f661@FreeBSD.org> <5ac39749-3aca-c4c9-56d2-b17d77ca318b@FreeBSD.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 3D52887381 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.99 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.989,0]; ASN(0.00)[asn:16509, ipnet:52.58.0.0/15, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2019 15:18:26 -0000 On Wed, 2019-06-05 at 16:21 +0300, Andriy Gapon wrote: > On 30/05/2019 00:40, Ian Lepore wrote: > > On Wed, 2019-05-29 at 13:31 +0300, Andriy Gapon wrote: > > > On 29/05/2019 13:29, Michael Zhilin wrote: > > > > Hi, > > > > > > > > There are kenv and sysctl. Is it far from what you are looking for? > > > > > > No. When I said programmatically, I meant programmatically from > > > within the kernel. > > > > > > > Hmmm. Whatever you do, it's going to amount to a conspiracy of > > agreement between the driver that wants to set this info and the driver > > that is expected to act on it. So if you don't use the existing hints > > mechanism, then you'll have to invent something new, and the gpioled > > driver will have to be updated to also check that new mechanism to see > > if there is any config info there that affects it. I'm not sure that's > > a big win over the slight inelegance of crafting a hint string at > > runtime. > > I think you are right. > Probably, I am going to add a helper function to make that job easier. > E.g., something like > set_dev_hint(device_t dev, const char *name, const char *val); > or perhaps > set_dev_hint(device_t dev, const char *name, const char *fmt, ...); I like the second one. I think it will be pretty likely that the hints people want to set will involve numbers, so if the only interface was to pass a string, that just means snprintf() or sbuf-print stuff in every driver that wants to use it. Might as well just do the printf implementation in the function everyone already has to call. -- Ian