mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>,
	Yinghai Lu <yhlu.kernel@gmail.com>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] resources: fix call to alignf() in allocate_resource()
Date: Sun, 20 Dec 2009 10:33:05 -0800 (PST)	[thread overview]
Message-ID: <alpine.LFD.2.00.0912201026570.3712@localhost.localdomain> (raw)
In-Reply-To: <20091220095001.GA6029@comet.dominikbrodowski.net>



On Sun, 20 Dec 2009, Dominik Brodowski wrote:
>
> The second parameter to alignf() in allocate_resource() must
> reflect what new resource is attempted to be allocated, else
> functions like pcibios_align_resource() (at least on x86) or
> pcmcia_align() can't work correctly.
> 
> Commit 1e5ad9679016275d422e36b12a98b0927d76f556 broke this by
> setting the "new" resource until we're about to return success.
> To keep the resource untouched when allocate_resource() fails,
> a "tmp" resource is introduced.

Ack. That was subtle. 

That said, maybe a nicer fix to this would be to actually return 'start' 
from the 'alignf' macro. That "modify the resource inside the alignment 
function" thing was always pretty ugly.

And then we'd pass in 'start' instead of 'size' (I have _no_ idea why we 
pass in 'size' to the alignment function, but whatever).

We'd still need to pass in the 'struct resource', but that would be so 
that it can figure out 'flags' (and 'size' if it really needs it) from it, 
but now it would be for reading only. So we could mark it 'const'.

Comments?

But Dominik's patch is ok too - the problem is not his patch, it's our 
longstanding horrible sh*t-for-brains calling convention (for which you 
can probably blame me - mea culpa).

		Linus

  reply	other threads:[~2009-12-20 18:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-20  9:50 Dominik Brodowski
2009-12-20 18:33 ` Linus Torvalds [this message]
2009-12-20 22:12   ` Bjorn Helgaas
2009-12-21  8:40   ` Dominik Brodowski
2009-12-21 16:03     ` Linus Torvalds
2010-01-01 16:38       ` [RFC] improve alignf() calling convention " Dominik Brodowski
2010-01-01 16:40         ` [PATCH 1/2] resource: align functions now return start of resource Dominik Brodowski
2010-01-01 22:12           ` Yinghai Lu
2010-01-03 16:30             ` Dominik Brodowski
2010-01-15 18:23           ` Jesse Barnes
2010-01-01 16:40         ` [PATCH 2/2] resource: mark struct resource as const Dominik Brodowski
2010-01-14  7:28       ` why can not receive kernel mail anymore? goldenwang1979

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=alpine.LFD.2.00.0912201026570.3712@localhost.localdomain \
    --to=torvalds@linux-foundation.org \
    --cc=bjorn.helgaas@hp.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@dominikbrodowski.net \
    --cc=yhlu.kernel@gmail.com \
    /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

Powered by JetHome