Subject: Re: [patch 4/7] ps3: Storage Driver Probing

From: Arnd Bergmann <[email-masked]>
Date: Fri, 25 May 2007 18:18:03 +0200

On Friday 25 May 2007, [email-masked] wrote:
> Add storage driver probing.
> New storage devices are detected and added by a kthread.

Hi Geert,

the driver looks pretty good, just a few details I noticed:

> +static u64 ps3stor_wait_for_completion(u64 devid, u64 tag,
> +				       unsigned int timeout)
> +{
> +	unsigned int retries = 0;
> +	u64 res = -1, status;
> +
> +	for (retries = 0; retries < timeout; retries++) {
> +		res = lv1_storage_check_async_status(NOTIFICATION_DEVID, tag,
> +						     &status);
> +		if (!res)
> +			break;
> +		set_current_state(TASK_INTERRUPTIBLE);
> +		schedule_timeout(1);
> +	}

Any reason not to use msleep(1) instead of the schedule_timeout?

> +	switch (dev_type) {
> +	case PS3_DEV_TYPE_STOR_DISK:
> +		match_id = PS3_MATCH_ID_STOR_DISK;
> +		break;
> +
> +	case PS3_DEV_TYPE_STOR_ROM:
> +		match_id = PS3_MATCH_ID_STOR_ROM;
> +		break;
> +
> +	case PS3_DEV_TYPE_STOR_FLASH:
> +		match_id = PS3_MATCH_ID_STOR_FLASH;
> +		break;
> +
> +	default:
> +		return 0;
> +	}

Why do you have separate constants for PS3_DEV_TYPE_* and
PS3_MATCH_ID_*? If you don't do any conversion, this driver
will immediately work for additional types as well, if more
get added later.

> +
> +//		pr_debug("%s:%u: Checking for new storage devices...\n",
> +//			 __func__, __LINE__);

Should be removed, or not in comments, either way is fine, as pr_debug
normally does not get compiled in anyway.

> +
> +		msleep_interruptible(ms);
> +		if (ms < 60000)
> +			ms <<= 1;

Is this timeout only for the disk spinup, or also for detecting media
added at run time, like inserting a DVD? One minute timeout for
detecting a DVD would sound very long to me.

	Arnd <><