Re: [PATCH] Declare the file_operations struct as const

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Aug 29, 2021 at 8:17 AM Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
>
> On Sun, Aug 29, 2021 at 04:13:43AM +0200, Krish Jain wrote:
> > On Sat, Aug 28, 2021 at 1:38 AM Bryan Brattlof <hello@xxxxxxxxxxxxxxxxx> wrote:
> > > As for your patch, I built the driver using:
> > >
> > >   $ make CCFLAGS=-Werror W=1 M=drivers/staging/android
> > >
> > > Which produced the following error:
> > >
> > >
> > > drivers/staging/android/ashmem.c: In function ‘ashmem_mmap’:
> > > drivers/staging/android/ashmem.c:380:2: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration]
> > >   380 |  const static struct file_operations vmfile_fops;
> > >       |  ^~~~~
> > > drivers/staging/android/ashmem.c:431:16: error: assignment of read-only variable ‘vmfile_fops’
> > >   431 |    vmfile_fops = *vmfile->f_op;
> > >       |                ^
> > > drivers/staging/android/ashmem.c:432:21: error: assignment of member ‘mmap’ in read-only object
> > >   432 |    vmfile_fops.mmap = ashmem_vmfile_mmap;
> > >       |                     ^
> > > drivers/staging/android/ashmem.c:433:34: error: assignment of member ‘get_unmapped_area’ in read-only object
> > >   433 |    vmfile_fops.get_unmapped_area =
> > >       |                                  ^
> > > make[1]: *** [scripts/Makefile.build:271: drivers/staging/android/ashmem.o] Error 1
> > > make: *** [Makefile:1851: drivers/staging/android] Error 2
> > >
> >
> > Hi, this seems very useful and I tried this myself just now. I don't
> > get any errors that you do though. When I hit enter I just get a new
> > shell prompt. What am I doing wrong? Probably a silly mistake. I ran
> > make CCFLAGS=-Werror M=drivers/staging/android/.
>
> Are you sure the file is being built at all?  You usually have to select
> the proper configuration option to enable that driver as well.


Hi, what option do you mean?  I already ran make allmodconfig and sudo
make modules_install install and then make   "CCFLAGS=-Werror W=1
M=drivers/staging/android/" and now I do get output but one line
"WARNING: Symbol version dump "Module.symvers" is missing. Modules may
not have dependencies or modversions. You may get many unresolved
symbol warnings." . Then I tried "make CCFLAGS=-Werror V=1
M=drivers/staging/android/" and that outputted the following:


test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \
echo >&2; \
echo >&2 "  ERROR: Kernel configuration is invalid."; \
echo >&2 "         include/generated/autoconf.h or
include/config/auto.conf are missing.";\
echo >&2 "         Run 'make oldconfig && make prepare' on kernel src
to fix it."; \
echo >&2 ; \
/bin/false)
make -f ./scripts/Makefile.build obj=drivers/staging/android \
single-build= \
need-builtin=1 need-modorder=1
sh ./scripts/modules-check.sh drivers/staging/android/modules.order
make -f ./scripts/Makefile.modpost
WARNING: Symbol version dump "Module.symvers" is missing.
         Modules may not have dependencies or modversions.
         You may get many unresolved symbol warnings.
make -f ./scripts/Makefile.modfinal



I followed this and ran make oldconfig && make prepare but all that is
outputted is again  "WARNING: Symbol version dump "Module.symvers" is
missing. Modules may not have dependencies or modversions. You may get
many unresolved symbol warnings." Then I just tried sudo make
modules_install install   again and what was outputted was:


sed: can't read modules.order: No such file or directory
make[1]: *** [Makefile:1494: __modinst_pre] Error 2
make: *** [Makefile:351: __build_one_by_one] Error 2



Any ideas?  I've been stuck on debugging for hours to no avail. Please
enlighten me on where I am messing up.


Best Regards





> thanks,
>
> greg k-h





[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux