qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2] chardev/char-i2c: Implement Linux I2C charac


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v2] chardev/char-i2c: Implement Linux I2C character device
Date: Tue, 7 May 2019 12:45:02 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

On 5/7/19 12:33 PM, Markus Armbruster wrote:

>> +static int i2c_ioctl(Chardev *chr, int cmd, void *arg)
>> +{
>> +    FDChardev *fd_chr = FD_CHARDEV(chr);
>> +    QIOChannelFile *floc = QIO_CHANNEL_FILE(fd_chr->ioc_in);
>> +    int fd = floc->fd;
>> +    int addr;
>> +
>> +    switch (cmd) {
>> +    case CHR_IOCTL_I2C_SET_ADDR:
>> +        addr = (int) (long) arg;
> 
> Would (int)arg make the compiler unhappy?

If you're trying to pass an integer through void*, it's probably best to
write:

addr = (intptr_t) arg;

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]