st/prober: Remove auto-wrapper

This commit is contained in:
Jakob Bornecrantz 2019-06-30 14:28:39 +01:00
parent cc83b93733
commit ccac11ac1d
2 changed files with 0 additions and 107 deletions

View file

@ -10,7 +10,6 @@ include_directories(
set(PROBER_INCLUDES)
set(PROBER_SOURCE_FILES
p_auto_wrap.c
p_documentation.h
p_dump.c
p_prober.c

View file

@ -1,106 +0,0 @@
// Copyright 2019, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
* @brief Export a auto prober interface.
* @author Jakob Bornecrantz <jakob@collabora.com>
* @ingroup st_prober
*/
#include "xrt/xrt_compiler.h"
#include "xrt/xrt_prober.h"
#include "util/u_misc.h"
/*
*
* Structs and helprs.
*
*/
/*!
* Simple wrapper exposing the old interface.
*
* @ingroup st_prober
*/
struct prober_wrapper
{
struct xrt_auto_prober base;
struct xrt_prober *xp;
};
static inline struct prober_wrapper *
prober_wrapper(struct xrt_auto_prober *xap)
{
return (struct prober_wrapper *)xap;
}
/*
*
* Member functions.
*
*/
static struct xrt_device *
auto_probe(struct xrt_auto_prober *xap)
{
struct prober_wrapper *pw = prober_wrapper(xap);
struct xrt_device *xdev = NULL;
int ret;
ret = pw->xp->probe(pw->xp);
if (ret < 0) {
return NULL;
}
ret = pw->xp->select(pw->xp, &xdev, 1);
if (ret < 0) {
return NULL;
}
return xdev;
}
static void
destroy(struct xrt_auto_prober *xap)
{
struct prober_wrapper *pw = prober_wrapper(xap);
if (pw->xp != NULL) {
pw->xp->destroy(&pw->xp);
}
free(pw);
}
/*
*
* Exported function(s).
*
*/
struct xrt_auto_prober *
xrt_auto_prober_create()
{
struct prober_wrapper *pw = U_TYPED_CALLOC(struct prober_wrapper);
struct xrt_prober *xp = NULL;
int ret;
if (pw == NULL) {
return NULL;
}
ret = xrt_prober_create(&xp);
if (ret < 0) {
free(pw);
return NULL;
}
pw->base.lelo_dallas_autoprobe = auto_probe;
pw->base.destroy = destroy;
pw->xp = xp;
return &pw->base;
}