mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Francois Romieu <romieu@fr.zoreil.com>
To: Max Asbock <masbock@us.ibm.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Driver for IBM RSA service processor (1/2)
Date: Mon, 2 Feb 2004 23:04:48 +0100	[thread overview]
Message-ID: <20040202230448.A18524@electric-eye.fr.zoreil.com> (raw)
In-Reply-To: <200402021129.53193.masbock@us.ibm.com>; from masbock@us.ibm.com on Mon, Feb 02, 2004 at 11:29:53AM -0800

Max Asbock <masbock@us.ibm.com> :
> diff -urN linux-2.6.1/drivers/misc/ibmasm/event.c linux-2.6.1-ibmasm/drivers/misc/ibmasm/event.c
> --- linux-2.6.1/drivers/misc/ibmasm/event.c	1969-12-31 16:00:00.000000000 -0800
> +++ linux-2.6.1-ibmasm/drivers/misc/ibmasm/event.c	2004-01-20 11:16:29.000000000 -0800
[...]
> +void ibmasm_receive_event(struct service_processor *sp, void *data, size_t data_size)
> +{
[...]
> +	/* advance indices in the buffer */
> +	buffer->next_index = ++(buffer->next_index) % IBMASM_NUM_EVENTS;

-> buffer->next_index = (buffer->next_index + 1) % IBMASM_NUM_EVENTS;

> diff -urN linux-2.6.1/drivers/misc/ibmasm/module.c linux-2.6.1-ibmasm/drivers/misc/ibmasm/module.c
> --- linux-2.6.1/drivers/misc/ibmasm/module.c	1969-12-31 16:00:00.000000000 -0800
> +++ linux-2.6.1-ibmasm/drivers/misc/ibmasm/module.c	2004-01-20 13:05:38.000000000 -0800
[...]
> +static int __init ibmasm_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
> +{
> +	int result = 0;

-> It can be set directly to -ENOMEM (and removed from several lines below).
   It will be overriden later if everything succeeds.

> diff -urN linux-2.6.1/drivers/misc/ibmasm/remote.c linux-2.6.1-ibmasm/drivers/misc/ibmasm/remote.c
> --- linux-2.6.1/drivers/misc/ibmasm/remote.c	1969-12-31 16:00:00.000000000 -0800
> +++ linux-2.6.1-ibmasm/drivers/misc/ibmasm/remote.c	2004-01-14 16:42:01.000000000 -0800
[...]
> +void ibmasm_free_remote_queue(struct service_processor *sp)
> +{
> +	if (sp->remote_queue.start)
> +		kfree(sp->remote_queue.start);
> +}

-> kfree(NULL) does not hurt. The 'if' can be removed.

[...]
> +size_t ibmasm_events_available(struct remote_queue *q)
> +{
> +	ssize_t diff = q->writer - q->reader;
> +
> +	if (diff >= 0)
> +		return diff;
> +	else
> +		return (q->end - q->reader);
> +}

-> return (diff >= 0) ? diff : q->end - q->reader; 
   Your choice.

--
Ueimor

  parent reply	other threads:[~2004-02-02 22:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-02 19:29 Max Asbock
2004-02-02 21:29 ` Randy.Dunlap
2004-02-02 22:04 ` Francois Romieu [this message]
     [not found] <200402021129.53193.masbock@us.ibm.com.suse.lists.linux.kernel>
2004-02-04  2:49 ` Andi Kleen

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=20040202230448.A18524@electric-eye.fr.zoreil.com \
    --to=romieu@fr.zoreil.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masbock@us.ibm.com \
    /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

all inboxes | Powered by JetHome®