greybus: kill off the last of gbuf.c

Only three functions remain in "gbuf.c".  Move one of them into
"connection.c" and the other two into "operation.c".

Some more cleanup is coming that will further straighten out gbufs
but for now there's no sense in drawing this out any longer.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
This commit is contained in:
Alex Elder 2014-11-17 18:08:37 -06:00 committed by Greg Kroah-Hartman
parent 4e5007e5c2
commit 374e6a269c
6 changed files with 31 additions and 54 deletions

View File

@ -1,5 +1,4 @@
greybus-y := core.o \
gbuf.o \
sysfs.o \
debugfs.o \
ap.o \

View File

@ -29,6 +29,21 @@ struct gb_connection *gb_hd_connection_find(struct greybus_host_device *hd,
return connection;
}
void greybus_cport_in(struct greybus_host_device *hd, u16 cport_id,
u8 *data, size_t length)
{
struct gb_connection *connection;
connection = gb_hd_connection_find(hd, cport_id);
if (!connection) {
dev_err(hd->parent,
"nonexistent connection (%zu bytes dropped)\n", length);
return;
}
gb_connection_operation_recv(connection, data, length);
}
EXPORT_SYMBOL_GPL(greybus_cport_in);
/*
* Allocate an available CPort Id for use for the host side of the
* given connection. The lowest-available id is returned, so the

View File

@ -53,6 +53,8 @@ void gb_connection_exit(struct gb_connection *connection);
struct gb_connection *gb_hd_connection_find(struct greybus_host_device *hd,
u16 cport_id);
void greybus_cport_in(struct greybus_host_device *hd, u16 cport_id,
u8 *data, size_t length);
__printf(2, 3)
void gb_connection_err(struct gb_connection *connection, const char *fmt, ...);

View File

@ -1,47 +0,0 @@
/*
* Greybus gbuf handling
*
* Copyright 2014 Google Inc.
*
* Released under the GPLv2 only.
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/types.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/device.h>
#include "greybus.h"
int greybus_submit_gbuf(struct gbuf *gbuf, gfp_t gfp_mask)
{
gbuf->status = -EINPROGRESS;
return gbuf->hd->driver->submit_gbuf(gbuf, gfp_mask);
}
void greybus_kill_gbuf(struct gbuf *gbuf)
{
if (gbuf->status != -EINPROGRESS)
return;
gbuf->hd->driver->kill_gbuf(gbuf);
}
void greybus_cport_in(struct greybus_host_device *hd, u16 cport_id,
u8 *data, size_t length)
{
struct gb_connection *connection;
connection = gb_hd_connection_find(hd, cport_id);
if (!connection) {
dev_err(hd->parent,
"nonexistent connection (%zu bytes dropped)\n", length);
return;
}
gb_connection_operation_recv(connection, data, length);
}
EXPORT_SYMBOL_GPL(greybus_cport_in);

View File

@ -102,12 +102,6 @@ struct greybus_host_device {
struct greybus_host_device *greybus_create_hd(struct greybus_host_driver *hd,
struct device *parent);
void greybus_remove_hd(struct greybus_host_device *hd);
void greybus_cport_in(struct greybus_host_device *hd, u16 cport_id,
u8 *data, size_t length);
int greybus_submit_gbuf(struct gbuf *gbuf, gfp_t mem_flags);
void greybus_kill_gbuf(struct gbuf *gbuf);
struct greybus_driver {
const char *name;

View File

@ -103,6 +103,20 @@ gb_pending_operation_find(struct gb_connection *connection, u16 id)
return found ? operation : NULL;
}
static int greybus_submit_gbuf(struct gbuf *gbuf, gfp_t gfp_mask)
{
gbuf->status = -EINPROGRESS;
return gbuf->hd->driver->submit_gbuf(gbuf, gfp_mask);
}
static void greybus_kill_gbuf(struct gbuf *gbuf)
{
if (gbuf->status != -EINPROGRESS)
return;
gbuf->hd->driver->kill_gbuf(gbuf);
}
/*
* An operations's response message has arrived. If no callback was
* supplied it was submitted for asynchronous completion, so we notify