Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: wfx: remove support for legacy PDS format

We don't want to support legacy PDS format.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20220211162659.528333-3-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jérôme Pouiller and committed by
Greg Kroah-Hartman
2f8189be dcbecb49

+4 -51
+4 -51
drivers/staging/wfx/main.c
··· 163 163 return false; 164 164 } 165 165 166 - /* In legacy format, the PDS file is often bigger than Rx buffers of the chip, so it has to be sent 167 - * in multiple parts. 168 - * 169 - * In add, the PDS data cannot be split anywhere. The PDS files contains tree structures. Braces are 170 - * used to enter/leave a level of the tree (in a JSON fashion). PDS files can only been split 171 - * between root nodes. 172 - */ 173 - int wfx_send_pds_legacy(struct wfx_dev *wdev, u8 *buf, size_t len) 174 - { 175 - int ret; 176 - int start = 0, brace_level = 0, i; 177 - 178 - for (i = 1; i < len - 1; i++) { 179 - if (buf[i] == '{') 180 - brace_level++; 181 - if (buf[i] == '}') 182 - brace_level--; 183 - if (buf[i] == '}' && !brace_level) { 184 - i++; 185 - if (i - start + 1 > WFX_PDS_MAX_CHUNK_SIZE) 186 - return -EFBIG; 187 - buf[start] = '{'; 188 - buf[i] = 0; 189 - dev_dbg(wdev->dev, "send PDS '%s}'\n", buf + start); 190 - buf[i] = '}'; 191 - ret = wfx_hif_configuration(wdev, buf + start, 192 - i - start + 1); 193 - if (ret > 0) { 194 - dev_err(wdev->dev, "PDS bytes %d to %d: invalid data (unsupported options?)\n", 195 - start, i); 196 - return -EINVAL; 197 - } 198 - if (ret == -ETIMEDOUT) { 199 - dev_err(wdev->dev, "PDS bytes %d to %d: chip didn't reply (corrupted file?)\n", 200 - start, i); 201 - return ret; 202 - } 203 - if (ret) { 204 - dev_err(wdev->dev, "PDS bytes %d to %d: chip returned an unknown error\n", 205 - start, i); 206 - return -EIO; 207 - } 208 - buf[i] = ','; 209 - start = i; 210 - } 211 - } 212 - return 0; 213 - } 214 - 215 166 /* The device needs data about the antenna configuration. This information in provided by PDS 216 167 * (Platform Data Set, this is the wording used in WF200 documentation) files. For hardware 217 168 * integrators, the full process to create PDS files is described here: ··· 174 223 { 175 224 int ret, chunk_type, chunk_len, chunk_num = 0; 176 225 177 - if (*buf == '{') 178 - return wfx_send_pds_legacy(wdev, buf, len); 226 + if (*buf == '{') { 227 + dev_err(wdev->dev, "PDS: malformed file (legacy format?)\n"); 228 + return -EINVAL; 229 + } 179 230 while (len > 0) { 180 231 chunk_type = get_unaligned_le16(buf + 0); 181 232 chunk_len = get_unaligned_le16(buf + 2);