All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: #2 (Re: More modaliases + patchtool)
@ 2010-09-16 20:23 Denis Kaganovich
  0 siblings, 0 replies; 29+ messages in thread
From: Denis Kaganovich @ 2010-09-16 20:23 UTC (permalink / raw)
  To: Rusty Russell; +Cc: linux-kernel, jeremy, dmitry.torokhov, akpm

--- 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


^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2010-09-17 18:09 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <4C6BE292.3060307@bspu.unibel.by>
2010-08-19  0:50 ` More modaliases + patchtool Rusty Russell
2010-08-19 14:58   ` #3 (Re: More modaliases + patchtool) Dzianis Kahanovich
     [not found]   ` <4C6D26BC.9040805@bspu.unibel.by>
2010-09-11  2:14     ` #2 " 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
2010-09-17 10:55       ` pci: Re: #2 (Re: More modaliases + patchtool)) Dzianis Kahanovich
2010-09-17 13:11       ` Dzianis Kahanovich
2010-09-17 13:26       ` xenbus: " Dzianis Kahanovich
2010-09-17 18:09         ` Jeremy Fitzhardinge
2010-09-17 13:27       ` usb: " Dzianis Kahanovich
2010-09-17 13:29       ` serio: " Dzianis Kahanovich
2010-09-17 13:29       ` pnp: " Dzianis Kahanovich
2010-09-17 13:32       ` of: " Dzianis Kahanovich
2010-09-17 13:35       ` i2c: " Dzianis Kahanovich
2010-09-17 14:06         ` Mark Brown
2010-09-17 15:47           ` Dzianis Kahanovich
2010-09-17 15:54             ` Mark Brown
2010-09-17 13:36       ` hid: " Dzianis Kahanovich
2010-09-17 13:36       ` dio: " Dzianis Kahanovich
2010-09-17 13:37       ` ccw: " Dzianis Kahanovich
2010-09-17 13:38       ` acpi: " Dzianis Kahanovich
2010-09-17 13:38       ` spi " Dzianis Kahanovich
2010-09-17 13:39       ` RapidIO: " Dzianis Kahanovich
2010-09-17 13:42       ` platform: " Dzianis Kahanovich
2010-09-17 13:54         ` Mark Brown
2010-09-17 15:55       ` acpi (signed): " Dzianis Kahanovich
2010-09-16 20:23 #2 (Re: More modaliases + patchtool) Denis Kaganovich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.