login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2007
»
March
»
14
Re: [RFC][PATCH] Apple SMC driver (hardware monitoring and control)
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Cong WANG
Subject:
Re: [RFC][PATCH] Apple SMC driver (hardware monitoring and control)
Date: Wednesday, March 14, 2007 - 7:00 am
2007/3/14, Cong WANG wrote:
quoted text
> I am sorry. I forgot to CC to the list. > > 2007/3/14, Nicolas Boichat wrote: > > Hello, > > > > <snip> > > > +static ssize_t applesmc_show_fan_manual(struct device *dev, char *buf, > > + int offset) > > +{ > > + int ret; > > + u16 manual = 0; > > + u8 buffer[2]; > > + > > + down(&applesmc_sem); > > + > > + ret = applesmc_read_key(FANS_MANUAL, buffer, 2); > > + manual = ((buffer[0] << 8 | buffer[1]) >> offset) & 0x01; > > + > > + up(&applesmc_sem); > > + if (ret) > > + return ret; > > + else > > + return sprintf(buf, "%d\n", manual); > > +} > > + > > I doubt about your last 'sprintf'. Your 'buf' just has only two 'u8's, > which maybe only has two bytes, and '\n' already consumes one. So only > one byte is left for the decimal vaule of 'manual'. Even it is just > less than 10, just as what you want, the final '__PLACEHOLDER__0_' is omitted! > > What's more, you can't get such information from the return value of > 'sprintf'. So I suggest you to choose 'snprintf' instead. >
Sorry. I thought his 'buffer' as 'buf'. But my suggestion is still worthy your thinking. -
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[RFC][PATCH] Apple SMC driver (hardware monitoring and con ...
, Nicolas Boichat
, (Wed Mar 14, 2:29 am)
Re: [RFC][PATCH] Apple SMC driver (hardware monitoring and ...
, Cong WANG
, (Wed Mar 14, 4:11 am)
Re: [RFC][PATCH] Apple SMC driver (hardware monitoring and ...
, Cong WANG
, (Wed Mar 14, 7:00 am)
Re: [RFC][PATCH] Apple SMC driver (hardware monitoring and ...
, Nicolas Boichat
, (Thu Mar 15, 4:31 am)
[PATCH] Apple SMC driver (hardware monitoring and control)
, Nicolas Boichat
, (Sun Mar 18, 10:19 pm)
Re: [PATCH] Apple SMC driver (hardware monitoring and control)
, Andrew Morton
, (Sun Mar 18, 11:54 pm)
Re: [PATCH] Apple SMC driver (hardware monitoring and control)
, Nicolas Boichat
, (Mon Mar 19, 12:35 am)
Re: [RFC][PATCH] Apple SMC driver (hardware monitoring and ...
, Bob Copeland
, (Mon Mar 19, 2:43 pm)
Re: [RFC][PATCH] Apple SMC driver (hardware monitoring and ...
, Nicolas Boichat
, (Tue Mar 20, 12:02 am)
Re: [PATCH] Apple SMC driver (hardware monitoring and control)
, Nicolas Boichat
, (Tue Mar 20, 12:12 am)
Re: [lm-sensors] [RFC][PATCH] Apple SMC driver (hardware m ...
, Jean Delvare
, (Tue Mar 20, 3:08 am)
Re: [RFC][PATCH] Apple SMC driver (hardware monitoring and ...
, Bob Copeland
, (Tue Mar 20, 8:14 am)
Re: [RFC][PATCH] Apple SMC driver (hardware monitoring and ...
, Gerb Stralko
, (Tue Mar 20, 9:12 am)
Re: [RFC][PATCH] Apple SMC driver (hardware monitoring and ...
, Bob Copeland
, (Tue Mar 20, 9:03 pm)
Re: [lm-sensors] [RFC][PATCH] Apple SMC driver (hardware m ...
, Nicolas Boichat
, (Thu Mar 22, 3:36 am)
Re: [PATCH] Apple SMC driver (hardware monitoring and control)
, Dmitry Torokhov
, (Thu Mar 22, 8:37 am)
[PATCH] Apple SMC driver - fix input device
, Nicolas Boichat
, (Mon Apr 9, 6:53 am)
Re: [PATCH] Apple SMC driver - fix input device
, Dmitry Torokhov
, (Mon Apr 9, 8:17 am)
Re: [PATCH] Apple SMC driver - fix input device
, Andrew Morton
, (Mon Apr 9, 1:04 pm)
Re: [PATCH] Apple SMC driver - fix input device
, Dmitry Torokhov
, (Mon Apr 9, 1:11 pm)
Re: [PATCH] Apple SMC driver - fix input device
, Paul Mackerras
, (Mon Apr 9, 2:51 pm)
Re: [lm-sensors] [RFC][PATCH] Apple SMC driver (hardware m ...
, Jean Delvare
, (Wed Apr 11, 5:25 am)
Re: [lm-sensors] [RFC][PATCH] Apple SMC driver (hardware m ...
, Nicolas Boichat
, (Wed Apr 11, 5:47 am)
[PATCH 1/2] Apple SMC driver - standardize and sanitize sy ...
, Nicolas Boichat
, (Thu Apr 12, 10:33 pm)
[PATCH 2/2] Apple SMC driver - implement key enumeration
, Nicolas Boichat
, (Thu Apr 12, 11:38 pm)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Paul Turner
[tg_shares_up rewrite v4 11/11] sched: update tg->shares after cpu.shares write
Mr. James W. Laferriere
Re: Linux 2.6.25-rc1 , syntax error near unexpected token `;'
Linus Torvalds
Linux 2.6.34-rc4
Colin Cross
[PATCH 12/21] ARM: tegra: Add suspend and hotplug support
Chuck Ebbert
Re: PCI: Unable to reserve mem region problem
git
:
Fredrik Kuivinen
Re: fatal: unable to create '.git/index': File exists
Wink Saville
How-to combine several separate git repos?
Emily Ren
How to pull remote branch with specified commit id?
Denis Bueno
Git clone error
pradeep singh
git-update-server-info may be required,cannot clone and pull from a remote reposit...
linux-netdev
:
Jamie Lokier
Re: POHMELFS high performance network filesystem. Transactions, failover, performa...
Timo Teräs
ip xfrm policy semantics
Jarek Poplawski
Re: socket api problem: can't bind an ipv6 socket to ::ffff:0.0.0.0
Michael S. Tsirkin
[PATCH 3/3] vhost: fix get_user_pages_fast error handling
Randy Macleod
RFC: TIPC API, bind to two networks
openbsd-misc
:
Sevan / Venture37
Re: This is what Linus Torvalds calls openBSD crowd
Netmaffia.hu
Tini Lányok AKCIÓBAN OTTHON
Siju George
This is what Linus Torvalds calls openBSD crowd
Darrin Chandler
Re: OT: Python (was Re: vi in /bin)
frantisek holop
Re: splassert: vwakeup: and friends
git-commits-head
:
Linux Kernel Mailing List
ASoC: fix registration of the SoC card in the Freescale MPC8610 drivers
Linux Kernel Mailing List
drivers/acpi: use kasprintf
Linux Kernel Mailing List
powerpc/fsl_msi: enable msi allocation in all banks
Linux Kernel Mailing List
bnx2x: Moving includes
Linux Kernel Mailing List
[ARM] mmp: add dma support to mmp2
Colocation donated by:
Syndicate