* [U-Boot] fs/fat alignment
@ 2012-03-03 22:05 Eric Nelson
2012-03-03 22:05 ` [U-Boot] fs/fat: align disk buffers on cache line to enable DMA and cache Eric Nelson
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Eric Nelson @ 2012-03-03 22:05 UTC (permalink / raw)
To: u-boot
Note that checkpatch fails on this patch with the following warning,
but I'm not sure how to resolve it.
Nothing else in the U-Boot code base seems to use __align() although
it's defined in include/linux/compiler-gcc.h.
#46: FILE: fs/fat/fat.c:432:
+__attribute__ ((__aligned__ (ARCH_DMA_MINALIGN)))
WARNING: __aligned(size) is preferred over __attribute__((aligned(size)))
#46: FILE: fs/fat/fat.c:432:
+__attribute__ ((__aligned__ (ARCH_DMA_MINALIGN)))
total: 0 errors, 2 warnings, 47 lines checked
^ permalink raw reply [flat|nested] 6+ messages in thread* [U-Boot] fs/fat: align disk buffers on cache line to enable DMA and cache 2012-03-03 22:05 [U-Boot] fs/fat alignment Eric Nelson @ 2012-03-03 22:05 ` Eric Nelson 2012-03-03 23:14 ` Mike Frysinger 2012-03-03 23:14 ` [U-Boot] fs/fat alignment Mike Frysinger 2012-03-03 23:50 ` Wolfgang Denk 2 siblings, 1 reply; 6+ messages in thread From: Eric Nelson @ 2012-03-03 22:05 UTC (permalink / raw) To: u-boot Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com> --- fs/fat/fat.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 1f95eb4..c924ec0 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -31,6 +31,7 @@ #include <fat.h> #include <asm/byteorder.h> #include <part.h> +#include <malloc.h> /* * Convert a string to lowercase. @@ -62,7 +63,7 @@ static int disk_read(__u32 block, __u32 nr_blocks, void *buf) int fat_register_device (block_dev_desc_t * dev_desc, int part_no) { - unsigned char buffer[dev_desc->blksz]; + ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz); /* First close any currently found FAT filesystem */ cur_dev = NULL; @@ -293,7 +294,7 @@ get_cluster (fsdata *mydata, __u32 clustnum, __u8 *buffer, return -1; } if (size % mydata->sect_size) { - __u8 tmpbuf[mydata->sect_size]; + ALLOC_CACHE_ALIGN_BUFFER(__u8, tmpbuf, mydata->sect_size); idx = size / mydata->sect_size; ret = disk_read(startsect + idx, 1, tmpbuf); @@ -428,7 +429,7 @@ static int slot2str (dir_slot *slotptr, char *l_name, int *idx) * into 'retdent' * Return 0 on success, -1 otherwise. */ -__attribute__ ((__aligned__ (__alignof__ (dir_entry)))) +__attribute__ ((__aligned__ (ARCH_DMA_MINALIGN))) __u8 get_vfatname_block[MAX_CLUSTSIZE]; static int @@ -709,7 +710,7 @@ read_bootsectandvi (boot_sector *bs, volume_info *volinfo, int *fatsize) return -1; } - block = malloc(cur_dev->blksz); + block = memalign(ARCH_DMA_MINALIGN, cur_dev->blksz); if (block == NULL) { debug("Error: allocating block\n"); return -1; @@ -828,7 +829,7 @@ do_fat_read (const char *filename, void *buffer, unsigned long maxsize, } mydata->fatbufnum = -1; - mydata->fatbuf = malloc(FATBUFSIZE); + mydata->fatbuf = memalign(ARCH_DMA_MINALIGN, FATBUFSIZE); if (mydata->fatbuf == NULL) { debug("Error: allocating memory\n"); return -1; -- 1.7.9 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] fs/fat: align disk buffers on cache line to enable DMA and cache 2012-03-03 22:05 ` [U-Boot] fs/fat: align disk buffers on cache line to enable DMA and cache Eric Nelson @ 2012-03-03 23:14 ` Mike Frysinger 0 siblings, 0 replies; 6+ messages in thread From: Mike Frysinger @ 2012-03-03 23:14 UTC (permalink / raw) To: u-boot Acked-by: Mike Frysinger <vapier@gentoo.org> -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part. URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120303/8fefca1e/attachment.pgp> ^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] fs/fat alignment 2012-03-03 22:05 [U-Boot] fs/fat alignment Eric Nelson 2012-03-03 22:05 ` [U-Boot] fs/fat: align disk buffers on cache line to enable DMA and cache Eric Nelson @ 2012-03-03 23:14 ` Mike Frysinger 2012-03-03 23:50 ` Wolfgang Denk 2 siblings, 0 replies; 6+ messages in thread From: Mike Frysinger @ 2012-03-03 23:14 UTC (permalink / raw) To: u-boot On Saturday 03 March 2012 17:05:37 Eric Nelson wrote: > Note that checkpatch fails on this patch with the following warning, > but I'm not sure how to resolve it. > > Nothing else in the U-Boot code base seems to use __align() although > it's defined in include/linux/compiler-gcc.h. > > #46: FILE: fs/fat/fat.c:432: > +__attribute__ ((__aligned__ (ARCH_DMA_MINALIGN))) > > WARNING: __aligned(size) is preferred over __attribute__((aligned(size))) > #46: FILE: fs/fat/fat.c:432: > +__attribute__ ((__aligned__ (ARCH_DMA_MINALIGN))) > > total: 0 errors, 2 warnings, 47 lines checked it's easy enough to include linux/compiler.h and use __align() -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part. URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120303/58259b4e/attachment.pgp> ^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] fs/fat alignment 2012-03-03 22:05 [U-Boot] fs/fat alignment Eric Nelson 2012-03-03 22:05 ` [U-Boot] fs/fat: align disk buffers on cache line to enable DMA and cache Eric Nelson 2012-03-03 23:14 ` [U-Boot] fs/fat alignment Mike Frysinger @ 2012-03-03 23:50 ` Wolfgang Denk 2012-03-04 0:54 ` Eric Nelson 2 siblings, 1 reply; 6+ messages in thread From: Wolfgang Denk @ 2012-03-03 23:50 UTC (permalink / raw) To: u-boot Dear Eric Nelson, In message <1330812338-25820-1-git-send-email-eric.nelson@boundarydevices.com> you wrote: > > Note that checkpatch fails on this patch with the following warning, > but I'm not sure how to resolve it. > > Nothing else in the U-Boot code base seems to use __align() although > it's defined in include/linux/compiler-gcc.h. __align != __aligned And __aligned() is used ina few places (arch/x86/cpu/interrupts.c, drivers/net/davinci_emac.c, drivers/net/calxedaxgmac.c). Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de It may be bad manners to talk with your mouth full, but it isn't too good either if you speak when your head is empty. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] fs/fat alignment 2012-03-03 23:50 ` Wolfgang Denk @ 2012-03-04 0:54 ` Eric Nelson 0 siblings, 0 replies; 6+ messages in thread From: Eric Nelson @ 2012-03-04 0:54 UTC (permalink / raw) To: u-boot On 03/03/2012 04:50 PM, Wolfgang Denk wrote: > Dear Eric Nelson, > > In message<1330812338-25820-1-git-send-email-eric.nelson@boundarydevices.com> you wrote: >> >> Note that checkpatch fails on this patch with the following warning, >> but I'm not sure how to resolve it. >> >> Nothing else in the U-Boot code base seems to use __align() although >> it's defined in include/linux/compiler-gcc.h. > > __align != __aligned > > And __aligned() is used ina few places (arch/x86/cpu/interrupts.c, > drivers/net/davinci_emac.c, drivers/net/calxedaxgmac.c). > Thanks again. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-03-04 0:54 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-03-03 22:05 [U-Boot] fs/fat alignment Eric Nelson 2012-03-03 22:05 ` [U-Boot] fs/fat: align disk buffers on cache line to enable DMA and cache Eric Nelson 2012-03-03 23:14 ` Mike Frysinger 2012-03-03 23:14 ` [U-Boot] fs/fat alignment Mike Frysinger 2012-03-03 23:50 ` Wolfgang Denk 2012-03-04 0:54 ` Eric Nelson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox