From: Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>
To: "Moore, Robert" <robert.moore-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: ACPI mailing list
<acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Re: hard drive errors on acpi s3 resume
Date: Tue, 8 Nov 2005 10:11:44 +0100 [thread overview]
Message-ID: <20051108091144.GD15730@elf.ucw.cz> (raw)
In-Reply-To: <971FCB6690CD0E4898387DBF7552B90E0356BAE2-sBd4vmA9Se5Qxe9IK+vIArfspsVTdybXVpNB7YpNyf8@public.gmane.org>
Hi!
Please don't top post.
> Just out of curiosity, what issues do you find with the coding
> style?
I hope that means you want to clean it up and apply it ;-).
+#ifdef CONFIG_ACPI
+#include <linux/acpi.h>
+#define DBG(x...) printk(x)
Include in the middle of file? Renaming of printk to confuse reader?
+ int i, tmp;
+ acpi_integer addr;
...
+ addr = i;
...oops, something is very wrong in acpi land.
+#define GTM_LEN (sizeof(u32) * 5)
...
+ u32 gtm[GTM_LEN/sizeof(u32)]; /* info from _GTM */
Eh? Better names would be nice, too.
+ for (i = 0; i < MAX_DEVICES; i ++)
Please no space between i and ++.
+static struct acpi_ide_stat *ide_get_acpi_state(acpi_handle handle)
The function is strange, btw. Linear search, and it basically returns
pointer to zeros. I'd expect zeroing to be in caller or something like that.
+int acpi_ide_suspend(struct device *dev)
+{
+ acpi_handle handle, parent_handle;
+ struct acpi_ide_stat *stat;
+ acpi_status status;
At least alignment should be consistent locally.
+static int acpi_ide_gtf(acpi_handle handle, ide_drive_t *drive)
+{
+ struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
+ ide_task_t args;
+ int index = 0;
+ unsigned char *data;
+ union acpi_object *package = NULL;
+ acpi_status status;
...even more horible example of above.
+ /* submit command request */
+// printk("return value %d\n", ide_raw_taskfile(drive, &args, NULL));
+ index += 7;
Someone should learn to use delete key and version control...
+ if (stat->channel_handled == 0) {
+ stat->handle = NULL;
+ goto gtf;
+ }
+DBG("Start STM\n");
+ if (acpi_ide_stm(stat))
+ return -ENODEV;
+ stat->channel_handled = 0;
+gtf:
+ return acpi_ide_gtf(handle, drive);
+}
What about "else" instead of ugly goto. And that DBG should really go
away.
-
+#ifdef CONFIG_ACPI
+ acpi_ide_suspend(dev);
+#endif
-
+#ifdef CONFIG_ACPI
+ acpi_ide_resume(dev);
+#endif
memset(&rq, 0, sizeof(rq));
memset(&rqpm, 0, sizeof(rqpm));
memset(&args, 0, sizeof(args));
We normally allways provide acpi_ide_resume, but make them nop in
!ACPI case. That means #ifdefs are avoided in callers.
...should be enough...
Pavel
--
Thanks, Sharp!
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
next parent reply other threads:[~2005-11-08 9:11 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <971FCB6690CD0E4898387DBF7552B90E0356BAE2@orsmsx403.amr.corp.intel.com>
[not found] ` <971FCB6690CD0E4898387DBF7552B90E0356BAE2-sBd4vmA9Se5Qxe9IK+vIArfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2005-11-08 9:11 ` Pavel Machek [this message]
2005-11-09 0:06 hard drive errors on acpi s3 resume Moore, Robert
-- strict thread matches above, loose matches on Subject: below --
2005-11-08 9:27 Li, Shaohua
2005-11-08 9:30 ` Pavel Machek
[not found] ` <20051108093041.GI15730-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2005-11-09 0:57 ` Shaohua Li
2005-11-08 19:06 ` Matthew Garrett
[not found] ` <20051108190620.GA1316-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org>
2005-11-08 21:49 ` Pavel Machek
2005-11-09 0:52 ` Shaohua Li
[not found] ` <1131497528.2998.4.camel-ECwVeV2eNyQD0+JXs3kMbRL4W9x8LtSr@public.gmane.org>
2005-11-09 1:26 ` Alan Cox
2005-11-08 3:06 sdfa
[not found] ` <20051108030627.93670109EB8-ch062KcR4Qzgx848pHWfrcMwje2lEl0q0E9HWUfgJXw@public.gmane.org>
2005-10-07 6:31 ` Pavel Machek
2005-11-08 12:29 ` Alan Cox
2005-11-07 1:29 Li, Shaohua
2005-11-04 6:39 sdfa
[not found] ` <20051104063946.BB9CA3DF4-ch062KcR4Qw632oaNHexgA1yzfppHFFyQQ4Iyu8u01E@public.gmane.org>
2005-11-06 16:27 ` Pavel Machek
[not found] ` <20051106162739.GA28697-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2005-11-06 19:36 ` DJA
[not found] ` <436E5B50.3060600-+tLDYo+61VM+Va1GwOuvDg@public.gmane.org>
2005-10-07 6:29 ` Pavel Machek
2005-11-06 20:48 ` Alan Cox
[not found] ` <1131310139.1212.37.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2005-11-06 20:21 ` Pavel Machek
2005-11-07 1:22 ` Matthew Garrett
[not found] ` <20051107012229.GA19681-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org>
2005-11-07 23:34 ` Pavel Machek
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=20051108091144.GD15730@elf.ucw.cz \
--to=pavel-+zi9xunit7i@public.gmane.org \
--cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=robert.moore-ral2JQCrhuEAvxtiuMwx3w@public.gmane.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