From: "Denis Kaganovich" <root@eu.by>
To: "Rusty Russell" <rusty@rustcorp.com.au>
Cc: <linux-kernel@vger.kernel.org>, <jeremy@goop.org>,
<dmitry.torokhov@gmail.com>, <akpm@linux-foundation.org>
Subject: Re: #2 (Re: More modaliases + patchtool)
Date: Thu, 16 Sep 2010 13:23:03 -0700 [thread overview]
Message-ID: <20100916132303.DD13223@resin14.mta.everyone.net> (raw)
--- rusty@rustcorp.com.au wrote:
This one, too, seems to make sense.
[ Remaining 2/3 of patch cut here ].
I think the best way to split this patch is by bus type. Drop the
#ifdef's
if you think it's a good idea, do some compile testing, then forward to
the
specific maintainers for each type. I'm happy to do that for you if you
want (though these kind of patches are Morton-worthy IMHO).
Cheers,
Rusty.
===
I just seen your messages, sorry, may be not forwarded to work...
OK, I will make hand-checks and splitting, etc. About "#ifdef" ;) I add
it only after one (NOW not remember) driver from OF bus and think that
for AUTO-mode good to be always "#ifdef". I will remove ifdef's for
drivers, hardly related from its buses (this is dummy for scripting, but
easy for human).
PS Preview (or solution?), sorry attachment disabled here - this version of script with "--diff" flag will generate (in current dir) patches for BUS.patch (upcase - ifdef) and bus.patch (lowcase - no ifdef). On first look (just compile test) only OF need ifdef. Say me if there are solution, else I will post hand-verifyed results a bit later.
#!/bin/bash
## (c) Denis Kaganovich
## v6
## grep-pcre required
#BUS="pci"
BUS="\w+"
STR="^(?:static\s+)?(?:const\s+)?struct\s+"
_sed(){
local n="$1"
shift
$diff && sed "${@}" <$i |diff -pruN $i - >>$n.patch
$fix && $first && {
first=false
sed -i "${@}" $i
}
}
fnd(){
local msg="Fixing:"
$fix || msg="Need to fix:"
grep -Prhl "${STR}${BUS}_device_id\s+" $1 --include="*.c" | while read i ; do
local bus=`grep -Prho "${STR}${BUS}_device_id.*\s+" $i`
bus="${bus#*struct }"
local n="${bus%%[*}"
n="${n%%=*}"
n="${n##*device_id }"
n="${n// }"
bus="${bus%%_device_id*}"
grep -Pq "^module_init\s*\(" $i || continue
grep -q "MODULE_DEVICE_TABLE" $i && continue
local ii="${i#$1}"
ii="${ii#/}"
# case $ii in
# */mdio-gpio.c)
# echo "BROKEN: $bus: $ii"
# continue
# ;;
# esac
bus="${bus%%_*}"
local BU
case "$bus" in
sdio)BU=MMC;;
*)BU="${bus^^}";;
esac
local first=true
if grep -Prq "^\s*(?:menu)?config\s+$BU(?:\s.*)?$" $1 --include="Kconfig*"; then
echo "$msg $BU: ($n) $ii"
_sed $BU -e 's/^\(module_init.*\)$/\n#ifdef CONFIG_'"$BU"'\nMODULE_DEVICE_TABLE('"$bus, $n"');\n#endif\n\n\1/'
$diff || continue
fi
echo "$msg $bus: ($n) $ii"
_sed $bus -e 's/^\(module_init.*\)$/\nMODULE_DEVICE_TABLE('"$bus, $n"');\n\n\1/'
done
}
p=""
fix=false
diff=false
while [[ -n "$*" ]]; do
case "$1" in
--fix)fix=true;;
--diff)diff=true;;
*)p="$p $1";;
esac
shift
done
[[ -z "$p" ]] && echo "$0 [--fix] <path_to_kernel>
(grep+pcre required)" && exit 1
fnd $p
next reply other threads:[~2010-09-16 20:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-16 20:23 Denis Kaganovich [this message]
[not found] <4C6BE292.3060307@bspu.unibel.by>
2010-08-19 0:50 ` More modaliases + patchtool Rusty Russell
[not found] ` <4C6D26BC.9040805@bspu.unibel.by>
2010-09-11 2:14 ` #2 (Re: More modaliases + patchtool) Rusty Russell
2010-09-11 3:36 ` Jeremy Fitzhardinge
2010-09-13 3:03 ` Rusty Russell
2010-09-11 17:51 ` Dmitry Torokhov
2010-09-13 3:24 ` Rusty Russell
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=20100916132303.DD13223@resin14.mta.everyone.net \
--to=root@eu.by \
--cc=akpm@linux-foundation.org \
--cc=dmitry.torokhov@gmail.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mahatma@eu.by \
--cc=rusty@rustcorp.com.au \
/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
all inboxes | Powered by JetHome®