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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,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 4A98DC43382 for ; Wed, 26 Sep 2018 11:37:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0E564214C5 for ; Wed, 26 Sep 2018 11:37:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0E564214C5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728249AbeIZRtj (ORCPT ); Wed, 26 Sep 2018 13:49:39 -0400 Received: from mga14.intel.com ([192.55.52.115]:39696 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727003AbeIZRtj (ORCPT ); Wed, 26 Sep 2018 13:49:39 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Sep 2018 04:37:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,306,1534834800"; d="scan'208";a="93394694" Received: from kuha.fi.intel.com ([10.237.72.189]) by fmsmga001.fm.intel.com with SMTP; 26 Sep 2018 04:36:26 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Wed, 26 Sep 2018 14:36:25 +0300 Date: Wed, 26 Sep 2018 14:36:25 +0300 From: Heikki Krogerus To: Matthias Kaehlcke Cc: Greg Kroah-Hartman , "Rafael J . Wysocki" , Sakari Ailus , Marcin Wojtas , Andy Shevchenko Andy Shevchenko , Sinan Kaya , Marcel Holtmann , Johan Hedberg , Andrew Morton , Pekka Enberg , Masahiro Yamada , Alexey Dobriyan , linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, Balakrishna Godavarthi , Loic Poulain , Brian Norris Subject: Re: [PATCH v3.1 1/2] device property: Add device_get_bd_address() and fwnode_get_bd_address() Message-ID: <20180926113625.GM11965@kuha.fi.intel.com> References: <20180925191014.85573-1-mka@chromium.org> <20180925191014.85573-2-mka@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180925191014.85573-2-mka@chromium.org> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 25, 2018 at 12:10:13PM -0700, Matthias Kaehlcke wrote: > +/** > + * fwnode_get_bd_address - Get the Bluetooth Device Address (BD_ADDR) from the > + * firmware node > + * @fwnode: Pointer to the firmware node > + * @bd_addr: Pointer to struct to store the BD address in > + * > + * Search the firmware node for 'local-bd-address'. > + * > + * All-zero BD addresses are rejected, because those could be properties > + * that exist in the firmware tables, but were not updated by the firmware. For > + * example, the DTS could define 'local-bd-address', with zero BD addresses. > + */ > +int fwnode_get_bd_address(struct fwnode_handle *fwnode, bdaddr_t *bd_addr) > +{ > + bdaddr_t ba; > + int ret; > + > + ret = fwnode_property_read_u8_array(fwnode, "local-bd-address", > + (u8 *)&ba, sizeof(bdaddr_t)); > + if (ret < 0) > + return ret; > + if (is_zero_ether_addr((u8 *)&ba)) > + return -ENODATA; > + > + memcpy(bd_addr, &ba, sizeof(bdaddr_t)); > + > + return 0; > +} > +EXPORT_SYMBOL_GPL(fwnode_get_bd_address); > + > +/** > + * device_get_bd_address - Get the Bluetooth Device Address (BD_ADDR) for a > + * given device > + * @dev: Pointer to the device > + * @bd_addr: Pointer to struct to store the BD address in > + */ > +int device_get_bd_address(struct device *dev, bdaddr_t *bd_addr) > +{ > + return fwnode_get_bd_address(dev_fwnode(dev), bd_addr); > +} > +EXPORT_SYMBOL_GPL(device_get_bd_address); Let's not fill property.c with framework specific helper functions any more! Those functions are completely bluetooth specific, so they do not belong here. The fact that some other framework already managed to slip their helpers in does not justify others to do the same. Thanks, -- heikki