2005-05-19 11:37:50

by Yani Ioannou

[permalink] [raw]
Subject: [PATCH 2.6.12-rc4-mm2] drivers: (dynamic sysfs callbacks) update device attribute callbacks

Hi Greg,

I'm taking two steps here to try and mitigate the pain of a potential -mm merge.

I'm including a patch against 2.4.12-rc4-mm2 to fix the failed hunks
when applying my 2.4.12-rc4 patch and update the callbacks in the new
drivers that exist in -mm2.

In reply to this patch I'll include the latest perl script I'm using
to update callbacks in code which can be used to update any old
callbacks in a single file/source tree to the new callbacks. A warning
along the lines of "warning: assignment from incompatible pointer
type" when compiling is a good sign of an old callback that needs
updating..

It is important to note that unlike before, updating the callbacks
isn't just removing warnings/good practice. The new device_attribute *
parameter was not added on the end of callback function's parameter
list as the void * parameter was in previous device_attribute patches,
but as the second parameter (mainly because of style and Russell did
it that way). Thus if a device_attribute callback isn't updated it
will very likely be broken...

If you can think of anything else I can do let me know to ease things
let me know.

Yani

---
char/tpm/tpm.c | 8 ++++----
char/tpm/tpm.h | 8 ++++----
i2c/chips/adm1025.c | 8 ++++----
i2c/chips/adm9240.c | 32 ++++++++++++++++----------------
i2c/chips/atxp1.c | 12 ++++++------
i2c/chips/w83627ehf.c | 18 +++++++++---------
input/serio/serio.c | 12 ++++++------
message/fusion/mptscsih.c | 2 +-
message/fusion/mptscsih.h | 2 +-
pci/pci-sysfs.c | 2 +-
pcmcia/ds.c | 2 +-
usb/core/sysfs.c | 2 +-
12 files changed, 54 insertions(+), 54 deletions(-)
---


Attachments:
(No filename) (1.70 kB)
patch-linux-2.6.12-rc4-mm2-sysfsdyncallback-deviceattr-update.diff (21.57 kB)
Download all attachments

2005-05-19 11:46:36

by Yani Ioannou

[permalink] [raw]
Subject: Re: [PATCH 2.6.12-rc4-mm2] drivers: (dynamic sysfs callbacks) update device attribute callbacks

Ugh, forgot to sign it off, resubmitting.

Signed-off-by: Yani Ioannou <[email protected]>

Yani

On 5/19/05, Yani Ioannou <[email protected]> wrote:
> Hi Greg,
>
> I'm taking two steps here to try and mitigate the pain of a potential -mm merge.
>
> I'm including a patch against 2.4.12-rc4-mm2 to fix the failed hunks
> when applying my 2.4.12-rc4 patch and update the callbacks in the new
> drivers that exist in -mm2.
>
> In reply to this patch I'll include the latest perl script I'm using
> to update callbacks in code which can be used to update any old
> callbacks in a single file/source tree to the new callbacks. A warning
> along the lines of "warning: assignment from incompatible pointer
> type" when compiling is a good sign of an old callback that needs
> updating..
>
> It is important to note that unlike before, updating the callbacks
> isn't just removing warnings/good practice. The new device_attribute *
> parameter was not added on the end of callback function's parameter
> list as the void * parameter was in previous device_attribute patches,
> but as the second parameter (mainly because of style and Russell did
> it that way). Thus if a device_attribute callback isn't updated it
> will very likely be broken...
>
> If you can think of anything else I can do let me know to ease things
> let me know.
>
> Yani

char/tpm/tpm.c | 8 ++++----
char/tpm/tpm.h | 8 ++++----
i2c/chips/adm1025.c | 8 ++++----
i2c/chips/adm9240.c | 32 ++++++++++++++++----------------
i2c/chips/atxp1.c | 12 ++++++------
i2c/chips/w83627ehf.c | 18 +++++++++---------
input/serio/serio.c | 12 ++++++------
message/fusion/mptscsih.c | 2 +-
message/fusion/mptscsih.h | 2 +-
pci/pci-sysfs.c | 2 +-
pcmcia/ds.c | 2 +-
usb/core/sysfs.c | 2 +-
12 files changed, 54 insertions(+), 54 deletions(-)
---


Attachments:
(No filename) (1.90 kB)
patch-linux-2.6.12-rc4-mm2-sysfsdyncallback-deviceattr-update.diff (21.57 kB)
Download all attachments

2005-05-19 11:53:14

by Yani Ioannou

[permalink] [raw]
Subject: Re: [PATCH 2.6.12-rc4-mm2] drivers: (dynamic sysfs callbacks) update device attribute callbacks

Here is the previously mentioned perl script. Its quite simplistic,
and accepts the filename of a source file to update as a parameter, or
uses stdin/stdout if no parameters are given. To update a whole tree
using the below just use something like:

find linux-2.6.12-rc4 -type f -exec ./updatedyncallbackdevattr.pl {} \;

This script should catch every device_attribute callback, including
multiline function signatures and embedded in macros. If it fails to
catch something please let me know.

Thanks,
Yani

---
#!/usr/bin/perl

use strict;

my $infile=shift;

if(!defined $infile){
open(IN,"<&STDIN") or die "Could not open an input stream";
}else{
open(IN,"<$infile") or die "Could not open an input stream";
}

my $subs = 0;
my $code = "";

while(<IN>){$code.=$_};
close(IN);

$code =~ s/(ssize_t[\s\\]+?[^(;]+?\(\s*?struct[\s\\]+?(?:device)[\s\\]*?\*[^,);]*?,)([\s\\]*?char[\s\\]*?\*[^,);]*?[\s\\]*?\))/$1
struct device_attribute *attr,$2/gs && $subs++;
$code =~ s/(ssize_t[\s\\]+?[^(;]+?\(\s*?struct[\s\\]+?(?:device)[\s\\]*?\*[^,);]*?,)([\s\\]*?const[\s\\]+?char[\s\\]*?\*[^,);]*?[\s\\]*?,[\s\\]*size_t[^,);]*?[\s\\]*\))/$1
struct device_attribute *attr,$2/gs && $subs++;

if($subs){
if(!defined $infile){
open(OUT,">&STDOUT") or die "Could not open an output stream";
}else{
open(OUT,">$infile") or die "Could not open an output stream";
}
$|;
print OUT $code;
close(OUT);
$infile && print STDOUT "$infile updated.\n";
}