public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@ru•mvista.com>
To: Benjamin Herrenschmidt <benh@kernel•crashing.org>
Cc: tj@kernel•org, linux-ide@vger•kernel.org,
	linuxppc-dev@lists•ozlabs.org, jeff@garzik•org
Subject: Re: [PATCH 3/5] powerpc/macio: Rework hotplug media bay support
Date: Wed, 02 Dec 2009 15:08:40 +0300	[thread overview]
Message-ID: <4B1658C8.5020401@ru.mvista.com> (raw)
In-Reply-To: <20091202003628.CF4321007E0@ozlabs.org>

Hello.

Benjamin Herrenschmidt wrote:

> The hotplug mediabay has tendrils deep into drivers/ide code
> which makes a libata port reather difficult. In addition it's
> ugly and could be done better.
>
> This reworks the interface between the mediabay and the rest
> of the world so that:
>
>    - Any macio_driver can now have a mediabay_event callback
> which will be called when that driver sits on a mediabay and
> it's been either plugged or unplugged. The device type is
> passed as an argument. We can now move all the IDE cruft
> into the IDE driver itself
>
>    - A check_media_bay() function can be used to take a peek
> at the type of device currently in the bay if any, a cleaner
> variant of the previous function with the same name.
>
>    - A pair of lock/unlock functions are exposed to allow the
> IDE driver to block the hotplug callbacks during the initial
> setup and probing of the bay in order to avoid nasty race
> conditions.
>
>    - The mediabay code no longer needs to spin on the status
> register of the IDE interface when it detects an IDE device,
> this is done just fine by the IDE code itself
>
> Overall, less code, simpler, and allows for another driver
> than our old drivers/ide based one.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel•crashing.org>
>   

   Some grammar/style nitpicking...

> Index: linux-work/arch/powerpc/include/asm/mediabay.h
> ===================================================================
> --- linux-work.orig/arch/powerpc/include/asm/mediabay.h	2009-12-01 17:57:00.000000000 +1100
> +++ linux-work/arch/powerpc/include/asm/mediabay.h	2009-12-01 18:00:28.000000000 +1100
> @@ -17,26 +17,31 @@
>  #define MB_POWER	6	/* media bay contains a Power device (???) */
>  #define MB_NO		7	/* media bay contains nothing */
>  
> -/* Number of bays in the machine or 0 */
> -extern int media_bay_count;
> +struct macio_dev;
>  
> -#ifdef CONFIG_BLK_DEV_IDE_PMAC
> -#include <linux/ide.h>
> +#ifdef CONFIG_PMAC_MEDIABAY
>  
> -int check_media_bay_by_base(unsigned long base, int what);
> -/* called by IDE PMAC host driver to register IDE controller for media bay */
> -int media_bay_set_ide_infos(struct device_node *which_bay, unsigned long base,
> -			    int irq, ide_hwif_t *hwif);
> -
> -int check_media_bay(struct device_node *which_bay, int what);
> +/* Check the content type of the bay, returns MB_NO if the bay is still
> + * transitionning
> + */
>   

   Only "transitioning".

>  
> -int check_media_bay_by_base(unsigned long base, int what)
> +int check_media_bay(struct macio_dev *baydev)
>  {
> -	int	i;
> +	struct media_bay_info* bay;
> +	int id;
>  
> -	for (i=0; i<media_bay_count; i++)
> -		if (media_bays[i].mdev && base == (unsigned long) media_bays[i].cd_base) {
> -			if ((what == media_bays[i].content_id) && media_bays[i].state == mb_up)
> -				return 0;
> -			media_bays[i].cd_index = -1;
> -			return -EINVAL;
> -		} 
> +	if (baydev == NULL)
> +		return MB_NO;
>  
> -	return -ENODEV;
> +	/* This returns an instant snapshot, not locking, sine
>   

   Only "since".

> Index: linux-work/drivers/block/swim3.c
> ===================================================================
> --- linux-work.orig/drivers/block/swim3.c	2009-12-01 17:57:00.000000000 +1100
> +++ linux-work/drivers/block/swim3.c	2009-12-01 18:00:28.000000000 +1100
>   
[...]
> @@ -303,14 +303,13 @@ static int swim3_readbit(struct floppy_s
>  static void do_fd_request(struct request_queue * q)
>  {
>  	int i;
> -	for(i=0;i<floppy_count;i++)
> -	{
> -#ifdef CONFIG_PMAC_MEDIABAY
> -		if (floppy_states[i].media_bay &&
> -			check_media_bay(floppy_states[i].media_bay, MB_FD))
> +
> +	for(i=0; i<floppy_count; i++) {
>   

   You could insert spaces around operators here, while at it...

MBR, Sergei

  reply	other threads:[~2009-12-02 12:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-02  0:36 [PATCH 3/5] powerpc/macio: Rework hotplug media bay support Benjamin Herrenschmidt
2009-12-02 12:08 ` Sergei Shtylyov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-12-01  7:08 Benjamin Herrenschmidt

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=4B1658C8.5020401@ru.mvista.com \
    --to=sshtylyov@ru$(echo .)mvista.com \
    --cc=benh@kernel$(echo .)crashing.org \
    --cc=jeff@garzik$(echo .)org \
    --cc=linux-ide@vger$(echo .)kernel.org \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=tj@kernel$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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