linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manavendra Nath Manav <mnm.kernel@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: kernelnewbies@kernelnewbies.org, devel@driverdev.osuosl.org,
	Greg KH <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: Why exported const value modified by another driver not updated in original driver
Date: Wed, 5 Sep 2012 13:57:07 +0530	[thread overview]
Message-ID: <CAJKgH8BkV0iRH8DN8-Y=LqvY90DHFOT_iqjTx1szgssPriThdg@mail.gmail.com> (raw)
In-Reply-To: <20120904122544.GC19396@mwanda>

On Tue, Sep 4, 2012 at 5:55 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> On Tue, Sep 04, 2012 at 03:58:20PM +0530, Manavendra Nath Manav wrote:
>> Is the above a genuine kernel bug, or i am missing something out here. Pls help.
>>
>
> When you declare something as const then the compiler assumes it
> really is const and uses a literal instead of reading from memory.
> I'm surprised the compiler doesn't print a warning message.
>
> It has to do with compilers, nothing to do with kernels.
>
> regards,
> dan carpenter

Thanks All,
I understood the problem and current gcc behaviour after looking at
output of objdump of driver.ko file when the variable is declared as
"const" and in second case as "const volatile". The compiler optimises
by directly passing the value in first case and the address of
variable in second case. Thanks for all the help and clarification.

push   $0x7b         // 123 in decimal
push   $0x0

-- 
Manavendra Nath Manav

  reply	other threads:[~2012-09-05  8:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-04  9:30 Why exported const value modified by another driver not updated in original driver Manavendra Nath Manav
2012-09-04 10:28 ` Manavendra Nath Manav
2012-09-04 10:39   ` Julian Andres Klode
2012-09-04 10:59     ` Manavendra Nath Manav
2012-09-04 11:49       ` Chinmay V S
2012-09-04 12:25   ` Dan Carpenter
2012-09-05  8:27     ` Manavendra Nath Manav [this message]
2012-09-04 10:46 ` Alan Cox
2012-09-04 12:06 ` Bernd Petrovitsch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJKgH8BkV0iRH8DN8-Y=LqvY90DHFOT_iqjTx1szgssPriThdg@mail.gmail.com' \
    --to=mnm.kernel@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).