Re: More modaliases + patchtool

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

 



Jon Masters пишет:
>> Some of modules have no MODULE_DEVICE_TABLE(...) and do not export hardware
>> ("pnp") aliases, but have all required data to do this. I found it after
>> ioatdma module (currently fixed in tree). This information may be useful to
>> hardware/modules detection.

> Thanks for the patch. linux-modules is mostly for userspace
> module-init-tools (modprobe, etc.) however I will take a look at your
> patch. You might also want to send this to Rusty Russell (the kernel
> side maintainer) for his opinion prior to/at the same time as posting to
> the LKML upstream. Thanks again.

After post, I found next related problem: some of modules (scx200_acb.c and
pch_dma.c) have not NULL-terminated pci_device_id record. Prior I just exclude
scx200_acb, now pch_dma is new (in 2.6.36). To be correct, pch_dma exclusion
must be added to patch-script or both modules may be fixed - just add array
element:
static const struct pci_device_id ... = {
...
	{ 0, }		
}

Or change in script:
*/scx200_acb.c|*/mdio-gpio.c)
to
*/scx200_acb.c|*/mdio-gpio.c|*/pch_dma.c)
(attached)

In case scx200_acb.c & pch_dma.c will be fixed - this exclusion may be removed
(mdio-gpio.c was buggy only in older kernels).

PS Thanks, now posting all to Rusty Russel.

-- 
WBR, Dzianis Kahanovich AKA Denis Kaganovich, http://mahatma.bspu.unibel.by/
#!/bin/bash
## (c) Denis Kaganovich
## v4
## grep-pcre required

#BUS="pci"
BUS="\w+"

STR="^(?:static\s+)?(?:const\s+)?struct\s+"

fnd(){
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#/}"

	# add NULL element into scx200_acb.c & pch_dma.c pci_device_id and may remove "case"
	case $ii in
	*/scx200_acb.c|*/mdio-gpio.c|*/pch_dma.c)
		echo "BROKEN: $bus: $ii"
		continue
	;;
	esac

	bus="${bus%%_*}"
	local BU
	case "$bus" in
	sdio)BU=MMC;;
	*)BU="${bus^^}";;
	esac
	if grep -Prq "^\s*(?:menu)?config\s+$BU(?:\s.*)?$" $1 --include="Kconfig*"; then
		echo "Fixing: $BU: ($n) $ii"
		sed -i -e 's/^\(module_init.*\)$/\n#ifdef CONFIG_'"$BU"'\nMODULE_DEVICE_TABLE('"$bus, $n"');\n#endif\n\n\1/' $i
	else
		echo "Fixing: $bus: ($n) $ii"
		sed -i -e 's/^\(module_init.*\)$/\nMODULE_DEVICE_TABLE('"$bus, $n"');\n\n\1/' $i
	fi
done
}

[[ -z "$1" ]] && echo "$0 <path_to_kernel>" && exit 1

fnd $*

[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux