From: "Uwe Kleine-König" <ukleinek@informatik.uni-freiburg.de>
To: linux-kernel@vger.kernel.org
Subject: several wrong sections for probe functions of platform drivers
Date: Tue, 2 Sep 2008 23:05:02 +0200 [thread overview]
Message-ID: <20080902210501.GA4306@informatik.uni-freiburg.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 1012 bytes --]
Hello,
I wrote a small python script that extracts the section specifier for
probe functions of platform drivers and warns if it's != __devinit.
The script is attached.
It's not always an error if the probe function is defined using __init,
but then (AFAIK) it should not be passed in the struct platform_driver!?
With Linus' current tree (v2.6.27-rc5-55-gafa153f) I get 215 matches
with
1x __devexit
67x __init
146x no section
and one match that isn't interpreted correctly by my script.
I think the __devexit case is definitly wrong. I will do a deeper look
and then probably send a patch for that one as a follow up to this mail.
I didn't (yet) checked the other cases, but I expect that most of them
need fixing.
Would it make sense to start collecting such scripts in the vanilla
tree?
I appreciate any constructive feedback.
Best regards
Uwe
--
Uwe Kleine-König
If a lawyer and an IRS agent were both drowning, and you could only save
one of them, would you go to lunch or read the paper?
[-- Attachment #2: probe_in_init.py --]
[-- Type: text/x-python, Size: 1020 bytes --]
#! /usr/bin/python
import os
import re
re_probename = re.compile('struct\s+platform_driver\s+(?P<drivername>\S+)\s*=\s*{.*\.probe\s*=\s*(?P<probefunction>[A-Za-z0-9_]*)', re.S)
for dirpath, dirnames, filenames in os.walk('.'):
for f in filter(lambda s: s.endswith('.c'), filenames):
fullf = os.path.join(dirpath, f)
content = open(fullf).read()
matchdict = dict(filename=fullf)
mo = re_probename.search(content)
if mo:
matchdict.update(mo.groupdict())
else:
continue
re_section = re.compile('int\s+(?:(?P<probesection>__(?:dev)?(?:init|exit)+)\s+)?%(probefunction)s\s*\(' % matchdict)
mo = re_section.search(content)
if mo:
matchdict.update(mo.groupdict())
else:
matchdict['probesection'] = ''
if matchdict['probesection'] != '__devinit':
print 'probe function %(probefunction)r for %(drivername)r (%(filename)s) defined in section %(probesection)r' % matchdict
next reply other threads:[~2008-09-02 21:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-02 21:05 Uwe Kleine-König [this message]
2008-09-02 21:15 ` [PATCH] Fix section for probe and remove function for Apple SMU Controller Uwe Kleine-König
2008-09-05 14:38 ` Jean Delvare
2008-09-08 12:13 ` [PATCH] Fix section for sa11xx-uda1341 platform driver Uwe Kleine-König
2008-09-08 18:51 ` [RESEND, PATCH] " Uwe Kleine-König
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=20080902210501.GA4306@informatik.uni-freiburg.de \
--to=ukleinek@informatik.uni-freiburg.de \
--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
all inboxes | Powered by JetHome®