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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38085CA5537 for ; Wed, 13 Sep 2023 16:03:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230314AbjIMQDF (ORCPT ); Wed, 13 Sep 2023 12:03:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229511AbjIMQDE (ORCPT ); Wed, 13 Sep 2023 12:03:04 -0400 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 817C095 for ; Wed, 13 Sep 2023 09:03:00 -0700 (PDT) Received: (qmail 959784 invoked by uid 1000); 13 Sep 2023 12:02:57 -0400 Date: Wed, 13 Sep 2023 12:02:57 -0400 From: Alan Stern To: Linyu Yuan Cc: Greg Kroah-Hartman , Thinh Nguyen , Peter Chen , Pawel Laszczak , Roger Quadros , Linus Walleij , Chunfeng Yun , Neal Liu , Cristian Birsan , Bin Liu , Kevin Cernekee , Justin Chen , Al Cooper , Li Yang , Vladimir Zapolskiy , Daniel Mack , Haojian Zhuang , Robert Jarzmik , Philipp Zabel , Herve Codina , hierry Reding , Jonathan Hunter , Michal Simek , Rui Miguel Silva , Valentina Manea , Shuah Khan , Hongren Zheng , linux-usb@vger.kernel.org Subject: Re: [PATCH v3 01/10] usb: gadget: add anonymous definition in struct usb_gadget Message-ID: References: <20230912104455.7737-1-quic_linyyuan@quicinc.com> <20230912104455.7737-2-quic_linyyuan@quicinc.com> <2023091255-unsubtly-daisy-7426@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On Wed, Sep 13, 2023 at 11:46:12AM +0800, Linyu Yuan wrote: > but Alan Stern have one comment,   do it mean the bit position number is not > expect and we can't use it ? > > @Alan Stern ,  BIT(0), BIT(1) is not the member we expect ? They might not be. If you can avoid making this assumption, you should. > > This macro usage is a real mess. Can't you find a better way to do it? > > > > For instance, in the code that parses the trace buffer, define a > > temporary usb_gadget structure and copy the dw1 field from the trace > > buffer to the temporary structure. Then you can access the fields in > > that structure directly by their original names, with no macros. > > do it same idea just move it outside of gadget.h ? Keep the anonymous union in gadget.h, but get rid of the macros. Alan Stern