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.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_PASS,USER_AGENT_MUTT autolearn=unavailable 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 6A3B0C04AA5 for ; Mon, 15 Oct 2018 18:51:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 334202145D for ; Mon, 15 Oct 2018 18:51:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="AcJoOG4P" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 334202145D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726836AbeJPCh7 (ORCPT ); Mon, 15 Oct 2018 22:37:59 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:40599 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726713AbeJPCh7 (ORCPT ); Mon, 15 Oct 2018 22:37:59 -0400 Received: by mail-pl1-f193.google.com with SMTP id 1-v6so9731280plv.7 for ; Mon, 15 Oct 2018 11:51:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=DWciO0XBN3UW6fn55r9D0ORvUXjAdv8IMu+2+L7MJCc=; b=AcJoOG4PlDVljWnnONd00UzurFoAYE23LtI8MUX3Fs+D9siEzOmuajLIFGksaar5ys sog0gg363LWiPBADrsH089Kusm3iQGVOsCwftLL1symwncmRGK39Wd/g0UkY18bjVqYA CIoZtHM0Xz+zXGD2D+Oo+rMOBKJOxtQXWPCh0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=DWciO0XBN3UW6fn55r9D0ORvUXjAdv8IMu+2+L7MJCc=; b=G/E1548lPGxHWTwe3PFFBTD0NlDhKf0iUc3aaPBxqmZIIv/3fXAbluhD1BRo1LTHs1 jyzhMx0Ly5UTRiGL51DB2/AyABmsLlFP0Ey4xLUGwJTe+cuOLeObFE9HTGR3uCcckQI+ Xqo94fx2tL701XIc54DymOIurMoYXkqU+IGClDr+ZaFVlMGV8cLdE8I1iHg74cUAGu00 7aBBT5yD6gXeuFfgWqQFLa9+94Y57oHizY5jWoXt6bkOV+0SAnTpScrIySWwkNAXGrYs j8K+iUUcmwhUev/kCavpZpDQeNmMc7fx8LA72bJRtTlnGUWmzwVnakwuwnmcHbO5yelN PsQA== X-Gm-Message-State: ABuFfohz/Fpf5ithL648kNGEGvbIVZ2wXqrymWE/NLE9fH16Eb9CGR6F vZpptgK/AwO3k+4dQoJRXk7LlA== X-Google-Smtp-Source: ACcGV61nUcQMf/OVSXH+M1yIW4Ce3o7xMxmc3zvPhTbBMKO48Ya+NLW13+U/GA3GSAMNhGupajbrHQ== X-Received: by 2002:a17:902:205:: with SMTP id 5-v6mr18318501plc.307.1539629489504; Mon, 15 Oct 2018 11:51:29 -0700 (PDT) Received: from localhost ([2620:15c:202:1:b6af:f85:ed6c:ac6a]) by smtp.gmail.com with ESMTPSA id l10-v6sm15873841pgs.45.2018.10.15.11.51.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 15 Oct 2018 11:51:28 -0700 (PDT) Date: Mon, 15 Oct 2018 11:51:28 -0700 From: Matthias Kaehlcke To: Marcel Holtmann , "Rafael J . Wysocki" , Greg Kroah-Hartman Cc: Sinan Kaya , Balakrishna Godavarthi , Sakari Ailus , Marcin Wojtas , Andy Shevchenko Andy Shevchenko , Johan Hedberg , LKML , Bluez mailing list , Loic Poulain , Brian Norris Subject: Re: [PATCH v4 1/2] Bluetooth: Add device_get_bd_address() Message-ID: <20181015185128.GT22824@google.com> References: <20180927004810.124185-1-mka@chromium.org> <20180927004810.124185-2-mka@chromium.org> <20180927171305.GG22824@google.com> <20181004173338.GL22824@google.com> <9B742DB5-F584-4A47-A04B-4F72EB17519C@holtmann.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <9B742DB5-F584-4A47-A04B-4F72EB17519C@holtmann.org> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On Mon, Oct 15, 2018 at 08:06:02PM +0200, Marcel Holtmann wrote: > Hi Matthias, > > >>>> void bt_sock_reclassify_lock(struct sock *sk, int proto); > >>>> > >>>> +int device_get_bd_address(struct device *dev, bdaddr_t *bd_addr); > >>> > >>> Maybe change the API name to start with bt_ and get rid of device_? > >> > >> device_ indicates that we get the BD_ADDR for a 'struct device' and > >> not for e.g. a 'struct fwnode_handle'. > >> > >> Anyway with this version of the patch fwnode_get_bd_address() has been > >> scrapped and it might never be introduced again, so I'm open to change > >> the name to bt_ if there is a general preference for it. > > > > Marcel, can you live with this being added to the Bluetooth code base > > instead of property? Also if you'd prefer the function to be named > > bt_get_bd_address() let me know. > > explain to me again why this is useful? The official binding for providing the BD_ADDR through the device tree is the property 'local-bd-address'. device_get_bd_address() provides a common API to retrieve the BD_ADDR instead of requiring BT drivers to use the lower level fwnode_property_read_u8_array(). It also avoids repeating the check for an all zeroes BD_ADDR in multiple drivers. > I am failing to see the benefit if this is not part of the property.h API. My understanding is that the intention of property.h it to provide an API for common property types used by drivers from different subsystems, hence the implementation 'lives' in drivers/base. Obtaining the BD_ADDR is clearly limited to the Bluetooth subsystem, and drivers/base doesn't seem to be the right place for it. It's true, device_get_mac_address() lives in the common property code, but that doesn't necessarily mean it really should be there and we should do the same. I agree with Sakari that the the approach taken by V4L2 (drivers/media/v4l2-core/v4l2-fwnode.c) seems more appropriate. That said I wouldn't raise opposition if the maintainers of drivers/base agreed to add device_get_mac_address() there, however so far several recent authors of property.[ch] have raised objections. Thanks Matthias