All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@fr.ibm.com>
To: Greg Kurz <gkurz@linux.vnet.ibm.com>
Cc: Corey Minyard <cminyard@mvista.com>,
	qemu-devel@nongnu.org,
	Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 6/9] ipmi: add get and set SENSOR_TYPE commands
Date: Fri, 22 Jan 2016 12:13:03 +0100	[thread overview]
Message-ID: <56A20EBF.2070408@fr.ibm.com> (raw)
In-Reply-To: <20160122120725.527647af@bahia.huguette.org>

On 01/22/2016 12:07 PM, Greg Kurz wrote:
> On Thu, 21 Jan 2016 18:18:51 +0100
> Cédric Le Goater <clg@fr.ibm.com> wrote:
> 
>> Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
>> Acked-by: Corey Minyard <cminyard@mvista.com>
>> ---
> 
> Reviewed-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
> 
> Just two nits below.
> 
>>  hw/ipmi/ipmi_bmc_sim.c | 45 ++++++++++++++++++++++++++++++++++++++++++++-
>>  1 file changed, 44 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c
>> index 803c7e5130c0..7c0f2a1d9799 100644
>> --- a/hw/ipmi/ipmi_bmc_sim.c
>> +++ b/hw/ipmi/ipmi_bmc_sim.c
>> @@ -42,6 +42,8 @@
>>  #define IPMI_CMD_REARM_SENSOR_EVTS        0x2a
>>  #define IPMI_CMD_GET_SENSOR_EVT_STATUS    0x2b
>>  #define IPMI_CMD_GET_SENSOR_READING       0x2d
>> +#define IPMI_CMD_SET_SENSOR_TYPE          0x2e
>> +#define IPMI_CMD_GET_SENSOR_TYPE          0x2f
>>
>>  /* #define IPMI_NETFN_APP             0x06 In ipmi.h */
>>
>> @@ -1527,6 +1529,45 @@ static void get_sensor_reading(IPMIBmcSim *ibs,
>>      }
>>  }
>>
>> +static void set_sensor_type(IPMIBmcSim *ibs,
>> +                               uint8_t *cmd, unsigned int cmd_len,
>> +                               uint8_t *rsp, unsigned int *rsp_len,
>> +                               unsigned int max_rsp_len)
>> +{
>> +    IPMISensor *sens;
>> +
>> +
>> +    IPMI_CHECK_CMD_LEN(5);
>> +    if ((cmd[2] > MAX_SENSORS) ||
> 
> This has been a recurring remark on many patches lately, and all the people
> don't necessarily agree but the extra parenthesis are not needed here...

Damn. Am I contaminated ? :)

C.

>> +            !IPMI_SENSOR_GET_PRESENT(ibs->sensors + cmd[2])) {
>> +        rsp[2] = IPMI_CC_REQ_ENTRY_NOT_PRESENT;
>> +        return;
>> +    }
>> +    sens = ibs->sensors + cmd[2];
>> +    sens->sensor_type = cmd[3];
>> +    sens->evt_reading_type_code = cmd[4] & 0x7f;
>> +}
>> +
>> +static void get_sensor_type(IPMIBmcSim *ibs,
>> +                               uint8_t *cmd, unsigned int cmd_len,
>> +                               uint8_t *rsp, unsigned int *rsp_len,
>> +                               unsigned int max_rsp_len)
>> +{
>> +    IPMISensor *sens;
>> +
>> +
>> +    IPMI_CHECK_CMD_LEN(3);
>> +    if ((cmd[2] > MAX_SENSORS) ||
> 
> and here.
> 
>> +            !IPMI_SENSOR_GET_PRESENT(ibs->sensors + cmd[2])) {
>> +        rsp[2] = IPMI_CC_REQ_ENTRY_NOT_PRESENT;
>> +        return;
>> +    }
>> +    sens = ibs->sensors + cmd[2];
>> +    IPMI_ADD_RSP_DATA(sens->sensor_type);
>> +    IPMI_ADD_RSP_DATA(sens->evt_reading_type_code);
>> +}
>> +
>> +
>>  static const IPMICmdHandler chassis_cmds[] = {
>>      [IPMI_CMD_GET_CHASSIS_CAPABILITIES] = chassis_capabilities,
>>      [IPMI_CMD_GET_CHASSIS_STATUS] = chassis_status,
>> @@ -1542,7 +1583,9 @@ static const IPMICmdHandler sensor_event_cmds[] = {
>>      [IPMI_CMD_GET_SENSOR_EVT_ENABLE] = get_sensor_evt_enable,
>>      [IPMI_CMD_REARM_SENSOR_EVTS] = rearm_sensor_evts,
>>      [IPMI_CMD_GET_SENSOR_EVT_STATUS] = get_sensor_evt_status,
>> -    [IPMI_CMD_GET_SENSOR_READING] = get_sensor_reading
>> +    [IPMI_CMD_GET_SENSOR_READING] = get_sensor_reading,
>> +    [IPMI_CMD_SET_SENSOR_TYPE] = set_sensor_type,
>> +    [IPMI_CMD_GET_SENSOR_TYPE] = get_sensor_type,
>>  };
>>  static const IPMINetfn sensor_event_netfn = {
>>      .cmd_nums = ARRAY_SIZE(sensor_event_cmds),
> 

  reply	other threads:[~2016-01-22 11:13 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-21 17:18 [Qemu-devel] [PATCH v2 0/9] ipmi: a couple of enhancements to the BMC simulator Cédric Le Goater
2016-01-21 17:18 ` [Qemu-devel] [PATCH v2 1/9] ppc: add IPMI support Cédric Le Goater
2016-01-21 17:18 ` [Qemu-devel] [PATCH v2 2/9] ipmi: replace goto by a return statement Cédric Le Goater
2016-01-22  5:49   ` Marcel Apfelbaum
2016-01-22  6:28   ` Greg Kurz
2016-01-22 12:56   ` Corey Minyard
2016-01-21 17:18 ` [Qemu-devel] [PATCH v2 3/9] ipmi: replace *_MAXCMD defines Cédric Le Goater
2016-01-22  8:05   ` Greg Kurz
2016-01-21 17:18 ` [Qemu-devel] [PATCH v2 4/9] ipmi: introduce a struct ipmi_sdr_compact Cédric Le Goater
2016-01-22 10:49   ` Greg Kurz
2016-01-22 11:10     ` Cédric Le Goater
2016-01-21 17:18 ` [Qemu-devel] [PATCH v2 5/9] ipmi: fix SDR length value Cédric Le Goater
2016-01-22 10:56   ` Greg Kurz
2016-01-22 11:15     ` Cédric Le Goater
2016-01-21 17:18 ` [Qemu-devel] [PATCH v2 6/9] ipmi: add get and set SENSOR_TYPE commands Cédric Le Goater
2016-01-22 11:07   ` Greg Kurz
2016-01-22 11:13     ` Cédric Le Goater [this message]
2016-01-21 17:18 ` [Qemu-devel] [PATCH v2 7/9] ipmi: add GET_SYS_RESTART_CAUSE chassis command Cédric Le Goater
2016-01-22 11:09   ` Greg Kurz
2016-01-21 17:18 ` [Qemu-devel] [PATCH v2 8/9] ipmi: add ACPI power and GUID commands Cédric Le Goater
2016-01-22 11:24   ` Greg Kurz
2016-01-22 11:58     ` Cédric Le Goater
2016-01-22 13:04   ` Corey Minyard
2016-01-21 17:18 ` [Qemu-devel] [PATCH v2 9/9] ipmi: add SET_SENSOR_READING command (tentative try) Cédric Le Goater
2016-01-22 11:28   ` Greg Kurz

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=56A20EBF.2070408@fr.ibm.com \
    --to=clg@fr.ibm.com \
    --cc=cminyard@mvista.com \
    --cc=gkurz@linux.vnet.ibm.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.