Subject: Re: [PATCH 3/8] pseries: phyp dump: use sysfs to release reserved mem

From: [email-masked] (Tony Breeds)
Date: Fri, 15 Feb 2008 12:05:28 +1100

On Tue, Feb 12, 2008 at 01:11:58AM -0600, Manish Ahuja wrote:

<snip>

> +static ssize_t
> +show_release_region(struct kset * kset, char *buf)
> +{
> +	return sprintf(buf, "ola\n");
> +}
> +
> +static struct subsys_attribute rr = __ATTR(release_region, 0600,
> +					 show_release_region,
> +					 store_release_region);

Any reason this sysfs attribute can't be write only? The show method
doesn't seem needed.

> +static int __init phyp_dump_setup(void)
> +{

<snip>

> +	/* Is there dump data waiting for us? */
> +	rtas = of_find_node_by_path("/rtas");
> +	dump_header = of_get_property(rtas, "ibm,kernel-dump", &header_len);

Hmm this isn't good.  You need to check rtas != NULL.

> +	if (dump_header == NULL) {
> +		release_all();
> +		return 0;
> +	}
> +
> +	/* Should we create a dump_subsys, analogous to s390/ipl.c ? */
> +	rc = subsys_create_file(&kernel_subsys, &rr);
> +	if (rc) {
> +		printk (KERN_ERR "phyp-dump: unable to create sysfs file (%d)\n", rc);
> +		release_all();
> +		return 0;
> +	}
>  
>  	return 0;
>  }
> -
>  subsys_initcall(phyp_dump_setup);

Hmm I think this really should be a:
	machine_subsys_initcall(pseries, phyp_dump_setup)

Yours Tony

  linux.conf.au        http://linux.conf.au/ || http://lca2008.linux.org.au/
  Jan 28 - Feb 02 2008 The Australian Linux Technical Conference!