Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758702AbbBGTxA (ORCPT ); Sat, 7 Feb 2015 14:53:00 -0500 Received: from smtprelay0089.hostedemail.com ([216.40.44.89]:52765 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756054AbbBGTw7 (ORCPT ); Sat, 7 Feb 2015 14:52:59 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::,RULES_HIT:41:355:379:541:599:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:1801:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3150:3352:3622:3865:3866:3867:3868:3870:3871:3872:3873:4321:4384:4605:5007:6261:7903:7904:10004:10400:10471:10848:11026:11232:11658:11914:12043:12517:12519:12740:13069:13153:13228:13255:13311:13357:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: worm22_70ea8f8bd2e5e X-Filterd-Recvd-Size: 2527 Message-ID: <1423338774.2933.9.camel@perches.com> Subject: Re: [PATCH v3] net: bluetooth: hci_sock: Use 'const u32 *' instead of 'void *' for 2nd parameter of hci_test_bit() From: Joe Perches To: Chen Gang S Cc: David Laight , Marcel Holtmann , Sergei Shtylyov , "Gustavo F. Padovan" , Johan Hedberg , "David S. Miller" , "linux-bluetooth@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" Date: Sat, 07 Feb 2015 11:52:54 -0800 In-Reply-To: <54D61229.9010904@sunrus.com.cn> References: <54D61229.9010904@sunrus.com.cn> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.7-0ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1524 Lines: 34 On Sat, 2015-02-07 at 21:24 +0800, Chen Gang S wrote: > hci_test_bit() does not modify 2nd parameter, so it is better to let it > be constant, or may cause build warning. The related warning (with > allmodconfig under xtensa): > > net/bluetooth/hci_sock.c: In function 'hci_sock_sendmsg': > net/bluetooth/hci_sock.c:955:8: warning: passing argument 2 of 'hci_test_bit' discards 'const' qualifier from pointer target type [-Wdiscarded-array-qualifiers] > &hci_sec_filter.ocf_mask[ogf])) && > ^ > net/bluetooth/hci_sock.c:49:19: note: expected 'void *' but argument is of type 'const __u32 (*)[4] {aka const unsigned int (*)[4]}' > static inline int hci_test_bit(int nr, void *addr) > ^ > > hci_test_bit() always treats 2nd parameter is u32, and all callers also > know about it, so 2nd parameter of hci_test_bit() need use 'const u32 *' > instead of 'void *'. > > C language treats the array function parameter as a pointer, so the > caller need not use '&' for the 2 demotion array, or it reports warning: > 'const unsigned int (*)[4]' is different with 'const unsigned int *'. I still think you are possibly papering over potential bugs on big-endian 64 bit systems. unsigned long vs u32. How are the bits actually set? -- 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/