Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965941AbbBDVKA (ORCPT ); Wed, 4 Feb 2015 16:10:00 -0500 Received: from senator.holtmann.net ([87.106.208.187]:41367 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964887AbbBDVJ4 convert rfc822-to-8bit (ORCPT ); Wed, 4 Feb 2015 16:09:56 -0500 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Subject: Re: [PATCH v2] net: bluetooth: hci_sock: Use 'const void *' instead of 'void *' for 2nd parameter of hci_test_bit() From: Marcel Holtmann In-Reply-To: <54D27D68.7040501@cogentembedded.com> Date: Wed, 4 Feb 2015 13:09:47 -0800 Cc: David Laight , Chen Gang S , "Gustavo F. Padovan" , Johan Hedberg , "David S. Miller" , "linux-bluetooth@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Transfer-Encoding: 8BIT Message-Id: <0AB99BEA-C379-439C-AD80-5F2122AE37E5@holtmann.org> References: <54CFE8BE.5030700@sunrus.com.cn> <063D6719AE5E284EB5DD2968C1650D6D1CADA5E1@AcuExch.aculab.com> <54D27D68.7040501@cogentembedded.com> To: Sergei Shtylyov X-Mailer: Apple Mail (2.2070.6) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1063 Lines: 27 Hi Sergei, >>> -static inline int hci_test_bit(int nr, void *addr) >>> +static inline int hci_test_bit(int nr, const void *addr) >>> { >>> return *((__u32 *) addr + (nr >> 5)) & ((__u32) 1 << (nr & 31)); >>> } > >> Is there a 'standard' function lurking that will do the above. >> On x86 the cpus 'bit test' instruction will handle bit numbers >> greater than the word size - so it can be a single instruction. > > Of course, there's test_bit(). we did leave hci_test_bit in the code since there are some userspace facing API that we can not change. Remember that the origin of this code is from 2.4.6 kernel. So we can only change this if you can ensure not to break the userspace API. So might want to write unit tests to ensure working HCI filter before even considering touching this. Regards Marcel -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/