CFI changes:

* Support the absence of protection registers for Intel CFI flashes
 * Replace zero-length array with flexible-arrays
 -----BEGIN PGP SIGNATURE-----
 
 iQFEBAABCAAuFiEEyRC2zAhGcGjrhiNExEYeRXyRFuMFAl7M2JMQHHZpZ25lc2hy
 QHRpLmNvbQAKCRDERh5FfJEW4wPtB/9yqMGejoFX8QLvtFLBCH9XZhuxRSXH3qCO
 JXaqIrGSPBA3zb3po8z7dN5PoKUFQStXL8KrP1XcYKnZCE5l5p1qeSeYh3pBBmuN
 eWuNCTwEco6h0SSjEw/AWjJ47MhV9Cp+vg7KmozLR1zrg+DJvdeURA0cj/DI5gNL
 9DQDlxS7+WuejFAwYEKajDvrYZRqUF/XrfUtPxg9mrXsrwf0iPSra0zZ9ia+qZbE
 sYw9EXngnf3NmSfrDQ0Y+g3ViqxTZBhrFN8MDnn/L3rCCv7llGxm0aC4mPWN5BRx
 pinhIfFWZMgMSdvRG9sLN4qOT1SDRGG5HYpR67LGsObAFLnMGWS+
 =jReG
 -----END PGP SIGNATURE-----

Merge tag 'cfi/for-5.8' of gitolite.kernel.org:pub/scm/linux/kernel/git/mtd/linux into mtd/next

CFI changes:

* Support the absence of protection registers for Intel CFI flashes
* Replace zero-length array with flexible-arrays
This commit is contained in:
Richard Weinberger 2020-06-03 09:21:52 +02:00
commit 48e9912e03
3 changed files with 12 additions and 9 deletions

View File

@ -420,8 +420,9 @@ read_pri_intelext(struct map_info *map, __u16 adr)
extra_size = 0;
/* Protection Register info */
extra_size += (extp->NumProtectionFields - 1) *
sizeof(struct cfi_intelext_otpinfo);
if (extp->NumProtectionFields)
extra_size += (extp->NumProtectionFields - 1) *
sizeof(struct cfi_intelext_otpinfo);
}
if (extp->MinorVersion >= '1') {
@ -695,14 +696,16 @@ static int cfi_intelext_partition_fixup(struct mtd_info *mtd,
*/
if (extp && extp->MajorVersion == '1' && extp->MinorVersion >= '3'
&& extp->FeatureSupport & (1 << 9)) {
int offs = 0;
struct cfi_private *newcfi;
struct flchip *chip;
struct flchip_shared *shared;
int offs, numregions, numparts, partshift, numvirtchips, i, j;
int numregions, numparts, partshift, numvirtchips, i, j;
/* Protection Register info */
offs = (extp->NumProtectionFields - 1) *
sizeof(struct cfi_intelext_otpinfo);
if (extp->NumProtectionFields)
offs = (extp->NumProtectionFields - 1) *
sizeof(struct cfi_intelext_otpinfo);
/* Burst Read info */
offs += extp->extra[offs+1]+2;

View File

@ -138,7 +138,7 @@ struct cfi_ident {
uint16_t InterfaceDesc;
uint16_t MaxBufWriteSize;
uint8_t NumEraseRegions;
uint32_t EraseRegionInfo[0]; /* Not host ordered */
uint32_t EraseRegionInfo[]; /* Not host ordered */
} __packed;
/* Extended Query Structure for both PRI and ALT */
@ -165,7 +165,7 @@ struct cfi_pri_intelext {
uint16_t ProtRegAddr;
uint8_t FactProtRegSize;
uint8_t UserProtRegSize;
uint8_t extra[0];
uint8_t extra[];
} __packed;
struct cfi_intelext_otpinfo {
@ -286,7 +286,7 @@ struct cfi_private {
map_word sector_erase_cmd;
unsigned long chipshift; /* Because they're of the same type */
const char *im_name; /* inter_module name for cmdset_setup */
struct flchip chips[0]; /* per-chip data structure for each chip */
struct flchip chips[]; /* per-chip data structure for each chip */
};
uint32_t cfi_build_cmd_addr(uint32_t cmd_ofs,

View File

@ -24,7 +24,7 @@ struct lpddr_private {
struct qinfo_chip *qinfo;
int numchips;
unsigned long chipshift;
struct flchip chips[0];
struct flchip chips[];
};
/* qinfo_query_info structure contains request information for