public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] acpiphp: Identify more removable slots
Date: Thu, 13 Nov 2008 13:48:59 -0700	[thread overview]
Message-ID: <20081113204859.GC1617@parisc-linux.org> (raw)
In-Reply-To: <20081113202739.GA11107@srcf.ucam.org>

On Thu, Nov 13, 2008 at 08:27:39PM +0000, Matthew Garrett wrote:
> @@ -94,11 +95,14 @@ static int is_ejectable(acpi_handle handle)
>  	}
>  
>  	status = acpi_get_handle(handle, "_EJ0", &tmp);
> -	if (ACPI_FAILURE(status)) {
> -		return 0;
> -	}
> +	if (ACPI_SUCCESS(status))
> +		ret = 1;
> +
> +	status = acpi_get_handle(handle, "_RMV", &tmp);
> +	if (ACPI_SUCCESS(status))
> +		ret = 1;
>  
> -	return 1;
> +	return ret;
>  }

Why not:

 	status = acpi_get_handle(handle, "_EJ0", &tmp);
	if (ACPI_SUCCESS(status))
		return 1;

	status = acpi_get_handle(handle, "_RMV", &tmp);
	if (ACPI_SUCCESS(status))
		return 1;

	return 0;

>  
>  
> @@ -182,17 +186,26 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
>  	struct acpiphp_func *newfunc;
>  	acpi_handle tmp;
>  	acpi_status status = AE_OK;
> -	unsigned long long adr, sun;
> -	int device, function, retval;
> +	unsigned long long adr, sun, removable;
> +	int device, function, retval, valid = 0;
>  
>  	status = acpi_evaluate_integer(handle, "_ADR", NULL, &adr);
>  
>  	if (ACPI_FAILURE(status))
>  		return AE_OK;
>  
> -	status = acpi_get_handle(handle, "_EJ0", &tmp);
> +	status = acpi_get_handle(handle, "_RMV", &tmp);
> +	if (ACPI_SUCCESS(status)) {
> +		acpi_evaluate_integer(handle, "_RMV", NULL, &removable);
> +		if (removable)
> +			valid = 1;
> +	}
>  
> -	if (ACPI_FAILURE(status) && !(is_dock_device(handle)))
> +	status = acpi_get_handle(handle, "_EJ0", &tmp);
> +	if (ACPI_SUCCESS(status) || is_dock_device(handle))
> +		valid = 1;
> +
> +	if (!valid)
>  		return AE_OK;

This looks like almost the same code as above.  New helper function?

>  	device = (adr >> 16) & 0xffff;
> 
> -- 
> Matthew Garrett | mjg59@srcf.ucam.org
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

  parent reply	other threads:[~2008-11-13 20:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-13 20:27 [PATCH 1/2] acpiphp: Identify more removable slots Matthew Garrett
2008-11-13 20:29 ` [PATCH 2/2] acpiphp: Call _LCK method Matthew Garrett
2008-11-13 20:48 ` Matthew Wilcox [this message]
2008-11-13 20:51   ` [PATCH 1/2] acpiphp: Identify more removable slots Matthew Garrett

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=20081113204859.GC1617@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mjg59@srcf.ucam.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