Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp557163ybi; Fri, 12 Jul 2019 00:42:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4xc4Q6Xp12KXDiVxdLQ8rNHjkrewCGGwN1NLKHl1dsyK0vVg0Eh+xTfi8983o4iPbNAt3 X-Received: by 2002:a63:ff20:: with SMTP id k32mr9174310pgi.445.1562917378848; Fri, 12 Jul 2019 00:42:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562917378; cv=none; d=google.com; s=arc-20160816; b=YTItAarNrP0EnpU+vmdzl1YIMcmJNBTpgIWhvbVsW3xV+DQptdqWLDo8HX1Cezn20F sxmeQLcqxwsHnXP58CKyqObP9nY9Fj4XYkFCDPcNgYRRf00WifWqs2h5RU7xMyxxky2S 8389rkgZs+msPnopHB2z5Qd7pn50v3PZ/V6tqIrivaQenqlHkzShdfr1bjqIJuuFAoN9 mALhCudBZpttIfuoBhSJdcqUP6bAqvCVyq9byWslgwzknb+Tg6RVDD3ne7dexUI7sMdv 4aAuCsU27Ap2gtjSaDCe50/Yu11YPQt1KJUBP93Hj6oWzBHS7Y5ilQ6UUuwrcEK6A0xa IZJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=sQb+wG8KbcMHt+hDgtfCOkS3NuXUeaF+K79Qj58/biQ=; b=Y82t5xjvvBAOm/zwubLVfZ9H0euCGS2Ydh06f1GqPnq3HRcWBU3yY+6/5QOaKw25BE TT9GWmkVb+Lbpoot3TAOutP48w0tyNWMQmLmWGpwvyF5tkNeWr73F+2oGNEJxQpHB0g8 tGis8/w/Sc3KCqfeymj11ymdudpiAQuWIdnKsK2NQTdHeHoFYp/NUSYPEPATnQ77qK8g /LBWtmFUhFl4lR2jo272hgGtqZXfFR55NigVt4JjOlFaUoPpsk/mmr3n9ND9d66K2Wnh mlU2SMBLya6ECxA/j+n5h+OPux1zVemUly6ab0N9VNul1qhOvdFUnW08P3KyCmtCEKcj SZGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v20si7405923pjn.27.2019.07.12.00.42.43; Fri, 12 Jul 2019 00:42:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726074AbfGLHmi (ORCPT + 99 others); Fri, 12 Jul 2019 03:42:38 -0400 Received: from s3.sipsolutions.net ([144.76.43.62]:54126 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726159AbfGLHmi (ORCPT ); Fri, 12 Jul 2019 03:42:38 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1hlqCR-00053a-UH; Fri, 12 Jul 2019 09:42:36 +0200 Message-ID: Subject: Re: [PATCH v2 02/16] wilc1000: add wilc_hif.c From: Johannes Berg To: Ajay.Kathat@microchip.com, linux-wireless@vger.kernel.org Cc: gregkh@linuxfoundation.org, kvalo@codeaurora.org, Adham.Abozaeid@microchip.com, Venkateswara.Kaja@microchip.com, Nicolas.Ferre@microchip.com, Claudiu.Beznea@microchip.com Date: Fri, 12 Jul 2019 09:42:34 +0200 In-Reply-To: <1562896697-8002-3-git-send-email-ajay.kathat@microchip.com> References: <1562896697-8002-1-git-send-email-ajay.kathat@microchip.com> <1562896697-8002-3-git-send-email-ajay.kathat@microchip.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-3.fc28) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org > +struct wilc_set_multicast { > + u32 enabled; > + u32 cnt; > + u8 *mc_list; > +}; > + > +struct wilc_del_all_sta { > + u8 assoc_sta; > + u8 mac[WILC_MAX_NUM_STA][ETH_ALEN]; > +}; > + > +struct wilc_op_mode { > + __le32 mode; > +}; > + > +struct wilc_reg_frame { > + bool reg; > + u8 reg_id; > + __le16 frame_type; > +} __packed; 'bool' is a pretty bad idea, there's no storage guarantee for it. Use u8 instead, especially in a firmware struct. But overall, if I remember correctly, this is a massive improvement, last time I looked I think you basically had something like char msg[10]; int i = 0; msg[i++] = reg; msg[i++] = reg_id; msg[i++] = frame_type >> 8; msg[i++] = (u8)frame_type; so obviously this is *much* better. I still think you'd benefit from putting the firmware API structs into a separate include file so you can differentiate them, but YMMV. > +int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type, > + u8 *ch_freq_list, u8 ch_list_len, > + void (*scan_result_fn)(enum scan_event, > + struct wilc_rcvd_net_info *, void *), > + void *user_arg, struct cfg80211_scan_request *request) > +{ > + int result = 0; > + struct wid wid_list[5]; > + wid_list[index].id = WID_INFO_ELEMENT_PROBE; > + wid_list[index].type = WID_BIN_DATA; > + wid_list[index].val = (s8 *)request->ie; > + wid_list[index].size = request->ie_len; > + index++; > + > + wid_list[index].id = WID_SCAN_TYPE; > + wid_list[index].type = WID_CHAR; > + wid_list[index].size = sizeof(char); > + wid_list[index].val = (s8 *)&scan_type; > + index++; I still find this whole wid_list stuff to be a bit confusing, especially since it looks like a *firmware* thing but then you have the *host pointer* inside the value ... There must be a translation layer somewhere, but I can't help but wonder if that's really worth the complexity, vs. just building the right thing directly here (with some helpers perhaps). johannes